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

Commit 73c93f02 authored by Adrian Roos's avatar Adrian Roos Committed by Android (Google) Code Review
Browse files

Merge "FRP: Add config flag for disabling credential FRP" into oc-mr1-dev

parents baf1201b 2adc263c
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -174,7 +174,7 @@ public class KeyguardManager {
     */
    public Intent createConfirmFactoryResetCredentialIntent(
            CharSequence title, CharSequence description, CharSequence alternateButtonLabel) {
        if (!LockPatternUtils.frpCredentialEnabled()) {
        if (!LockPatternUtils.frpCredentialEnabled(mContext)) {
            Log.w(TAG, "Factory reset credentials not supported.");
            return null;
        }
+10 −9
Original line number Diff line number Diff line
@@ -303,7 +303,7 @@ public class LockPatternUtils {
    }

    public void reportFailedPasswordAttempt(int userId) {
        if (userId == USER_FRP && frpCredentialEnabled()) {
        if (userId == USER_FRP && frpCredentialEnabled(mContext)) {
            return;
        }
        getDevicePolicyManager().reportFailedPasswordAttempt(userId);
@@ -311,7 +311,7 @@ public class LockPatternUtils {
    }

    public void reportSuccessfulPasswordAttempt(int userId) {
        if (userId == USER_FRP && frpCredentialEnabled()) {
        if (userId == USER_FRP && frpCredentialEnabled(mContext)) {
            return;
        }
        getDevicePolicyManager().reportSuccessfulPasswordAttempt(userId);
@@ -319,21 +319,21 @@ public class LockPatternUtils {
    }

    public void reportPasswordLockout(int timeoutMs, int userId) {
        if (userId == USER_FRP && frpCredentialEnabled()) {
        if (userId == USER_FRP && frpCredentialEnabled(mContext)) {
            return;
        }
        getTrustManager().reportUnlockLockout(timeoutMs, userId);
    }

    public int getCurrentFailedPasswordAttempts(int userId) {
        if (userId == USER_FRP && frpCredentialEnabled()) {
        if (userId == USER_FRP && frpCredentialEnabled(mContext)) {
            return 0;
        }
        return getDevicePolicyManager().getCurrentFailedPasswordAttempts(userId);
    }

    public int getMaximumFailedPasswordsForWipe(int userId) {
        if (userId == USER_FRP && frpCredentialEnabled()) {
        if (userId == USER_FRP && frpCredentialEnabled(mContext)) {
            return 0;
        }
        return getDevicePolicyManager().getMaximumFailedPasswordsForWipe(
@@ -1768,11 +1768,12 @@ public class LockPatternUtils {
        return getLong(SYNTHETIC_PASSWORD_ENABLED_KEY, 0, UserHandle.USER_SYSTEM) != 0;
    }

    public static boolean userOwnsFrpCredential(UserInfo info) {
        return info != null && info.isPrimary() && info.isAdmin() && frpCredentialEnabled();
    public static boolean userOwnsFrpCredential(Context context, UserInfo info) {
        return info != null && info.isPrimary() && info.isAdmin() && frpCredentialEnabled(context);
    }

    public static boolean frpCredentialEnabled() {
        return FRP_CREDENTIAL_ENABLED;
    public static boolean frpCredentialEnabled(Context context) {
        return FRP_CREDENTIAL_ENABLED && context.getResources().getBoolean(
                com.android.internal.R.bool.config_enableCredentialFactoryResetProtection);
    }
}
+5 −0
Original line number Diff line number Diff line
@@ -1116,6 +1116,11 @@
    <!-- Is the lock-screen disabled for new users by default -->
    <bool name="config_disableLockscreenByDefault">false</bool>

    <!-- If true, enables verification of the lockscreen credential in the factory reset protection
        flow. This should be true if gatekeeper / weaver credentials can still be checked after a
        factory reset. -->
    <bool name="config_enableCredentialFactoryResetProtection">true</bool>

    <!-- Control the behavior when the user long presses the home button.
            0 - Nothing
            1 - Launch all apps intent
+2 −0
Original line number Diff line number Diff line
@@ -3019,6 +3019,8 @@
  <java-symbol type="string" name="foreground_service_tap_for_details" />
  <java-symbol type="string" name="foreground_service_multiple_separator" />

  <java-symbol type="bool" name="config_enableCredentialFactoryResetProtection" />

  <!-- ETWS primary messages -->
  <java-symbol type="string" name="etws_primary_default_message_earthquake" />
  <java-symbol type="string" name="etws_primary_default_message_tsunami" />
+9 −3
Original line number Diff line number Diff line
@@ -22,6 +22,7 @@ import android.hardware.SensorEvent;
import android.hardware.SensorEventListener;
import android.hardware.SensorManager;
import android.os.Handler;
import android.os.Trace;

import com.android.internal.annotations.VisibleForTesting;

@@ -94,10 +95,15 @@ public class DozeScreenBrightness implements DozeMachine.Part, SensorEventListen

    @Override
    public void onSensorChanged(SensorEvent event) {
        Trace.beginSection("DozeScreenBrightness.onSensorChanged" + event.values[0]);
        try {
            if (mRegistered) {
                mLastSensorValue = (int) event.values[0];
                updateBrightnessAndReady();
            }
        } finally {
            Trace.endSection();
        }
    }

    private void updateBrightnessAndReady() {
Loading