Skip to content
Commit be06f0f2 authored by Hai Zhang's avatar Hai Zhang
Browse files

Fix --user parameter when setting app op for shell with shell command.

ag/13692058 added "com.android.shell" into resolveUid(), which is also
used by appops shell command. However unlike the other special UID
names (e.g. root, shell, media, audioserver), "com.android.shell" is a
regular package name, so this broke the assumption that the UIDs
returned from resolveUid() are all special UIDs that only runs in the
primary user, and made the shell command always set the package mode
for the com.android.shell package in primary user despite being given
an explicit --user parameter (see parserUserPackageOp()
implementation).

So the fix should be keeping the resolveUid()'s semantics and make it
only handle the special UID names instead of package names. For the
special case for shell in verifyAndGetBypass(), it can be done in that
method locally.

Bug: 187329570
Test: adb shell appops set --user 10 com.android.shell
      MANAGE_IPSEC_TUNNELS allow
Test: adb shell dumpsys appops | grep -5 shell
Change-Id: Ia3157d6fd45dad085fa672e385287817fa20e90b
parent 80b02a06
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment