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

Commit f8e00bbe authored by Jason Chang's avatar Jason Chang Committed by Automerger Merge Worker
Browse files

Merge "Add explaination strings to bouncer if biometrics timeout" into...

Merge "Add explaination strings to bouncer if biometrics timeout" into tm-qpr-dev am: cf49d6f4 am: 4486290a

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/20129790



Change-Id: I45231b97736e85e458e5f278c5be9972f9b08eac
Signed-off-by: default avatarAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
parents 5dbcde4f 4486290a
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -201,13 +201,13 @@
    <string name="kg_prompt_reason_restart_password">Password required after device restarts</string>

    <!-- An explanation text that the pattern needs to be solved since the user hasn't used strong authentication since quite some time. [CHAR LIMIT=80] -->
    <string name="kg_prompt_reason_timeout_pattern">Pattern required for additional security</string>
    <string name="kg_prompt_reason_timeout_pattern">For additional security, use pattern instead</string>

    <!-- An explanation text that the pin needs to be entered since the user hasn't used strong authentication since quite some time. [CHAR LIMIT=80] -->
    <string name="kg_prompt_reason_timeout_pin">PIN required for additional security</string>
    <string name="kg_prompt_reason_timeout_pin">For additional security, use PIN instead</string>

    <!-- An explanation text that the password needs to be entered since the user hasn't used strong authentication since quite some time. [CHAR LIMIT=80] -->
    <string name="kg_prompt_reason_timeout_password">Password required for additional security</string>
    <string name="kg_prompt_reason_timeout_password">For additional security, use password instead</string>

    <!-- An explanation text that the credential needs to be entered because a device admin has
    locked the device. [CHAR LIMIT=80] -->
+24 −2
Original line number Diff line number Diff line
@@ -1413,6 +1413,16 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener, Dumpab
        }
    }

    private void notifyNonStrongBiometricStateChanged(int userId) {
        Assert.isMainThread();
        for (int i = 0; i < mCallbacks.size(); i++) {
            KeyguardUpdateMonitorCallback cb = mCallbacks.get(i).get();
            if (cb != null) {
                cb.onNonStrongBiometricAllowedChanged(userId);
            }
        }
    }

    private void dispatchErrorMessage(CharSequence message) {
        Assert.isMainThread();
        for (int i = 0; i < mCallbacks.size(); i++) {
@@ -1763,11 +1773,14 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener, Dumpab

    public static class StrongAuthTracker extends LockPatternUtils.StrongAuthTracker {
        private final Consumer<Integer> mStrongAuthRequiredChangedCallback;
        private final Consumer<Integer> mNonStrongBiometricAllowedChanged;

        public StrongAuthTracker(Context context,
                Consumer<Integer> strongAuthRequiredChangedCallback) {
                Consumer<Integer> strongAuthRequiredChangedCallback,
                Consumer<Integer> nonStrongBiometricAllowedChanged) {
            super(context);
            mStrongAuthRequiredChangedCallback = strongAuthRequiredChangedCallback;
            mNonStrongBiometricAllowedChanged = nonStrongBiometricAllowedChanged;
        }

        public boolean isUnlockingWithBiometricAllowed(boolean isStrongBiometric) {
@@ -1785,6 +1798,14 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener, Dumpab
        public void onStrongAuthRequiredChanged(int userId) {
            mStrongAuthRequiredChangedCallback.accept(userId);
        }

        // TODO(b/247091681): Renaming the inappropriate onIsNonStrongBiometricAllowedChanged
        //  callback wording for Weak/Convenience idle timeout constraint that only allow
        //  Strong-Auth
        @Override
        public void onIsNonStrongBiometricAllowedChanged(int userId) {
            mNonStrongBiometricAllowedChanged.accept(userId);
        }
    }

    protected void handleStartedWakingUp() {
@@ -1933,7 +1954,8 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener, Dumpab
        mSubscriptionManager = subscriptionManager;
        mTelephonyListenerManager = telephonyListenerManager;
        mDeviceProvisioned = isDeviceProvisionedInSettingsDb();
        mStrongAuthTracker = new StrongAuthTracker(context, this::notifyStrongAuthStateChanged);
        mStrongAuthTracker = new StrongAuthTracker(context, this::notifyStrongAuthStateChanged,
                this::notifyNonStrongBiometricStateChanged);
        mBackgroundExecutor = backgroundExecutor;
        mBroadcastDispatcher = broadcastDispatcher;
        mInteractionJankMonitor = interactionJankMonitor;
+5 −0
Original line number Diff line number Diff line
@@ -291,4 +291,9 @@ public class KeyguardUpdateMonitorCallback {
     * Called when the notification shade is expanded or collapsed.
     */
    public void onShadeExpandedChanged(boolean expanded) { }

    /**
     * Called when the non-strong biometric state changed.
     */
    public void onNonStrongBiometricAllowedChanged(int userId) { }
}
+4 −0
Original line number Diff line number Diff line
@@ -794,6 +794,8 @@ public class KeyguardViewMediator implements CoreStartable, Dumpable,
            KeyguardUpdateMonitor.StrongAuthTracker strongAuthTracker =
                    mUpdateMonitor.getStrongAuthTracker();
            int strongAuth = strongAuthTracker.getStrongAuthForUser(currentUser);
            boolean allowedNonStrongAfterIdleTimeout =
                    strongAuthTracker.isNonStrongBiometricAllowedAfterIdleTimeout(currentUser);

            if (any && !strongAuthTracker.hasUserAuthenticatedSinceBoot()) {
                return KeyguardSecurityView.PROMPT_REASON_RESTART;
@@ -812,6 +814,8 @@ public class KeyguardViewMediator implements CoreStartable, Dumpable,
            } else if (any && (strongAuth
                    & STRONG_AUTH_REQUIRED_AFTER_NON_STRONG_BIOMETRICS_TIMEOUT) != 0) {
                return KeyguardSecurityView.PROMPT_REASON_NON_STRONG_BIOMETRIC_TIMEOUT;
            } else if (any && !allowedNonStrongAfterIdleTimeout) {
                return KeyguardSecurityView.PROMPT_REASON_NON_STRONG_BIOMETRIC_TIMEOUT;
            }
            return KeyguardSecurityView.PROMPT_REASON_NONE;
        }
+5 −0
Original line number Diff line number Diff line
@@ -91,6 +91,11 @@ public class KeyguardBouncer {
                        mBouncerPromptReason = mCallback.getBouncerPromptReason();
                    }
                }

                @Override
                public void onNonStrongBiometricAllowedChanged(int userId) {
                    mBouncerPromptReason = mCallback.getBouncerPromptReason();
                }
            };
    private final Runnable mRemoveViewRunnable = this::removeView;
    private final KeyguardBypassController mKeyguardBypassController;
Loading