summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLinux Build Service Account <lnxbuild@localhost>2016-12-06 00:51:00 -0700
committerLinux Build Service Account <lnxbuild@localhost>2016-12-06 00:51:00 -0700
commit5b2827699c2498c8e5c79b55177a129e8dbfa292 (patch)
treed516e3e68e3fa79650f45cfabf5c8b5deee9d316
parentfafa0d8c4d775fd83d3d08cfabcb82999eb62014 (diff)
parent7f3bc87a69368ecdc9a27d8c6a21ee4b2d7fd32f (diff)
downloadandroid_packages_apps_PackageInstaller-5b2827699c2498c8e5c79b55177a129e8dbfa292.zip
android_packages_apps_PackageInstaller-5b2827699c2498c8e5c79b55177a129e8dbfa292.tar.gz
android_packages_apps_PackageInstaller-5b2827699c2498c8e5c79b55177a129e8dbfa292.tar.bz2
Merge 7f3bc87a69368ecdc9a27d8c6a21ee4b2d7fd32f on remote branch
Change-Id: I0e861c1400c6a8267ca0e665c94646a719f39aac
-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);