Don't reset mode for OP_REQUEST_INSTALL_PACKAGES.

Settings allows the user to control the app op if it's not in the
default mode, regardless of whether the app has requested the
permission, so we should not reset it.

Fixes: 150819885
Test: atest CtsNoPermissionTestCases25
Change-Id: Iba87574febe8c0f8ed5c779c19f00b39d811a835
This commit is contained in:
Hai Zhang
2020-05-28 14:12:20 -07:00
parent 8a6ef8e52d
commit 643f913ee5

View File

@@ -208,6 +208,11 @@ public final class PermissionPolicyService extends SystemService {
case android.Manifest.permission.ACCESS_NOTIFICATIONS:
case android.Manifest.permission.MANAGE_IPSEC_TUNNELS:
continue;
case android.Manifest.permission.REQUEST_INSTALL_PACKAGES:
// Settings allows the user to control the app op if it's not in the default
// mode, regardless of whether the app has requested the permission, so we
// should not reset it.
continue;
default:
final int appOpCode = AppOpsManager.permissionToOpCode(
appOpPermissionInfo.name);