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

Commit b5e820c7 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Fix SecurityException when calling DevicePolicyManager.setMaximumTimeToLock"

parents 1cfa6f42 0c696c94
Loading
Loading
Loading
Loading
+9 −5
Original line number Diff line number Diff line
@@ -5249,12 +5249,11 @@ public class DevicePolicyManagerService extends BaseIDevicePolicyManager {
                // would allow bypassing of the maximum time to lock.
                mInjector.settingsGlobalPutInt(Settings.Global.STAY_ON_WHILE_PLUGGED_IN, 0);
            }
            getPowerManagerInternal().setMaximumScreenOffTimeoutFromDeviceAdmin(
                    UserHandle.USER_SYSTEM, timeMs);
        } finally {
            mInjector.binderRestoreCallingIdentity(ident);
        }
        getPowerManagerInternal().setMaximumScreenOffTimeoutFromDeviceAdmin(
                UserHandle.USER_SYSTEM, timeMs);
    }
    private void updateProfileLockTimeoutLocked(@UserIdInt int userId) {
@@ -5272,8 +5271,13 @@ public class DevicePolicyManagerService extends BaseIDevicePolicyManager {
        }
        policy.mLastMaximumTimeToLock = timeMs;
        final long ident = mInjector.binderClearCallingIdentity();
        try {
            getPowerManagerInternal().setMaximumScreenOffTimeoutFromDeviceAdmin(
                    userId, policy.mLastMaximumTimeToLock);
        } finally {
            mInjector.binderRestoreCallingIdentity(ident);
        }
    }
    @Override