Loading api/current.txt +1 −0 Original line number Diff line number Diff line Loading @@ -5713,6 +5713,7 @@ package android.app.admin { method public boolean setDeviceInitializer(android.content.ComponentName, android.content.ComponentName, java.lang.String) throws java.lang.IllegalArgumentException, java.lang.IllegalStateException; method public void setGlobalSetting(android.content.ComponentName, java.lang.String, java.lang.String); method public void setKeyguardDisabledFeatures(android.content.ComponentName, int); method public boolean setKeyguardEnabledState(android.content.ComponentName, boolean); method public void setLockTaskPackages(android.content.ComponentName, java.lang.String[]) throws java.lang.SecurityException; method public void setMasterVolumeMuted(android.content.ComponentName, boolean); method public void setMaximumFailedPasswordsForWipe(android.content.ComponentName, int); api/system-current.txt +1 −0 Original line number Diff line number Diff line Loading @@ -5817,6 +5817,7 @@ package android.app.admin { method public boolean setDeviceInitializer(android.content.ComponentName, android.content.ComponentName, java.lang.String) throws java.lang.IllegalArgumentException, java.lang.IllegalStateException; method public void setGlobalSetting(android.content.ComponentName, java.lang.String, java.lang.String); method public void setKeyguardDisabledFeatures(android.content.ComponentName, int); method public boolean setKeyguardEnabledState(android.content.ComponentName, boolean); method public void setLockTaskPackages(android.content.ComponentName, java.lang.String[]) throws java.lang.SecurityException; method public void setMasterVolumeMuted(android.content.ComponentName, boolean); method public void setMaximumFailedPasswordsForWipe(android.content.ComponentName, int); core/java/android/app/admin/DevicePolicyManager.java +23 −0 Original line number Diff line number Diff line Loading @@ -4187,4 +4187,27 @@ public class DevicePolicyManager { } return null; } /** * Called by a device owner to disable the keyguard altogether. * * <p>Setting the keyguard to disabled has the same effect as choosing "None" as the screen * lock type. However, this call has no effect if a password, pin or pattern is currently set. * If a password, pin or pattern is set after the keyguard was disabled, the keyguard stops * being disabled. * * @param admin Which {@link DeviceAdminReceiver} this request is associated with. * @param enabled New state of the keyguard. * * @return {@code false} if attempting to disable the keyguard while a lock password was in * place. {@code true} otherwise." */ public boolean setKeyguardEnabledState(ComponentName admin, boolean enabled) { try { return mService.setKeyguardEnabledState(admin, enabled); } catch (RemoteException re) { Log.w(TAG, "Failed talking with device policy service", re); return false; } } } core/java/android/app/admin/IDevicePolicyManager.aidl +2 −0 Original line number Diff line number Diff line Loading @@ -221,4 +221,6 @@ interface IDevicePolicyManager { void sendDeviceInitializerStatus(int statusCode, String description); void setOtaPolicy(in ComponentName who, in PersistableBundle policy); PersistableBundle getOtaPolicy(); boolean setKeyguardEnabledState(in ComponentName admin, boolean enabled); } services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java +22 −0 Original line number Diff line number Diff line Loading @@ -5808,6 +5808,28 @@ public class DevicePolicyManagerService extends IDevicePolicyManager.Stub { } } @Override public boolean setKeyguardEnabledState(ComponentName who, boolean enabled) { Preconditions.checkNotNull(who, "ComponentName is null"); synchronized (this) { getActiveAdminForCallerLocked(who, DeviceAdminInfo.USES_POLICY_DEVICE_OWNER); } final int userId = UserHandle.getCallingUserId(); LockPatternUtils utils = new LockPatternUtils(mContext); // disallow disabling the keyguard if a password is currently set if (!enabled && utils.isSecure(userId)) { return false; } long ident = Binder.clearCallingIdentity(); try { utils.setLockScreenDisabled(!enabled, userId); } finally { Binder.restoreCallingIdentity(ident); } return true; } /** * We need to update the internal state of whether a user has completed setup once. After * that, we ignore any changes that reset the Settings.Secure.USER_SETUP_COMPLETE changes Loading Loading
api/current.txt +1 −0 Original line number Diff line number Diff line Loading @@ -5713,6 +5713,7 @@ package android.app.admin { method public boolean setDeviceInitializer(android.content.ComponentName, android.content.ComponentName, java.lang.String) throws java.lang.IllegalArgumentException, java.lang.IllegalStateException; method public void setGlobalSetting(android.content.ComponentName, java.lang.String, java.lang.String); method public void setKeyguardDisabledFeatures(android.content.ComponentName, int); method public boolean setKeyguardEnabledState(android.content.ComponentName, boolean); method public void setLockTaskPackages(android.content.ComponentName, java.lang.String[]) throws java.lang.SecurityException; method public void setMasterVolumeMuted(android.content.ComponentName, boolean); method public void setMaximumFailedPasswordsForWipe(android.content.ComponentName, int);
api/system-current.txt +1 −0 Original line number Diff line number Diff line Loading @@ -5817,6 +5817,7 @@ package android.app.admin { method public boolean setDeviceInitializer(android.content.ComponentName, android.content.ComponentName, java.lang.String) throws java.lang.IllegalArgumentException, java.lang.IllegalStateException; method public void setGlobalSetting(android.content.ComponentName, java.lang.String, java.lang.String); method public void setKeyguardDisabledFeatures(android.content.ComponentName, int); method public boolean setKeyguardEnabledState(android.content.ComponentName, boolean); method public void setLockTaskPackages(android.content.ComponentName, java.lang.String[]) throws java.lang.SecurityException; method public void setMasterVolumeMuted(android.content.ComponentName, boolean); method public void setMaximumFailedPasswordsForWipe(android.content.ComponentName, int);
core/java/android/app/admin/DevicePolicyManager.java +23 −0 Original line number Diff line number Diff line Loading @@ -4187,4 +4187,27 @@ public class DevicePolicyManager { } return null; } /** * Called by a device owner to disable the keyguard altogether. * * <p>Setting the keyguard to disabled has the same effect as choosing "None" as the screen * lock type. However, this call has no effect if a password, pin or pattern is currently set. * If a password, pin or pattern is set after the keyguard was disabled, the keyguard stops * being disabled. * * @param admin Which {@link DeviceAdminReceiver} this request is associated with. * @param enabled New state of the keyguard. * * @return {@code false} if attempting to disable the keyguard while a lock password was in * place. {@code true} otherwise." */ public boolean setKeyguardEnabledState(ComponentName admin, boolean enabled) { try { return mService.setKeyguardEnabledState(admin, enabled); } catch (RemoteException re) { Log.w(TAG, "Failed talking with device policy service", re); return false; } } }
core/java/android/app/admin/IDevicePolicyManager.aidl +2 −0 Original line number Diff line number Diff line Loading @@ -221,4 +221,6 @@ interface IDevicePolicyManager { void sendDeviceInitializerStatus(int statusCode, String description); void setOtaPolicy(in ComponentName who, in PersistableBundle policy); PersistableBundle getOtaPolicy(); boolean setKeyguardEnabledState(in ComponentName admin, boolean enabled); }
services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java +22 −0 Original line number Diff line number Diff line Loading @@ -5808,6 +5808,28 @@ public class DevicePolicyManagerService extends IDevicePolicyManager.Stub { } } @Override public boolean setKeyguardEnabledState(ComponentName who, boolean enabled) { Preconditions.checkNotNull(who, "ComponentName is null"); synchronized (this) { getActiveAdminForCallerLocked(who, DeviceAdminInfo.USES_POLICY_DEVICE_OWNER); } final int userId = UserHandle.getCallingUserId(); LockPatternUtils utils = new LockPatternUtils(mContext); // disallow disabling the keyguard if a password is currently set if (!enabled && utils.isSecure(userId)) { return false; } long ident = Binder.clearCallingIdentity(); try { utils.setLockScreenDisabled(!enabled, userId); } finally { Binder.restoreCallingIdentity(ident); } return true; } /** * We need to update the internal state of whether a user has completed setup once. After * that, we ignore any changes that reset the Settings.Secure.USER_SETUP_COMPLETE changes Loading