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

Commit 28f8d061 authored by android-build-team Robot's avatar android-build-team Robot
Browse files

release-request-108343c4-ad88-44f9-aaa2-24d8b8a5c176-for-git_oc-mr1-release-43...

release-request-108343c4-ad88-44f9-aaa2-24d8b8a5c176-for-git_oc-mr1-release-4321077 snap-temp-L97000000100182150

Change-Id: Iefb5ea01c8fbc63f743254f9591a1688d155e821
parents 509d7761 b6a1c5f0
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -2531,7 +2531,7 @@ public class DevicePolicyManager {
     * @return Returns true if the password meets the current requirements, else false.
     * @throws SecurityException if the calling application does not own an active administrator
     *             that uses {@link DeviceAdminInfo#USES_POLICY_LIMIT_PASSWORD}
     * @throws InvalidStateException if the user is not unlocked.
     * @throws IllegalStateException if the user is not unlocked.
     */
    public boolean isActivePasswordSufficient() {
        if (mService != null) {
+17 −3
Original line number Diff line number Diff line
@@ -18,13 +18,11 @@ package android.app.admin;

import android.annotation.IntDef;
import android.annotation.NonNull;
import android.app.admin.DevicePolicyManager;
import android.os.Parcelable;
import android.os.Parcel;
import android.os.Parcelable;

import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.io.IOException;

/**
 * A class that represents the metrics of a password that are used to decide whether or not a
@@ -159,6 +157,22 @@ public class PasswordMetrics implements Parcelable {
                quality, length, letters, upperCase, lowerCase, numeric, symbols, nonLetter);
    }

    @Override
    public boolean equals(Object other) {
        if (!(other instanceof PasswordMetrics)) {
            return false;
        }
        PasswordMetrics o = (PasswordMetrics) other;
        return this.quality == o.quality
                && this.length == o.length
                && this.letters == o.letters
                && this.upperCase == o.upperCase
                && this.lowerCase == o.lowerCase
                && this.numeric == o.numeric
                && this.symbols == o.symbols
                && this.nonLetter == o.nonLetter;
    }

    /*
     * Returns the maximum length of a sequential characters. A sequence is defined as
     * monotonically increasing characters with a constant interval or the same character repeated.
+10 −0
Original line number Diff line number Diff line
@@ -10199,6 +10199,15 @@ public final class Settings {
        public static final String EUICC_FACTORY_RESET_TIMEOUT_MILLIS =
                "euicc_factory_reset_timeout_millis";

        /**
         * Flag to set the timeout for when to refresh the storage settings cached data.
         * Type: long
         *
         * @hide
         */
        public static final String STORAGE_SETTINGS_CLOBBER_THRESHOLD =
                "storage_settings_clobber_threshold";

        /**
         * Settings to backup. This is here so that it's in the same place as the settings
         * keys and easy to update.
@@ -10763,6 +10772,7 @@ public final class Settings {
            INSTANT_APP_SETTINGS.add(ANIMATOR_DURATION_SCALE);
            INSTANT_APP_SETTINGS.add(DEBUG_VIEW_ATTRIBUTES);
            INSTANT_APP_SETTINGS.add(WTF_IS_FATAL);
            INSTANT_APP_SETTINGS.add(SEND_ACTION_APP_ERROR);
        }

        /**
+1 −3
Original line number Diff line number Diff line
@@ -1470,10 +1470,8 @@ public class ChooserActivity extends ResolverActivity {
            }

            final int oldHeight = holder.row.getLayoutParams().height;
            int measuredRowHeight = holder.measuredRowHeight + holder.row.getPaddingTop()
                    + holder.row.getPaddingBottom();
            holder.row.getLayoutParams().height = Math.max(1,
                    (int) (measuredRowHeight * getRowScale(rowPosition)));
                    (int) (holder.measuredRowHeight * getRowScale(rowPosition)));
            if (holder.row.getLayoutParams().height != oldHeight) {
                holder.row.requestLayout();
            }
+39 −10
Original line number Diff line number Diff line
@@ -803,12 +803,14 @@ public class LockPatternUtils {
                        + "of length " + MIN_LOCK_PASSWORD_SIZE);
            }

            final int computedQuality = PasswordMetrics.computeForPassword(password).quality;
            setLong(PASSWORD_TYPE_KEY, Math.max(requestedQuality, computedQuality), userHandle);
            setLong(PASSWORD_TYPE_KEY,
                    computePasswordQuality(CREDENTIAL_TYPE_PASSWORD, password, requestedQuality),
                    userHandle);
            getLockSettings().setLockCredential(password, CREDENTIAL_TYPE_PASSWORD, savedPassword,
                    requestedQuality, userHandle);

            updateEncryptionPasswordIfNeeded(password, computedQuality, userHandle);
            updateEncryptionPasswordIfNeeded(password,
                    PasswordMetrics.computeForPassword(password).quality, userHandle);
            updatePasswordHistory(password, userHandle);
        } catch (RemoteException re) {
            // Cant do much
@@ -897,6 +899,24 @@ public class LockPatternUtils {
                DevicePolicyManager.PASSWORD_QUALITY_UNSPECIFIED, userHandle);
    }

    /**
     * Returns the password quality of the given credential, promoting it to a higher level
     * if DevicePolicyManager has a stronger quality requirement. This value will be written
     * to PASSWORD_TYPE_KEY.
     */
    private int computePasswordQuality(int type, String credential, int requestedQuality) {
        final int quality;
        if (type == CREDENTIAL_TYPE_PASSWORD) {
            int computedQuality = PasswordMetrics.computeForPassword(credential).quality;
            quality = Math.max(requestedQuality, computedQuality);
        } else if (type == CREDENTIAL_TYPE_PATTERN)  {
            quality = DevicePolicyManager.PASSWORD_QUALITY_SOMETHING;
        } else /* if (type == CREDENTIAL_TYPE_NONE) */ {
            quality = DevicePolicyManager.PASSWORD_QUALITY_UNSPECIFIED;
        }
        return quality;
    }

    /**
     * Enables/disables the Separate Profile Challenge for this {@param userHandle}. This is a no-op
     * for user handles that do not belong to a managed profile.
@@ -1505,25 +1525,34 @@ public class LockPatternUtils {
        }
    }

    public boolean setLockCredentialWithToken(String credential, int type, long tokenHandle,
            byte[] token, int userId) {
    /**
     * Change a user's lock credential with a pre-configured escrow token.
     *
     * @param credential The new credential to be set
     * @param type Credential type: password / pattern / none.
     * @param requestedQuality the requested password quality by DevicePolicyManager.
     *        See {@link DevicePolicyManager#getPasswordQuality(android.content.ComponentName)}
     * @param tokenHandle Handle of the escrow token
     * @param token Escrow token
     * @param userId The user who's lock credential to be changed
     * @return {@code true} if the operation is successful.
     */
    public boolean setLockCredentialWithToken(String credential, int type, int requestedQuality,
            long tokenHandle, byte[] token, int userId) {
        try {
            if (type != CREDENTIAL_TYPE_NONE) {
                if (TextUtils.isEmpty(credential) || credential.length() < MIN_LOCK_PASSWORD_SIZE) {
                    throw new IllegalArgumentException("password must not be null and at least "
                            + "of length " + MIN_LOCK_PASSWORD_SIZE);
                }

                final int computedQuality = PasswordMetrics.computeForPassword(credential).quality;
                int quality = Math.max(DevicePolicyManager.PASSWORD_QUALITY_NUMERIC,
                        computedQuality);
                final int quality = computePasswordQuality(type, credential, requestedQuality);
                if (!getLockSettings().setLockCredentialWithToken(credential, type, tokenHandle,
                        token, quality, userId)) {
                    return false;
                }
                setLong(PASSWORD_TYPE_KEY, quality, userId);

                updateEncryptionPasswordIfNeeded(credential, computedQuality, userId);
                updateEncryptionPasswordIfNeeded(credential, quality, userId);
                updatePasswordHistory(credential, userId);
            } else {
                if (!TextUtils.isEmpty(credential)) {
Loading