diff --git a/core/api/system-current.txt b/core/api/system-current.txt index eb12844aecca9..5f2dcb39007c1 100644 --- a/core/api/system-current.txt +++ b/core/api/system-current.txt @@ -9822,7 +9822,7 @@ package android.os { method @RequiresPermission(anyOf={android.Manifest.permission.MANAGE_USERS, android.Manifest.permission.INTERACT_ACROSS_USERS}, conditional=true) public boolean hasUserRestrictionForUser(@NonNull String, @NonNull android.os.UserHandle); method @RequiresPermission(anyOf={android.Manifest.permission.MANAGE_USERS, android.Manifest.permission.CREATE_USERS, android.Manifest.permission.QUERY_USERS}) public boolean isAdminUser(); method public boolean isCloneProfile(); - method public boolean isCredentialSharedWithParent(); + method public boolean isCredentialSharableWithParent(); method @RequiresPermission(anyOf={android.Manifest.permission.MANAGE_USERS, android.Manifest.permission.CREATE_USERS, android.Manifest.permission.QUERY_USERS}) public boolean isGuestUser(); method @RequiresPermission(anyOf={android.Manifest.permission.MANAGE_USERS, android.Manifest.permission.QUERY_USERS, android.Manifest.permission.INTERACT_ACROSS_USERS}, conditional=true) public boolean isManagedProfile(int); method @RequiresPermission(anyOf={android.Manifest.permission.MANAGE_USERS, android.Manifest.permission.INTERACT_ACROSS_USERS}, conditional=true) public boolean isMediaSharedWithParent(); diff --git a/core/java/android/os/IUserManager.aidl b/core/java/android/os/IUserManager.aidl index 39ca596f9181e..3cde0319efd36 100644 --- a/core/java/android/os/IUserManager.aidl +++ b/core/java/android/os/IUserManager.aidl @@ -109,7 +109,7 @@ interface IUserManager { boolean someUserHasAccount(in String accountName, in String accountType); String getProfileType(int userId); boolean isMediaSharedWithParent(int userId); - boolean isCredentialSharedWithParent(int userId); + boolean isCredentialSharableWithParent(int userId); boolean isDemoUser(int userId); boolean isPreCreated(int userId); UserInfo createProfileForUserEvenWhenDisallowedWithThrow(in String name, in String userType, int flags, diff --git a/core/java/android/os/UserManager.java b/core/java/android/os/UserManager.java index a715c6961359a..276578ea3c1f9 100644 --- a/core/java/android/os/UserManager.java +++ b/core/java/android/os/UserManager.java @@ -4763,7 +4763,7 @@ public class UserManager { } /** - * Returns {@code true} if the user shares lock settings credential with its parent user + * Returns whether the user can have shared lockscreen credential with its parent user. * * This API only works for {@link UserManager#isProfile() profiles} * and will always return false for any other user type. @@ -4776,9 +4776,9 @@ public class UserManager { Manifest.permission.MANAGE_USERS, Manifest.permission.INTERACT_ACROSS_USERS}) @SuppressAutoDoc - public boolean isCredentialSharedWithParent() { + public boolean isCredentialSharableWithParent() { try { - return mService.isCredentialSharedWithParent(mUserId); + return mService.isCredentialSharableWithParent(mUserId); } catch (RemoteException re) { throw re.rethrowFromSystemServer(); } diff --git a/core/java/com/android/internal/widget/LockPatternUtils.java b/core/java/com/android/internal/widget/LockPatternUtils.java index 82ae424410320..f83579207e316 100644 --- a/core/java/com/android/internal/widget/LockPatternUtils.java +++ b/core/java/com/android/internal/widget/LockPatternUtils.java @@ -808,7 +808,7 @@ public class LockPatternUtils { */ public void setSeparateProfileChallengeEnabled(int userHandle, boolean enabled, LockscreenCredential profilePassword) { - if (!isCredentialSharedWithParent(userHandle)) { + if (!isCredentialSharableWithParent(userHandle)) { return; } try { @@ -824,7 +824,7 @@ public class LockPatternUtils { * Returns true if {@code userHandle} is a managed profile with separate challenge. */ public boolean isSeparateProfileChallengeEnabled(int userHandle) { - return isCredentialSharedWithParent(userHandle) && hasSeparateChallenge(userHandle); + return isCredentialSharableWithParent(userHandle) && hasSeparateChallenge(userHandle); } /** @@ -849,8 +849,8 @@ public class LockPatternUtils { return info != null && info.isManagedProfile(); } - private boolean isCredentialSharedWithParent(int userHandle) { - return getUserManager(userHandle).isCredentialSharedWithParent(); + private boolean isCredentialSharableWithParent(int userHandle) { + return getUserManager(userHandle).isCredentialSharableWithParent(); } /** diff --git a/services/core/java/com/android/server/am/UserController.java b/services/core/java/com/android/server/am/UserController.java index ad176556ba653..879534778800c 100644 --- a/services/core/java/com/android/server/am/UserController.java +++ b/services/core/java/com/android/server/am/UserController.java @@ -2618,7 +2618,7 @@ class UserController implements Handler.Callback { if (getStartedUserState(userId) == null) { return false; } - if (!mInjector.getUserManager().isCredentialSharedWithParent(userId)) { + if (!mInjector.getUserManager().isCredentialSharableWithParent(userId)) { return false; } if (mLockPatternUtils.isSeparateProfileChallengeEnabled(userId)) { diff --git a/services/core/java/com/android/server/locksettings/LockSettingsService.java b/services/core/java/com/android/server/locksettings/LockSettingsService.java index 3db11d84cbeb1..52834cb5917d5 100644 --- a/services/core/java/com/android/server/locksettings/LockSettingsService.java +++ b/services/core/java/com/android/server/locksettings/LockSettingsService.java @@ -373,7 +373,7 @@ public class LockSettingsService extends ILockSettings.Stub { LockscreenCredential profileUserPassword) { if (DEBUG) Slog.v(TAG, "Check child profile lock for user: " + profileUserId); // Only for profiles that shares credential with parent - if (!isCredentialSharedWithParent(profileUserId)) { + if (!isCredentialSharableWithParent(profileUserId)) { return; } // Do not tie profile when work challenge is enabled @@ -789,7 +789,7 @@ public class LockSettingsService extends ILockSettings.Stub { private void ensureProfileKeystoreUnlocked(int userId) { final KeyStore ks = KeyStore.getInstance(); if (ks.state(userId) == KeyStore.State.LOCKED - && isCredentialSharedWithParent(userId) + && isCredentialSharableWithParent(userId) && hasUnifiedChallenge(userId)) { Slog.i(TAG, "Profile got unlocked, will unlock its keystore"); // If boot took too long and the password in vold got expired, parent keystore will @@ -810,7 +810,7 @@ public class LockSettingsService extends ILockSettings.Stub { // Hide notification first, as tie managed profile lock takes time hideEncryptionNotification(new UserHandle(userId)); - if (isCredentialSharedWithParent(userId)) { + if (isCredentialSharableWithParent(userId)) { tieProfileLockIfNecessary(userId, LockscreenCredential.createNone()); } @@ -1077,7 +1077,7 @@ public class LockSettingsService extends ILockSettings.Stub { final int userCount = users.size(); for (int i = 0; i < userCount; i++) { UserInfo user = users.get(i); - if (isCredentialSharedWithParent(user.id) + if (isCredentialSharableWithParent(user.id) && !getSeparateProfileChallengeEnabledInternal(user.id)) { success &= SyntheticPasswordCrypto.migrateLockSettingsKey( PROFILE_KEY_NAME_ENCRYPT + user.id); @@ -1471,7 +1471,7 @@ public class LockSettingsService extends ILockSettings.Stub { Thread.currentThread().interrupt(); } - if (isCredentialSharedWithParent(userId)) { + if (isCredentialSharableWithParent(userId)) { if (!hasUnifiedChallenge(userId)) { mBiometricDeferredQueue.processPendingLockoutResets(); } @@ -1480,7 +1480,7 @@ public class LockSettingsService extends ILockSettings.Stub { for (UserInfo profile : mUserManager.getProfiles(userId)) { if (profile.id == userId) continue; - if (!isCredentialSharedWithParent(profile.id)) continue; + if (!isCredentialSharableWithParent(profile.id)) continue; if (hasUnifiedChallenge(profile.id)) { if (mUserManager.isUserRunning(profile.id)) { @@ -1517,7 +1517,7 @@ public class LockSettingsService extends ILockSettings.Stub { } private Map getDecryptedPasswordsForAllTiedProfiles(int userId) { - if (isCredentialSharedWithParent(userId)) { + if (isCredentialSharableWithParent(userId)) { return null; } Map result = new ArrayMap<>(); @@ -1525,7 +1525,7 @@ public class LockSettingsService extends ILockSettings.Stub { final int size = profiles.size(); for (int i = 0; i < size; i++) { final UserInfo profile = profiles.get(i); - if (!isCredentialSharedWithParent(profile.id)) { + if (!isCredentialSharableWithParent(profile.id)) { continue; } final int profileUserId = profile.id; @@ -1560,7 +1560,7 @@ public class LockSettingsService extends ILockSettings.Stub { */ private void synchronizeUnifiedWorkChallengeForProfiles(int userId, Map profilePasswordMap) { - if (isCredentialSharedWithParent(userId)) { + if (isCredentialSharableWithParent(userId)) { return; } final boolean isSecure = isUserSecure(userId); @@ -1569,7 +1569,7 @@ public class LockSettingsService extends ILockSettings.Stub { for (int i = 0; i < size; i++) { final UserInfo profile = profiles.get(i); final int profileUserId = profile.id; - if (isCredentialSharedWithParent(profileUserId)) { + if (isCredentialSharableWithParent(profileUserId)) { if (getSeparateProfileChallengeEnabledInternal(profileUserId)) { continue; } @@ -1596,12 +1596,12 @@ public class LockSettingsService extends ILockSettings.Stub { } private boolean isProfileWithUnifiedLock(int userId) { - return isCredentialSharedWithParent(userId) + return isCredentialSharableWithParent(userId) && !getSeparateProfileChallengeEnabledInternal(userId); } private boolean isProfileWithSeparatedLock(int userId) { - return isCredentialSharedWithParent(userId) + return isCredentialSharableWithParent(userId) && getSeparateProfileChallengeEnabledInternal(userId); } @@ -1719,7 +1719,7 @@ public class LockSettingsService extends ILockSettings.Stub { setSeparateProfileChallengeEnabledLocked(userId, true, /* unused */ null); notifyPasswordChanged(credential, userId); } - if (isCredentialSharedWithParent(userId)) { + if (isCredentialSharableWithParent(userId)) { // Make sure the profile doesn't get locked straight after setting work challenge. setDeviceUnlockedForUser(userId); } @@ -1734,7 +1734,7 @@ public class LockSettingsService extends ILockSettings.Stub { /** * @param savedCredential if the user is a profile with - * {@link UserManager#isCredentialSharedWithParent()} with unified challenge and + * {@link UserManager#isCredentialSharableWithParent()} with unified challenge and * savedCredential is empty, LSS will try to re-derive the profile password internally. * TODO (b/80170828): Fix this so profile password is always passed in. * @param isLockTiedToParent is {@code true} if {@code userId} is a profile and its new @@ -1910,8 +1910,8 @@ public class LockSettingsService extends ILockSettings.Stub { } } - protected boolean isCredentialSharedWithParent(int userId) { - return getUserManagerFromCache(userId).isCredentialSharedWithParent(); + protected boolean isCredentialSharableWithParent(int userId) { + return getUserManagerFromCache(userId).isCredentialSharableWithParent(); } private VerifyCredentialResponse convertResponse(GateKeeperResponse gateKeeperResponse) { @@ -2161,7 +2161,7 @@ public class LockSettingsService extends ILockSettings.Stub { final List profiles = mUserManager.getProfiles(userId); for (UserInfo pi : profiles) { // Unlock profile which shares credential with parent with unified lock - if (isCredentialSharedWithParent(pi.id) + if (isCredentialSharableWithParent(pi.id) && !getSeparateProfileChallengeEnabledInternal(pi.id) && mStorage.hasChildProfileLock(pi.id)) { try { @@ -2555,7 +2555,7 @@ public class LockSettingsService extends ILockSettings.Stub { mManagedProfilePasswordCache.removePassword(userId); gateKeeperClearSecureUserId(userId); - if (unknownUser || isCredentialSharedWithParent(userId)) { + if (unknownUser || isCredentialSharableWithParent(userId)) { removeKeystoreProfileKey(userId); } // Clean up storage last, this is to ensure that cleanupDataForReusedUserIdIfNecessary() @@ -3275,7 +3275,7 @@ public class LockSettingsService extends ILockSettings.Stub { * Returns a fixed pseudorandom byte string derived from the user's synthetic password. * This is used to salt the password history hash to protect the hash against offline * bruteforcing, since rederiving this value requires a successful authentication. - * If user is a profile with {@link UserManager#isCredentialSharedWithParent()} true and with + * If user is a profile with {@link UserManager#isCredentialSharableWithParent()} true and with * unified challenge, currentCredential is ignored. */ @Override diff --git a/services/core/java/com/android/server/pm/UserManagerService.java b/services/core/java/com/android/server/pm/UserManagerService.java index a8d24fad25983..33476ed2678ea 100644 --- a/services/core/java/com/android/server/pm/UserManagerService.java +++ b/services/core/java/com/android/server/pm/UserManagerService.java @@ -1593,13 +1593,13 @@ public class UserManagerService extends IUserManager.Stub { } @Override - public boolean isCredentialSharedWithParent(@UserIdInt int userId) { + public boolean isCredentialSharableWithParent(@UserIdInt int userId) { checkManageOrInteractPermissionIfCallerInOtherProfileGroup(userId, - "isCredentialSharedWithParent"); + "isCredentialSharableWithParent"); synchronized (mUsersLock) { UserTypeDetails userTypeDetails = getUserTypeDetailsNoChecks(userId); return userTypeDetails != null && userTypeDetails.isProfile() - && userTypeDetails.isCredentialSharedWithParent(); + && userTypeDetails.isCredentialSharableWithParent(); } } diff --git a/services/core/java/com/android/server/pm/UserTypeDetails.java b/services/core/java/com/android/server/pm/UserTypeDetails.java index 2f5e2388f6a8e..4aad1a7f38812 100644 --- a/services/core/java/com/android/server/pm/UserTypeDetails.java +++ b/services/core/java/com/android/server/pm/UserTypeDetails.java @@ -161,7 +161,7 @@ public final class UserTypeDetails { * *

Default value is false */ - private final boolean mIsCredentialSharedWithParent; + private final boolean mIsCredentialSharableWithParent; private UserTypeDetails(@NonNull String name, boolean enabled, int maxAllowed, @UserInfoFlag int baseType, @UserInfoFlag int defaultUserInfoPropertyFlags, int label, @@ -174,7 +174,7 @@ public final class UserTypeDetails { @Nullable Bundle defaultSecureSettings, @Nullable List defaultCrossProfileIntentFilters, boolean isMediaSharedWithParent, - boolean isCredentialSharedWithParent) { + boolean isCredentialSharableWithParent) { this.mName = name; this.mEnabled = enabled; this.mMaxAllowed = maxAllowed; @@ -194,7 +194,7 @@ public final class UserTypeDetails { this.mBadgeColors = badgeColors; this.mDarkThemeBadgeColors = darkThemeBadgeColors; this.mIsMediaSharedWithParent = isMediaSharedWithParent; - this.mIsCredentialSharedWithParent = isCredentialSharedWithParent; + this.mIsCredentialSharableWithParent = isCredentialSharableWithParent; } /** @@ -323,8 +323,8 @@ public final class UserTypeDetails { * Returns true if the user has shared encryption credential with parent user or * false otherwise. */ - public boolean isCredentialSharedWithParent() { - return mIsCredentialSharedWithParent; + public boolean isCredentialSharableWithParent() { + return mIsCredentialSharableWithParent; } /** Returns a {@link Bundle} representing the default user restrictions. */ @@ -419,7 +419,7 @@ public final class UserTypeDetails { private @DrawableRes int mBadgePlain = Resources.ID_NULL; private @DrawableRes int mBadgeNoBackground = Resources.ID_NULL; private boolean mIsMediaSharedWithParent = false; - private boolean mIsCredentialSharedWithParent = false; + private boolean mIsCredentialSharableWithParent = false; public Builder setName(String name) { mName = name; @@ -521,10 +521,10 @@ public final class UserTypeDetails { /** * Sets shared media property for the user. - * @param isCredentialSharedWithParent the value to be set, true or false + * @param isCredentialSharableWithParent the value to be set, true or false */ - public Builder setIsCredentialSharedWithParent(boolean isCredentialSharedWithParent) { - mIsCredentialSharedWithParent = isCredentialSharedWithParent; + public Builder setIsCredentialSharableWithParent(boolean isCredentialSharableWithParent) { + mIsCredentialSharableWithParent = isCredentialSharableWithParent; return this; } @@ -571,7 +571,7 @@ public final class UserTypeDetails { mDefaultSecureSettings, mDefaultCrossProfileIntentFilters, mIsMediaSharedWithParent, - mIsCredentialSharedWithParent); + mIsCredentialSharableWithParent); } private boolean hasBadge() { diff --git a/services/core/java/com/android/server/pm/UserTypeFactory.java b/services/core/java/com/android/server/pm/UserTypeFactory.java index 1e3b67c394cbe..cb18c6d83788c 100644 --- a/services/core/java/com/android/server/pm/UserTypeFactory.java +++ b/services/core/java/com/android/server/pm/UserTypeFactory.java @@ -122,7 +122,7 @@ public final class UserTypeFactory { .setLabel(0) .setDefaultRestrictions(null) .setIsMediaSharedWithParent(true) - .setIsCredentialSharedWithParent(true); + .setIsCredentialSharableWithParent(true); } /** @@ -154,7 +154,7 @@ public final class UserTypeFactory { .setDefaultRestrictions(getDefaultManagedProfileRestrictions()) .setDefaultSecureSettings(getDefaultManagedProfileSecureSettings()) .setDefaultCrossProfileIntentFilters(getDefaultManagedCrossProfileIntentFilter()) - .setIsCredentialSharedWithParent(true); + .setIsCredentialSharableWithParent(true); } /** diff --git a/services/tests/servicestests/src/com/android/server/locksettings/LockSettingsServiceTestable.java b/services/tests/servicestests/src/com/android/server/locksettings/LockSettingsServiceTestable.java index 21c09a09e10f8..1d10b8aa3f5a6 100644 --- a/services/tests/servicestests/src/com/android/server/locksettings/LockSettingsServiceTestable.java +++ b/services/tests/servicestests/src/com/android/server/locksettings/LockSettingsServiceTestable.java @@ -217,7 +217,7 @@ public class LockSettingsServiceTestable extends LockSettingsService { } @Override - protected boolean isCredentialSharedWithParent(int userId) { + protected boolean isCredentialSharableWithParent(int userId) { UserInfo userInfo = mUserManager.getUserInfo(userId); return userInfo.isCloneProfile() || userInfo.isManagedProfile(); }