diff options
author | David van Tonder <david.vantonder@gmail.com> | 2013-07-30 23:49:27 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@cyanogenmod.org> | 2013-07-30 23:49:27 +0000 |
commit | a97896c6f9b066b7aaae88a515c247668c8ac86a (patch) | |
tree | 4abb337dfafcdb407682263fd18b485b82751dad | |
parent | 003a4a6fdff34b7a8a9951cb954ee326694e4136 (diff) | |
parent | 3d406414538a431cb254b1f8c34439b787b88a70 (diff) | |
download | packages_apps_settings-a97896c6f9b066b7aaae88a515c247668c8ac86a.zip packages_apps_settings-a97896c6f9b066b7aaae88a515c247668c8ac86a.tar.gz packages_apps_settings-a97896c6f9b066b7aaae88a515c247668c8ac86a.tar.bz2 |
Merge "Sort disabled apps to the end of the list in privacy guard manager." into cm-10.1
-rw-r--r-- | src/com/android/settings/cyanogenmod/privacyguard/PrivacyGuardManager.java | 7 |
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); } }); |