Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit f7a6c02c authored by Rubin Xu's avatar Rubin Xu
Browse files

Remove unused isProfileActivePasswordSufficientForParent()

Bug: 182561862
Test: builds
Change-Id: I26d18113862c64c51333f62b81db65e335ccd18c
parent 19b0627a
Loading
Loading
Loading
Loading
+0 −21
Original line number Diff line number Diff line
@@ -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.
+0 −1
Original line number Diff line number Diff line
@@ -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);
+0 −10
Original line number Diff line number Diff line
@@ -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);
+0 −24
Original line number Diff line number Diff line
@@ -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) {