Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit cc3a6e04 authored by Rubin Xu's avatar Rubin Xu
Browse files

Do not hold lock inside enableSystemApp

DPMS.enableSystemApp() is not accessing any internal data structure
so there is no need to hold the lock.

Bug: 201498074
Test: atest android.devicepolicy.cts.SystemAppTest
Test: atest MixedDeviceOwnerTest#testEnableSystemAppLogged
Test: atest MixedDeviceOwnerTest#testEnableSystemAppWithIntentLogged
Change-Id: Ie63022b5019bbd4ee97429e30b07e242fed6a138
parent c7cdc8ca
Loading
Loading
Loading
Loading
+55 −59
Original line number Diff line number Diff line
@@ -11608,7 +11608,6 @@ public class DevicePolicyManagerService extends BaseIDevicePolicyManager {
                && (isProfileOwner(caller) || isDefaultDeviceOwner(caller)))
                || (caller.hasPackage() && isCallerDelegate(caller, DELEGATION_ENABLE_SYSTEM_APP)));
        synchronized (getLockObject()) {
        final boolean isDemo = isCurrentUserDemo();
        int userId = caller.getUserId();
        long id = mInjector.binderClearCallingIdentity();
@@ -11636,7 +11635,6 @@ public class DevicePolicyManagerService extends BaseIDevicePolicyManager {
        } finally {
            mInjector.binderRestoreCallingIdentity(id);
        }
        }
        DevicePolicyEventLogger
                .createEvent(DevicePolicyEnums.ENABLE_SYSTEM_APP)
                .setAdmin(caller.getPackageName())
@@ -11653,7 +11651,6 @@ public class DevicePolicyManagerService extends BaseIDevicePolicyManager {
                || (caller.hasPackage() && isCallerDelegate(caller, DELEGATION_ENABLE_SYSTEM_APP)));
        int numberOfAppsInstalled = 0;
        synchronized (getLockObject()) {
        long id = mInjector.binderClearCallingIdentity();
        try {
            final int parentUserId = getProfileParentId(caller.getUserId());
@@ -11692,7 +11689,6 @@ public class DevicePolicyManagerService extends BaseIDevicePolicyManager {
        } finally {
            mInjector.binderRestoreCallingIdentity(id);
        }
        }
        DevicePolicyEventLogger
                .createEvent(DevicePolicyEnums.ENABLE_SYSTEM_APP_WITH_INTENT)
                .setAdmin(caller.getPackageName())