Loading core/java/android/app/KeyguardManager.java +3 −1 Original line number Diff line number Diff line Loading @@ -746,7 +746,7 @@ public class KeyguardManager { if (!hasPermission(Manifest.permission.SET_INITIAL_LOCK)) { throw new SecurityException("Requires SET_INITIAL_LOCK permission."); } return mContext.getPackageManager().hasSystemFeature(PackageManager.FEATURE_AUTOMOTIVE); return true; } private boolean hasPermission(String permission) { Loading Loading @@ -814,6 +814,8 @@ public class KeyguardManager { /** * Set the lockscreen password after validating against its expected complexity level. * * Below {@link android.os.Build.VERSION_CODES#S_V2}, this API will only work * when {@link PackageManager.FEATURE_AUTOMOTIVE} is present. * @param lockType - type of lock as specified in {@link LockTypes} * @param password - password to validate; this has the same encoding * as the output of String#getBytes Loading services/core/java/com/android/server/locksettings/LockSettingsService.java +8 −3 Original line number Diff line number Diff line Loading @@ -20,6 +20,7 @@ import static android.Manifest.permission.ACCESS_KEYGUARD_SECURE_STORAGE; import static android.Manifest.permission.MANAGE_BIOMETRIC; import static android.Manifest.permission.READ_CONTACTS; import static android.Manifest.permission.SET_AND_VERIFY_LOCKSCREEN_CREDENTIALS; import static android.Manifest.permission.SET_INITIAL_LOCK; import static android.app.admin.DevicePolicyResources.Strings.Core.PROFILE_ENCRYPTED_DETAIL; import static android.app.admin.DevicePolicyResources.Strings.Core.PROFILE_ENCRYPTED_MESSAGE; import static android.app.admin.DevicePolicyResources.Strings.Core.PROFILE_ENCRYPTED_TITLE; Loading Loading @@ -1650,10 +1651,14 @@ public class LockSettingsService extends ILockSettings.Stub { "This operation requires secure lock screen feature"); } if (!hasPermission(PERMISSION) && !hasPermission(SET_AND_VERIFY_LOCKSCREEN_CREDENTIALS)) { if (hasPermission(SET_INITIAL_LOCK) && savedCredential.isNone()) { // SET_INITIAL_LOCK can only be used if credential is not set. } else { throw new SecurityException( "setLockCredential requires SET_AND_VERIFY_LOCKSCREEN_CREDENTIALS or " + PERMISSION); } } final long identity = Binder.clearCallingIdentity(); try { Loading Loading
core/java/android/app/KeyguardManager.java +3 −1 Original line number Diff line number Diff line Loading @@ -746,7 +746,7 @@ public class KeyguardManager { if (!hasPermission(Manifest.permission.SET_INITIAL_LOCK)) { throw new SecurityException("Requires SET_INITIAL_LOCK permission."); } return mContext.getPackageManager().hasSystemFeature(PackageManager.FEATURE_AUTOMOTIVE); return true; } private boolean hasPermission(String permission) { Loading Loading @@ -814,6 +814,8 @@ public class KeyguardManager { /** * Set the lockscreen password after validating against its expected complexity level. * * Below {@link android.os.Build.VERSION_CODES#S_V2}, this API will only work * when {@link PackageManager.FEATURE_AUTOMOTIVE} is present. * @param lockType - type of lock as specified in {@link LockTypes} * @param password - password to validate; this has the same encoding * as the output of String#getBytes Loading
services/core/java/com/android/server/locksettings/LockSettingsService.java +8 −3 Original line number Diff line number Diff line Loading @@ -20,6 +20,7 @@ import static android.Manifest.permission.ACCESS_KEYGUARD_SECURE_STORAGE; import static android.Manifest.permission.MANAGE_BIOMETRIC; import static android.Manifest.permission.READ_CONTACTS; import static android.Manifest.permission.SET_AND_VERIFY_LOCKSCREEN_CREDENTIALS; import static android.Manifest.permission.SET_INITIAL_LOCK; import static android.app.admin.DevicePolicyResources.Strings.Core.PROFILE_ENCRYPTED_DETAIL; import static android.app.admin.DevicePolicyResources.Strings.Core.PROFILE_ENCRYPTED_MESSAGE; import static android.app.admin.DevicePolicyResources.Strings.Core.PROFILE_ENCRYPTED_TITLE; Loading Loading @@ -1650,10 +1651,14 @@ public class LockSettingsService extends ILockSettings.Stub { "This operation requires secure lock screen feature"); } if (!hasPermission(PERMISSION) && !hasPermission(SET_AND_VERIFY_LOCKSCREEN_CREDENTIALS)) { if (hasPermission(SET_INITIAL_LOCK) && savedCredential.isNone()) { // SET_INITIAL_LOCK can only be used if credential is not set. } else { throw new SecurityException( "setLockCredential requires SET_AND_VERIFY_LOCKSCREEN_CREDENTIALS or " + PERMISSION); } } final long identity = Binder.clearCallingIdentity(); try { Loading