/** * Called by an application that is administering the device to set the maximum time for user * activity until the device will lock. This limits the length that the user can set. It takes * effect immediately. * * <p>The calling device admin must have requested {@link DeviceAdminInfo#USES_POLICY_FORCE_LOCK} * to be able to call this method; if it has not, a security exception will be thrown. * * @param admin Which {@link DeviceAdminReceiver} this request is associated with. * @param timeMs The new desired maximum time to lock in milliseconds. A value of 0 means there is * no restriction. */ public void setMaximumTimeToLock(ComponentName admin, long timeMs) { if (mService != null) { try { mService.setMaximumTimeToLock(admin, timeMs); } catch (RemoteException e) { Log.w(TAG, "Failed talking with device policy service", e); } } }