From f7a6c02cc886c87e49f0aa0a1338bd48742042e0 Mon Sep 17 00:00:00 2001 From: Rubin Xu Date: Fri, 7 May 2021 11:22:35 +0100 Subject: [PATCH] Remove unused isProfileActivePasswordSufficientForParent() Bug: 182561862 Test: builds Change-Id: I26d18113862c64c51333f62b81db65e335ccd18c --- .../app/admin/DevicePolicyManager.java | 21 ---------------- .../app/admin/IDevicePolicyManager.aidl | 1 - .../internal/widget/LockPatternUtils.java | 10 -------- .../DevicePolicyManagerService.java | 24 ------------------- 4 files changed, 56 deletions(-) diff --git a/core/java/android/app/admin/DevicePolicyManager.java b/core/java/android/app/admin/DevicePolicyManager.java index 609c014feb5bd..02e64b811e8ec 100644 --- a/core/java/android/app/admin/DevicePolicyManager.java +++ b/core/java/android/app/admin/DevicePolicyManager.java @@ -4572,27 +4572,6 @@ public class DevicePolicyManager { return true; } - /** - * Determine whether the current profile password the user has set is sufficient - * to meet the policy requirements (e.g. quality, minimum length) that have been - * requested by the admins of the parent user and its profiles. - * - * @param userHandle the userId of the profile to check the password for. - * @return Returns true if the password would meet the current requirements, else false. - * @throws SecurityException if {@code userHandle} is not a managed profile. - * @hide - */ - public boolean isProfileActivePasswordSufficientForParent(int userHandle) { - if (mService != null) { - try { - return mService.isProfileActivePasswordSufficientForParent(userHandle); - } catch (RemoteException e) { - throw e.rethrowFromSystemServer(); - } - } - return false; - } - /** * Returns whether the given user's credential will be sufficient for all password policy * requirement, once the user's profile has switched to unified challenge. diff --git a/core/java/android/app/admin/IDevicePolicyManager.aidl b/core/java/android/app/admin/IDevicePolicyManager.aidl index 370db60fb8251..9f76bd197a253 100644 --- a/core/java/android/app/admin/IDevicePolicyManager.aidl +++ b/core/java/android/app/admin/IDevicePolicyManager.aidl @@ -88,7 +88,6 @@ interface IDevicePolicyManager { boolean isActivePasswordSufficient(int userHandle, boolean parent); boolean isActivePasswordSufficientForDeviceRequirement(); - boolean isProfileActivePasswordSufficientForParent(int userHandle); boolean isPasswordSufficientAfterProfileUnification(int userHandle, int profileUser); int getPasswordComplexity(boolean parent); void setRequiredPasswordComplexity(int passwordComplexity, boolean parent); diff --git a/core/java/com/android/internal/widget/LockPatternUtils.java b/core/java/com/android/internal/widget/LockPatternUtils.java index db4e6734c848b..498505cd46fff 100644 --- a/core/java/com/android/internal/widget/LockPatternUtils.java +++ b/core/java/com/android/internal/widget/LockPatternUtils.java @@ -854,16 +854,6 @@ public class LockPatternUtils { && getDevicePolicyManager().isSeparateProfileChallengeAllowed(userHandle); } - /** - * Retrieves whether the current profile and device locks can be unified. - * @param userHandle profile user handle. - */ - public boolean isSeparateProfileChallengeAllowedToUnify(int userHandle) { - return getDevicePolicyManager().isProfileActivePasswordSufficientForParent(userHandle) - && !getUserManager().hasUserRestriction( - UserManager.DISALLOW_UNIFIED_PASSWORD, UserHandle.of(userHandle)); - } - private boolean hasSeparateChallenge(int userHandle) { try { return getLockSettings().getSeparateProfileChallengeEnabled(userHandle); diff --git a/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java b/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java index 9de50585bf67e..ef7360d357069 100644 --- a/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java +++ b/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java @@ -4546,30 +4546,6 @@ public class DevicePolicyManagerService extends BaseIDevicePolicyManager { return !isSeparateProfileChallengeEnabled(caller.getUserId()); } - @Override - public boolean isProfileActivePasswordSufficientForParent(int userHandle) { - if (!mHasFeature) { - return true; - } - Preconditions.checkArgumentNonnegative(userHandle, "Invalid userId"); - - final CallerIdentity caller = getCallerIdentity(); - Preconditions.checkCallAuthorization(hasFullCrossUsersPermission(caller, userHandle)); - Preconditions.checkCallAuthorization(isManagedProfile(userHandle), - "can not call APIs refering to the parent profile outside a managed profile, " - + "userId = %d", userHandle); - - synchronized (getLockObject()) { - final int targetUser = getProfileParentId(userHandle); - enforceUserUnlocked(targetUser, false); - int credentialOwner = getCredentialOwner(userHandle, false); - DevicePolicyData policy = getUserDataUnchecked(credentialOwner); - PasswordMetrics metrics = mLockSettingsInternal.getUserPasswordMetrics(credentialOwner); - return isActivePasswordSufficientForUserLocked( - policy.mPasswordValidAtLastCheckpoint, metrics, targetUser); - } - } - @Override public boolean isPasswordSufficientAfterProfileUnification(int userHandle, int profileUser) { if (!mHasFeature) {