summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorShijian Li <shijianli@google.com>2017-01-09 19:50:28 (GMT)
committerandroid-build-merger <android-build-merger@google.com>2017-01-09 19:50:28 (GMT)
commit8eb3b01e0137ecbe46c4e7c6aca5be3d18408c61 (patch)
treebb86200870cef131a90725d14f96d06982880e3d
parent6b8280477dc1177d1160023729d71d9e788c1328 (diff)
parent8bb255379818d819589fb8ee63927042a4464da2 (diff)
downloadandroid_packages_apps_PackageInstaller-8eb3b01e0137ecbe46c4e7c6aca5be3d18408c61.zip
android_packages_apps_PackageInstaller-8eb3b01e0137ecbe46c4e7c6aca5be3d18408c61.tar.gz
android_packages_apps_PackageInstaller-8eb3b01e0137ecbe46c4e7c6aca5be3d18408c61.tar.bz2
Add refresh logic for individually controlled permission in onResume.
am: 8bb2553798 Change-Id: Ibd2704c76e63a57c9f4aee6085e909cf984df68f
-rw-r--r--src/com/android/packageinstaller/permission/ui/wear/AppPermissionsFragmentWear.java17
1 files changed, 14 insertions, 3 deletions
diff --git a/src/com/android/packageinstaller/permission/ui/wear/AppPermissionsFragmentWear.java b/src/com/android/packageinstaller/permission/ui/wear/AppPermissionsFragmentWear.java
index d2d1f71..3161567 100644
--- a/src/com/android/packageinstaller/permission/ui/wear/AppPermissionsFragmentWear.java
+++ b/src/com/android/packageinstaller/permission/ui/wear/AppPermissionsFragmentWear.java
@@ -137,9 +137,13 @@ public final class AppPermissionsFragmentWear extends PreferenceFragment {
// Also refresh the UI
for (final AppPermissionGroup group : mAppPermissions.getPermissionGroups()) {
- Preference pref = findPreference(group.getName());
- if (pref instanceof SwitchPreference) {
- ((SwitchPreference) pref).setChecked(group.areRuntimePermissionsGranted());
+ if (Utils.areGroupPermissionsIndividuallyControlled(getContext(), group.getName())) {
+ for (PermissionInfo perm : getPermissionInfosFromGroup(group)) {
+ setPreferenceCheckedIfPresent(perm.name,
+ group.areRuntimePermissionsGranted(new String[]{ perm.name }));
+ }
+ } else {
+ setPreferenceCheckedIfPresent(group.getName(), group.areRuntimePermissionsGranted());
}
}
}
@@ -304,4 +308,11 @@ public final class AppPermissionsFragmentWear extends PreferenceFragment {
}
return permInfos;
}
+
+ private void setPreferenceCheckedIfPresent(String preferenceKey, boolean checked) {
+ Preference pref = findPreference(preferenceKey);
+ if (pref instanceof SwitchPreference) {
+ ((SwitchPreference) pref).setChecked(checked);
+ }
+ }
}