summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorShijian Li <shijianli@google.com>2017-01-09 15:20:49 (GMT)
committerShijian Li <shijianli@google.com>2017-01-09 15:24:33 (GMT)
commit8bb255379818d819589fb8ee63927042a4464da2 (patch)
tree041150af4ec489cc7b4432f52fbb975797b72e92
parent1019d73896ca8ec9baac1492c08443c7a6339380 (diff)
downloadandroid_packages_apps_PackageInstaller-8bb255379818d819589fb8ee63927042a4464da2.zip
android_packages_apps_PackageInstaller-8bb255379818d819589fb8ee63927042a4464da2.tar.gz
android_packages_apps_PackageInstaller-8bb255379818d819589fb8ee63927042a4464da2.tar.bz2
Add refresh logic for individually controlled permission in onResume.
Test: Manually test with a testing apk. Bug: 34157556 Change-Id: I78ffbfa2fbbff14fb05242d7979cd226b1725ba7
-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);
+ }
+ }
}