summaryrefslogtreecommitdiffstats
path: root/core/java/android/app/UiAutomationConnection.java
diff options
context:
space:
mode:
Diffstat (limited to 'core/java/android/app/UiAutomationConnection.java')
-rw-r--r--core/java/android/app/UiAutomationConnection.java36
1 files changed, 36 insertions, 0 deletions
diff --git a/core/java/android/app/UiAutomationConnection.java b/core/java/android/app/UiAutomationConnection.java
index 39cd3bc..13e27e2 100644
--- a/core/java/android/app/UiAutomationConnection.java
+++ b/core/java/android/app/UiAutomationConnection.java
@@ -19,6 +19,7 @@ package android.app;
import android.accessibilityservice.AccessibilityServiceInfo;
import android.accessibilityservice.IAccessibilityServiceClient;
import android.content.Context;
+import android.content.pm.IPackageManager;
import android.graphics.Bitmap;
import android.hardware.input.InputManager;
import android.os.Binder;
@@ -60,6 +61,9 @@ public final class UiAutomationConnection extends IUiAutomationConnection.Stub {
private final IAccessibilityManager mAccessibilityManager = IAccessibilityManager.Stub
.asInterface(ServiceManager.getService(Service.ACCESSIBILITY_SERVICE));
+ private final IPackageManager mPackageManager = IPackageManager.Stub
+ .asInterface(ServiceManager.getService("package"));
+
private final Object mLock = new Object();
private final Binder mToken = new Binder();
@@ -227,6 +231,38 @@ public final class UiAutomationConnection extends IUiAutomationConnection.Stub {
}
@Override
+ public void grantRuntimePermission(String packageName, String permission, int userId)
+ throws RemoteException {
+ synchronized (mLock) {
+ throwIfCalledByNotTrustedUidLocked();
+ throwIfShutdownLocked();
+ throwIfNotConnectedLocked();
+ }
+ final long identity = Binder.clearCallingIdentity();
+ try {
+ mPackageManager.grantRuntimePermission(packageName, permission, userId);
+ } finally {
+ Binder.restoreCallingIdentity(identity);
+ }
+ }
+
+ @Override
+ public void revokeRuntimePermission(String packageName, String permission, int userId)
+ throws RemoteException {
+ synchronized (mLock) {
+ throwIfCalledByNotTrustedUidLocked();
+ throwIfShutdownLocked();
+ throwIfNotConnectedLocked();
+ }
+ final long identity = Binder.clearCallingIdentity();
+ try {
+ mPackageManager.revokeRuntimePermission(packageName, permission, userId);
+ } finally {
+ Binder.restoreCallingIdentity(identity);
+ }
+ }
+
+ @Override
public void executeShellCommand(final String command, final ParcelFileDescriptor sink)
throws RemoteException {
synchronized (mLock) {