summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorArthur Shuai <shuaiq@codeaurora.org>2016-10-20 15:50:44 +0800
committerArthur Shuai <shuaiq@codeaurora.org>2016-10-20 15:50:44 +0800
commit64d3812bca7c1121a767e8436b433e8b293e0110 (patch)
treed516e3e68e3fa79650f45cfabf5c8b5deee9d316
parent5716d5b8e853ced35bbc4ffa51302fc7276f3470 (diff)
downloadandroid_packages_apps_PackageInstaller-64d3812bca7c1121a767e8436b433e8b293e0110.zip
android_packages_apps_PackageInstaller-64d3812bca7c1121a767e8436b433e8b293e0110.tar.gz
android_packages_apps_PackageInstaller-64d3812bca7c1121a767e8436b433e8b293e0110.tar.bz2
Disable permission auto enable in case only disable it under group permission
The permission of dial out will be auto enabled if only disable it under call group permission. This change disable auto enable permission in this case. Change-Id: Ibe8c9064fcd4fdfd33da69d68c145a5108a484d2 CRs-Fixed:1079155
-rw-r--r--[-rwxr-xr-x]src/com/android/packageinstaller/permission/model/AppPermissionGroup.java22
-rw-r--r--src/com/android/packageinstaller/permission/ui/GrantPermissionsActivity.java24
2 files changed, 40 insertions, 6 deletions
diff --git a/src/com/android/packageinstaller/permission/model/AppPermissionGroup.java b/src/com/android/packageinstaller/permission/model/AppPermissionGroup.java
index 2bdae42..aa68959 100755..100644
--- a/src/com/android/packageinstaller/permission/model/AppPermissionGroup.java
+++ b/src/com/android/packageinstaller/permission/model/AppPermissionGroup.java
@@ -286,6 +286,28 @@ public final class AppPermissionGroup implements Comparable<AppPermissionGroup>
return mPermissions.get(permission) != null;
}
+ public boolean checkRuntimePermission(String[] filterPermissions) {
+ if (LocationUtils.isLocationGroupAndProvider(mName, mPackageInfo.packageName)) {
+ return LocationUtils.isLocationEnabled(mContext);
+ }
+ final int permissionCount = mPermissions.size();
+ for (int i = 0; i < permissionCount; i++) {
+ Permission permission = mPermissions.valueAt(i);
+ if (filterPermissions != null
+ && !ArrayUtils.contains(filterPermissions, permission.getName())) {
+ continue;
+ }
+ if (mAppSupportsRuntimePermissions) {
+ if (!permission.isGranted()) {
+ return false;
+ }
+ } else if (permission.isGranted() && (permission.getAppOp() == null
+ || permission.isAppOpAllowed())) {
+ return true;
+ }
+ }
+ return false;
+ }
public boolean areRuntimePermissionsGranted() {
return areRuntimePermissionsGranted(null);
}
diff --git a/src/com/android/packageinstaller/permission/ui/GrantPermissionsActivity.java b/src/com/android/packageinstaller/permission/ui/GrantPermissionsActivity.java
index 4a4b755..fdb1648 100644
--- a/src/com/android/packageinstaller/permission/ui/GrantPermissionsActivity.java
+++ b/src/com/android/packageinstaller/permission/ui/GrantPermissionsActivity.java
@@ -161,12 +161,22 @@ public class GrantPermissionsActivity extends OverlayTouchActivity
break;
default: {
- if (!group.areRuntimePermissionsGranted()) {
- mRequestGrantPermissionGroups.put(group.getName(),
- new GroupState(group));
+ if (AppPermissionGroup.isStrictOpEnable()) {
+ if (!group.checkRuntimePermission(null)) {
+ mRequestGrantPermissionGroups.put(group.getName(),
+ new GroupState(group));
+ } else {
+ group.grantRuntimePermissions(false);
+ updateGrantResults(group);
+ }
} else {
- group.grantRuntimePermissions(false);
- updateGrantResults(group);
+ if (!group.areRuntimePermissionsGranted()) {
+ mRequestGrantPermissionGroups.put(group.getName(),
+ new GroupState(group));
+ } else {
+ group.grantRuntimePermissions(false);
+ updateGrantResults(group);
+ }
}
}
break;
@@ -297,7 +307,9 @@ public class GrantPermissionsActivity extends OverlayTouchActivity
groupState.mGroup.grantRuntimePermissions(doNotAskAgain);
groupState.mState = GroupState.STATE_ALLOWED;
} else {
- groupState.mGroup.revokeRuntimePermissions(doNotAskAgain);
+ if(!AppPermissionGroup.isStrictOpEnable()){
+ groupState.mGroup.revokeRuntimePermissions(doNotAskAgain);
+ }
groupState.mState = GroupState.STATE_DENIED;
}
updateGrantResults(groupState.mGroup);