Don't sync app op mode for root and system uid.

Root and system server can pass all permission checks, so don't touch
their app op mode to keep compatibility.

Fixes: 155838450
Bug: 152592358
Test: b/155838450#comment32
Change-Id: Ia14542d132563aa01235dc9a9be1fd18851fd29e
This commit is contained in:
Hai Zhang
2020-06-17 14:03:49 -07:00
parent f07d289b51
commit 20eff34dfa

View File

@@ -825,7 +825,15 @@ public final class PermissionPolicyService extends SystemService {
return;
}
if (pkgInfo == null || pkg == null || pkgInfo.requestedPermissions == null) {
if (pkgInfo == null || pkg == null || pkgInfo.applicationInfo == null
|| pkgInfo.requestedPermissions == null) {
return;
}
final int uid = pkgInfo.applicationInfo.uid;
if (uid == Process.ROOT_UID || uid == Process.SYSTEM_UID) {
// Root and system server always pass permission checks, so don't touch their app
// ops to keep compatibility.
return;
}