OSDN Git Service

Allow UiAutomation to adopt the shell permission indentity
authorSvet Ganov <svetoslavganov@google.com>
Mon, 25 Jun 2018 23:39:23 +0000 (16:39 -0700)
committerSvet Ganov <svetoslavganov@google.com>
Tue, 3 Jul 2018 23:39:44 +0000 (16:39 -0700)
commitd873ae62c443dc3381fca328dcf5b73c157daf03
treeabbeb50380e346db85b199fba04ee3f8cc9691c6
parente3d3ca75dc12dda14a7e8c9c4b65b89318eae484
Allow UiAutomation to adopt the shell permission indentity

For testing we often need to run shell commands. This can be done
today via running a shell command from an instrumentation test
started from the shell. However, this requires adding shell commands
which are not in the API contract, involve boilerplate code, require
string parsing, etc.

This change allows an instrumentation started from the shell to
adopt the shell UID permission state. As a result one can call APIs
protected by permissions normal apps cannot get by are granted to
the shell. This enables adding dedicated test APIs protected by
signatures permissions  granted to the shell.

Test: cts-tradefed run cts-dev -m CtsUiAutomationTestCases
          -t android.app.uiautomation.cts.UiAutomationTest#testAdoptShellPermissions

bug:80415658

Change-Id: I4bfd4b475225125512abf80ea98cd8fcacb6a1be
15 files changed:
api/current.txt
api/test-current.txt
core/java/android/app/AppOpsManager.java
core/java/android/app/AppOpsManagerInternal.java
core/java/android/app/IActivityManager.aidl
core/java/android/app/IUiAutomationConnection.aidl
core/java/android/app/UiAutomation.java
core/java/android/app/UiAutomationConnection.java
core/java/android/content/pm/PackageManager.java
core/java/android/content/pm/PackageManagerInternal.java
core/java/com/android/internal/app/IAppOpsService.aidl
services/core/java/com/android/server/AppOpsService.java
services/core/java/com/android/server/am/ActivityManagerService.java
services/core/java/com/android/server/pm/PackageManagerService.java
services/core/java/com/android/server/pm/permission/PermissionManagerInternal.java