summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDanny Baumann <dannybaumann@web.de>2013-08-01 09:43:31 +0200
committerDanny Baumann <dannybaumann@web.de>2013-08-07 15:42:09 +0200
commit937df1cb6f6482ddcdbac769ec6b4069bd9151f7 (patch)
treef8509b3a629a38d37484d27f0c488b82135eb986
parent4f5e12e6c8f6141989235c2d67ca01587a2b9bd7 (diff)
downloadpackages_apps_settings-937df1cb6f6482ddcdbac769ec6b4069bd9151f7.zip
packages_apps_settings-937df1cb6f6482ddcdbac769ec6b4069bd9151f7.tar.gz
packages_apps_settings-937df1cb6f6482ddcdbac769ec6b4069bd9151f7.tar.bz2
Also remove preferences if app is installed, but disabled.
Change-Id: I7f23e7a05c336bd16cda3426c7b31922cb92e1b2 JIRA:CYAN-1861
-rw-r--r--src/com/android/settings/SettingsPreferenceFragment.java18
1 files changed, 15 insertions, 3 deletions
diff --git a/src/com/android/settings/SettingsPreferenceFragment.java b/src/com/android/settings/SettingsPreferenceFragment.java
index 3a225f3..421d048 100644
--- a/src/com/android/settings/SettingsPreferenceFragment.java
+++ b/src/com/android/settings/SettingsPreferenceFragment.java
@@ -22,6 +22,7 @@ import android.app.Fragment;
import android.content.ContentResolver;
import android.content.DialogInterface;
import android.content.Intent;
+import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
import android.content.pm.PackageManager.NameNotFoundException;
import android.net.Uri;
@@ -323,15 +324,26 @@ public class SettingsPreferenceFragment extends PreferenceFragment implements Di
Matcher matcher = pattern.matcher(intentUri);
String packageName = matcher.find() ? matcher.group(1) : null;
+ boolean available = true;
+
if (packageName != null) {
try {
- getPackageManager().getPackageInfo(packageName, 0);
+ PackageInfo pi = getPackageManager().getPackageInfo(packageName, 0);
+ if (!pi.applicationInfo.enabled) {
+ Log.e(TAG, "package " + packageName + " disabled, hiding preference.");
+ available = false;
+ }
} catch (NameNotFoundException e) {
Log.e(TAG, "package " + packageName + " not installed, hiding preference.");
- parent.removePreference(preference);
- return true;
+ available = false;
}
}
+
+ if (!available) {
+ parent.removePreference(preference);
+ return true;
+ }
+
return false;
}
}