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

Commit 5b7b95fb authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Automerger Merge Worker
Browse files

Merge "KeyguardIndication text updates" into sc-dev am: 0ec737da

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

Change-Id: Iac5e780c9384467e4b4e3c97606397ff024111a3
parents 6ea95fa4 0ec737da
Loading
Loading
Loading
Loading
+6 −1
Original line number Diff line number Diff line
@@ -775,6 +775,9 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener, Dumpab
        if (msgId == FingerprintManager.FINGERPRINT_ERROR_LOCKOUT
                || msgId == FingerprintManager.FINGERPRINT_ERROR_LOCKOUT_PERMANENT) {
            mFingerprintLockedOut = true;
            if (isUdfpsEnrolled()) {
                updateFingerprintListeningState();
            }
        }

        for (int i = 0; i < mCallbacks.size(); i++) {
@@ -2115,7 +2118,8 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener, Dumpab
                || (!getUserCanSkipBouncer(getCurrentUser())
                    && !isEncryptedOrLockdown(getCurrentUser())
                    && !userNeedsStrongAuth()
                    && userDoesNotHaveTrust);
                    && userDoesNotHaveTrust
                    && !mFingerprintLockedOut);
        return shouldListenKeyguardState && shouldListenUserState && shouldListenBouncerState
                && shouldListenUdfpsState;
    }
@@ -3259,6 +3263,7 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener, Dumpab
            pw.println("    strongAuthFlags=" + Integer.toHexString(strongAuthFlags));
            pw.println("    trustManaged=" + getUserTrustIsManaged(userId));
            pw.println("    udfpsEnrolled=" + isUdfpsEnrolled());
            pw.println("    mFingerprintLockedOut=" + mFingerprintLockedOut);
            pw.println("    enabledByUser=" + mBiometricEnabledForUser.get(userId));
            if (isUdfpsEnrolled()) {
                pw.println("        shouldListenForUdfps=" + shouldListenForFingerprint(true));
+2 −6
Original line number Diff line number Diff line
@@ -20,7 +20,6 @@ import android.annotation.Nullable;
import android.content.res.ColorStateList;
import android.graphics.Color;
import android.text.TextUtils;
import android.view.View;

import androidx.annotation.IntDef;

@@ -202,10 +201,7 @@ public class KeyguardIndicationRotateTextViewController extends

        mCurrIndicationType = type;
        mIndicationQueue.removeIf(x -> x == type);
        if (mCurrIndicationType == INDICATION_TYPE_NONE) {
            mView.setVisibility(View.GONE);
        } else {
            mView.setVisibility(View.VISIBLE);
        if (mCurrIndicationType != INDICATION_TYPE_NONE) {
            mIndicationQueue.add(type); // re-add to show later
        }

@@ -299,7 +295,7 @@ public class KeyguardIndicationRotateTextViewController extends
        }
    }

    private static final int INDICATION_TYPE_NONE = -1;
    static final int INDICATION_TYPE_NONE = -1;
    public static final int INDICATION_TYPE_OWNER_INFO = 0;
    public static final int INDICATION_TYPE_DISCLOSURE = 1;
    public static final int INDICATION_TYPE_LOGOUT = 2;
+14 −6
Original line number Diff line number Diff line
@@ -112,6 +112,7 @@ public class KeyguardIndicationController implements KeyguardStateController.Cal
    private final KeyguardUpdateMonitor mKeyguardUpdateMonitor;
    private ViewGroup mIndicationArea;
    private KeyguardIndicationTextView mTopIndicationView;
    private KeyguardIndicationTextView mLockScreenIndicationView;
    private final IBatteryStats mBatteryInfo;
    private final SettableWakeLock mWakeLock;
    private final DockManager mDockManager;
@@ -208,15 +209,19 @@ public class KeyguardIndicationController implements KeyguardStateController.Cal
        mKeyguardUpdateMonitor.registerCallback(mTickReceiver);
        mStatusBarStateController.addCallback(mStatusBarStateListener);
        mKeyguardStateController.addCallback(this);

        mStatusBarStateListener.onDozingChanged(mStatusBarStateController.isDozing());
    }

    public void setIndicationArea(ViewGroup indicationArea) {
        mIndicationArea = indicationArea;
        mTopIndicationView = indicationArea.findViewById(R.id.keyguard_indication_text);
        mLockScreenIndicationView = indicationArea.findViewById(
            R.id.keyguard_indication_text_bottom);
        mInitialTextColorState = mTopIndicationView != null
                ? mTopIndicationView.getTextColors() : ColorStateList.valueOf(Color.WHITE);
        mRotateTextViewController = new KeyguardIndicationRotateTextViewController(
                indicationArea.findViewById(R.id.keyguard_indication_text_bottom),
            mLockScreenIndicationView,
            mExecutor,
            mStatusBarStateController);
        updateIndication(false /* animate */);
@@ -630,6 +635,7 @@ public class KeyguardIndicationController implements KeyguardStateController.Cal
        // should be shown based on user or device state
        // AoD
        if (mDozing) {
            mLockScreenIndicationView.setVisibility(View.GONE);
            mTopIndicationView.setVisibility(VISIBLE);
            // When dozing we ignore any text color and use white instead, because
            // colors can be hard to read in low brightness.
@@ -659,6 +665,8 @@ public class KeyguardIndicationController implements KeyguardStateController.Cal

        // LOCK SCREEN
        mTopIndicationView.setVisibility(GONE);
        mTopIndicationView.setText(null);
        mLockScreenIndicationView.setVisibility(View.VISIBLE);
        updateIndications(animate, KeyguardUpdateMonitor.getCurrentUser());
    }

@@ -914,7 +922,8 @@ public class KeyguardIndicationController implements KeyguardStateController.Cal
            } else if (mStatusBarKeyguardViewManager.isBouncerShowing()) {
                mStatusBarKeyguardViewManager.showBouncerMessage(errString, mInitialTextColorState);
            } else if (mKeyguardUpdateMonitor.isScreenOn()) {
                showTransientIndication(errString);
                showTransientIndication(errString, /* isError */ true,
                    /* hideOnScreenOff */ true);
                // We want to keep this message around in case the screen was off
                hideTransientIndicationDelayed(HIDE_DELAY_MS);
            } else {
@@ -1032,9 +1041,8 @@ public class KeyguardIndicationController implements KeyguardStateController.Cal

            if (mHideTransientMessageOnScreenOff && mDozing) {
                hideTransientIndication();
            } else {
                updateIndication(false);
            }
            updateIndication(false);
        }
    };
}
+1 −1
Original line number Diff line number Diff line
@@ -38,7 +38,7 @@ import java.util.LinkedList;
 * A view to show hints on Keyguard ("Swipe up to unlock", "Tap again to open").
 */
public class KeyguardIndicationTextView extends TextView {
    private static final long MSG_DURATION_MILLIS = 600;
    private static final long MSG_DURATION_MILLIS = 1500;
    private long mNextAnimationTime = 0;
    private boolean mAnimationsEnabled = true;
    private LinkedList<CharSequence> mMessages = new LinkedList<>();
+2 −3
Original line number Diff line number Diff line
@@ -34,7 +34,6 @@ import android.content.res.ColorStateList;
import android.graphics.Color;
import android.testing.AndroidTestingRunner;
import android.testing.TestableLooper.RunWithLooper;
import android.view.View;

import androidx.test.filters.SmallTest;

@@ -258,8 +257,8 @@ public class KeyguardIndicationRotateTextViewControllerTest extends SysuiTestCas
        // WHEN the device is dozing
        mStatusBarStateListener.onDozingChanged(true);

        // THEN the view is GONE
        verify(mView).setVisibility(View.GONE);
        // THEN switch to INDICATION_TYPE_NONE
        verify(mView).switchIndication(null);
    }

    @Test