summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDanny Baumann <dannybaumann@web.de>2013-07-17 13:12:59 +0200
committerEddy Witkamp <eddywitkamp@gmail.com>2013-07-30 14:41:41 +0200
commit3d406414538a431cb254b1f8c34439b787b88a70 (patch)
treee5d2233a034bba85f7bf8d4c2e4dc1d8000c4c65
parent51b64b36122ea0bc4beab813ec3b85b4899e9899 (diff)
downloadpackages_apps_settings-3d406414538a431cb254b1f8c34439b787b88a70.zip
packages_apps_settings-3d406414538a431cb254b1f8c34439b787b88a70.tar.gz
packages_apps_settings-3d406414538a431cb254b1f8c34439b787b88a70.tar.bz2
Sort disabled apps to the end of the list in privacy guard manager.
JIRA: CYAN-1703 Change-Id: Ie3c1cf0339d66405d27c06dba07cc80e4001d669
-rw-r--r--src/com/android/settings/cyanogenmod/privacyguard/PrivacyGuardManager.java7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/com/android/settings/cyanogenmod/privacyguard/PrivacyGuardManager.java b/src/com/android/settings/cyanogenmod/privacyguard/PrivacyGuardManager.java
index 51942ae..4b49cf5 100644
--- a/src/com/android/settings/cyanogenmod/privacyguard/PrivacyGuardManager.java
+++ b/src/com/android/settings/cyanogenmod/privacyguard/PrivacyGuardManager.java
@@ -94,6 +94,7 @@ public class PrivacyGuardManager extends Fragment
public static final class AppInfo {
String title;
String packageName;
+ boolean enabled;
boolean privacyGuardEnabled;
}
@@ -245,14 +246,18 @@ public class PrivacyGuardManager extends Fragment
AppInfo app = new AppInfo();
app.title = appInfo.loadLabel(mPm).toString();
app.packageName = info.packageName;
+ app.enabled = appInfo.enabled;
app.privacyGuardEnabled = mPm.getPrivacyGuardSetting(app.packageName);
apps.add(app);
}
- // sort the apps by title
+ // sort the apps by their enabled state, then by title
Collections.sort(apps, new Comparator<AppInfo>() {
@Override
public int compare(AppInfo lhs, AppInfo rhs) {
+ if (lhs.enabled != rhs.enabled) {
+ return lhs.enabled ? -1 : 1;
+ }
return lhs.title.compareToIgnoreCase(rhs.title);
}
});