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

Commit 473d4e11 authored by Felipe Leme's avatar Felipe Leme
Browse files

Integrated policy-exempt apps into isLockTaskPermitted().

Test: atest CtsDevicePolicyManagerTestCases:com.android.cts.devicepolicy.MixedDeviceOwnerTest#testIsLockTaskPermitted_includesPolicyExemptApps # on phone and automotive

Bug: 181238156
Change-Id: Ic2e9195beba55b3d8e69e437e564ff092c22db61
parent 2e139344
Loading
Loading
Loading
Loading
+11 −2
Original line number Diff line number Diff line
@@ -11698,9 +11698,18 @@ public class DevicePolicyManagerService extends BaseIDevicePolicyManager {
    @Override
    public boolean isLockTaskPermitted(String pkg) {
        final int userHandle = mInjector.userHandleGetCallingUserId();
        // Check policy-exempt apps first, as it doesn't require the lock
        if (listPolicyExemptAppsUnchecked().contains(pkg)) {
            if (VERBOSE_LOG) {
                Slogf.v(LOG_TAG, "isLockTaskPermitted(%s): returning true for policy-exempt app",
                            pkg);
            }
            return true;
        }
        final int userId = mInjector.userHandleGetCallingUserId();
        synchronized (getLockObject()) {
            return getUserData(userHandle).mLockTaskPackages.contains(pkg);
            return getUserData(userId).mLockTaskPackages.contains(pkg);
        }
    }