summaryrefslogtreecommitdiffstats
path: root/test-runner
diff options
context:
space:
mode:
authorSvet Ganov <svetoslavganov@google.com>2015-05-07 10:48:44 -0700
committerSvetoslav <svetoslavganov@google.com>2015-05-11 17:13:57 -0700
commit8c7f700a59ad26e75c9791335d78f14322cad49a (patch)
tree151d514ffaf4c6bde3ee650e8f94b7f64eb74fd8 /test-runner
parent3ce72722ca14ad9e84ca54920bb2829696f68d53 (diff)
downloadframeworks_base-8c7f700a59ad26e75c9791335d78f14322cad49a.zip
frameworks_base-8c7f700a59ad26e75c9791335d78f14322cad49a.tar.gz
frameworks_base-8c7f700a59ad26e75c9791335d78f14322cad49a.tar.bz2
Add permission meta-state flags to support grant/revoke permission policy.
We now maintain a mata-state with each permission in the form of flags specyfying the policy for this permission. This enables support of the following use cases: 1. The user denies a permission with prejudice in which case an app cannot request the permission at runtime. If an app requests such a permssion it gets a denial unless the user grants the permission from settings. 2. A legacy app with disabled app-ops being upgraded to support runtime permissions. The disabled app ops are converted to permission revocations. The app ops manager is a part of the activity manger which sits on top of the package manager, hence the latter cannot have a dependency on the former. To avoid this the package installer which is the global permission managment authority marks the permission as revoked on upgrade and the package manager revokes it on upgrade. 3. A device policy fixing a permission in a granted or revoked state. This additional information is folded in the meta-state flags and neither apps can request such permissions if revoked not the user can change the permission state in the UI. Change-Id: I443e8a7bb94bfcb4ff6003d158e1408c26149811
Diffstat (limited to 'test-runner')
-rw-r--r--test-runner/src/android/test/mock/MockPackageManager.java21
1 files changed, 17 insertions, 4 deletions
diff --git a/test-runner/src/android/test/mock/MockPackageManager.java b/test-runner/src/android/test/mock/MockPackageManager.java
index 9efea0d..bf1ea4d 100644
--- a/test-runner/src/android/test/mock/MockPackageManager.java
+++ b/test-runner/src/android/test/mock/MockPackageManager.java
@@ -44,14 +44,12 @@ import android.content.pm.ResolveInfo;
import android.content.pm.ServiceInfo;
import android.content.pm.VerificationParams;
import android.content.pm.VerifierDeviceIdentity;
-import android.content.pm.PackageManager.MoveCallback;
import android.content.res.Resources;
import android.content.res.XmlResourceParser;
import android.graphics.Rect;
import android.graphics.drawable.Drawable;
import android.net.Uri;
import android.os.Handler;
-import android.os.ResultReceiver;
import android.os.UserHandle;
import android.os.storage.VolumeInfo;
@@ -195,13 +193,28 @@ public class MockPackageManager extends PackageManager {
/** @hide */
@Override
- public void grantPermission(String packageName, String permissionName, UserHandle user) {
+ public void grantRuntimePermission(String packageName, String permissionName,
+ UserHandle user) {
+ throw new UnsupportedOperationException();
+ }
+
+ /** @hide */
+ @Override
+ public void revokeRuntimePermission(String packageName, String permissionName,
+ UserHandle user) {
+ throw new UnsupportedOperationException();
+ }
+
+ /** @hide */
+ @Override
+ public int getPermissionFlags(String permissionName, String packageName, UserHandle user) {
throw new UnsupportedOperationException();
}
/** @hide */
@Override
- public void revokePermission(String packageName, String permissionName, UserHandle user) {
+ public void updatePermissionFlags(String permissionName, String packageName,
+ int flagMask, int flagValues, UserHandle user) {
throw new UnsupportedOperationException();
}