From f679ca2cc5f81a2b9ad725aa3fe60c318a5689d3 Mon Sep 17 00:00:00 2001 From: Catfriend1 Date: Wed, 6 Mar 2019 00:12:37 +0100 Subject: [PATCH] Show Android Open File Limit (fixes #346) (#350) * Show Android Open File Limit (fixes #346) * Imported de translation --- .../activities/SettingsActivity.java | 13 +++++++++++++ app/src/main/res/values-de/strings.xml | 3 +++ app/src/main/res/values/strings.xml | 3 +++ app/src/main/res/xml/app_settings.xml | 6 ++++++ 4 files changed, 25 insertions(+) diff --git a/app/src/main/java/com/nutomic/syncthingandroid/activities/SettingsActivity.java b/app/src/main/java/com/nutomic/syncthingandroid/activities/SettingsActivity.java index 5177119a..0ec0eb43 100644 --- a/app/src/main/java/com/nutomic/syncthingandroid/activities/SettingsActivity.java +++ b/app/src/main/java/com/nutomic/syncthingandroid/activities/SettingsActivity.java @@ -150,6 +150,7 @@ public class SettingsActivity extends SyncthingActivity { // Settings/About private static final String KEY_SYNCTHING_API_KEY = "syncthing_api_key"; private static final String KEY_SYNCTHING_DATABASE_SIZE = "syncthing_database_size"; + private static final String KEY_OS_OPEN_FILE_LIMIT = "os_open_file_limit"; private static final String BIND_ALL = "0.0.0.0"; private static final String BIND_LOCALHOST = "127.0.0.1"; @@ -394,6 +395,7 @@ public class SettingsActivity extends SyncthingActivity { Log.d(TAG, "Failed to get app version name"); } screen.findPreference(KEY_SYNCTHING_DATABASE_SIZE).setSummary(getDatabaseSize()); + screen.findPreference(KEY_OS_OPEN_FILE_LIMIT).setSummary(getOpenFileLimit()); // Check if we should directly show a sub preference screen. Bundle bundle = getArguments(); @@ -1081,5 +1083,16 @@ public class SettingsActivity extends SyncthingActivity { } return resultParts[0]; } + + /** + * Get current open file limit enforced by the Android OS. + */ + private String getOpenFileLimit() { + String result = Util.runShellCommandGetOutput("/system/bin/ulimit -n", false); + if (TextUtils.isEmpty(result)) { + return "N/A"; + } + return result; + } } } diff --git a/app/src/main/res/values-de/strings.xml b/app/src/main/res/values-de/strings.xml index bb0ccc71..b379c5cc 100644 --- a/app/src/main/res/values-de/strings.xml +++ b/app/src/main/res/values-de/strings.xml @@ -651,6 +651,9 @@ Bitte melden Sie auftretende Probleme via GitHub. Syncthing Datenbankgröße + + Android Offene Dateien Limit + diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 7155fe5c..2099cc1d 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -672,6 +672,9 @@ Please report any problems you encounter via Github. Syncthing Database Size + + Android Open File Limit + diff --git a/app/src/main/res/xml/app_settings.xml b/app/src/main/res/xml/app_settings.xml index af1e48b8..09a99faf 100644 --- a/app/src/main/res/xml/app_settings.xml +++ b/app/src/main/res/xml/app_settings.xml @@ -344,6 +344,12 @@ android:key="syncthing_database_size" android:title="@string/syncthing_database_size" /> + +