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

Commit 73314f69 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Automerger Merge Worker
Browse files

Merge "Also update color when changing the visibility" into rvc-dev am: 70a7cbf9

Change-Id: I34bf3ded151c7c321655e661cc41b0664f9a654c
parents 4aa5d355 70a7cbf9
Loading
Loading
Loading
Loading
+14 −18
Original line number Original line Diff line number Diff line
@@ -93,7 +93,7 @@ public class KeyguardIndicationController implements StateListener,
    private String mRestingIndication;
    private String mRestingIndication;
    private String mAlignmentIndication;
    private String mAlignmentIndication;
    private CharSequence mTransientIndication;
    private CharSequence mTransientIndication;
    private ColorStateList mTransientTextColorState;
    private boolean mTransientTextIsError;
    private ColorStateList mInitialTextColorState;
    private ColorStateList mInitialTextColorState;
    private boolean mVisible;
    private boolean mVisible;
    private boolean mHideTransientMessageOnScreenOff;
    private boolean mHideTransientMessageOnScreenOff;
@@ -260,7 +260,7 @@ public class KeyguardIndicationController implements StateListener,
     * Shows {@param transientIndication} until it is hidden by {@link #hideTransientIndication}.
     * Shows {@param transientIndication} until it is hidden by {@link #hideTransientIndication}.
     */
     */
    public void showTransientIndication(CharSequence transientIndication) {
    public void showTransientIndication(CharSequence transientIndication) {
        showTransientIndication(transientIndication, mInitialTextColorState,
        showTransientIndication(transientIndication, false /* isError */,
                false /* hideOnScreenOff */);
                false /* hideOnScreenOff */);
    }
    }


@@ -268,10 +268,10 @@ public class KeyguardIndicationController implements StateListener,
     * Shows {@param transientIndication} until it is hidden by {@link #hideTransientIndication}.
     * Shows {@param transientIndication} until it is hidden by {@link #hideTransientIndication}.
     */
     */
    private void showTransientIndication(CharSequence transientIndication,
    private void showTransientIndication(CharSequence transientIndication,
            ColorStateList textColorState, boolean hideOnScreenOff) {
            boolean isError, boolean hideOnScreenOff) {
        mTransientIndication = transientIndication;
        mTransientIndication = transientIndication;
        mHideTransientMessageOnScreenOff = hideOnScreenOff && transientIndication != null;
        mHideTransientMessageOnScreenOff = hideOnScreenOff && transientIndication != null;
        mTransientTextColorState = textColorState;
        mTransientTextIsError = isError;
        mHandler.removeMessages(MSG_HIDE_TRANSIENT);
        mHandler.removeMessages(MSG_HIDE_TRANSIENT);
        mHandler.removeMessages(MSG_SWIPE_UP_TO_UNLOCK);
        mHandler.removeMessages(MSG_SWIPE_UP_TO_UNLOCK);
        if (mDozing && !TextUtils.isEmpty(mTransientIndication)) {
        if (mDozing && !TextUtils.isEmpty(mTransientIndication)) {
@@ -311,7 +311,6 @@ public class KeyguardIndicationController implements StateListener,
                    mTextView.switchIndication(mTransientIndication);
                    mTextView.switchIndication(mTransientIndication);
                } else if (!TextUtils.isEmpty(mAlignmentIndication)) {
                } else if (!TextUtils.isEmpty(mAlignmentIndication)) {
                    mTextView.switchIndication(mAlignmentIndication);
                    mTextView.switchIndication(mAlignmentIndication);
                    mTextView.setTextColor(Utils.getColorError(mContext));
                } else if (mPowerPluggedIn) {
                } else if (mPowerPluggedIn) {
                    String indication = computePowerIndication();
                    String indication = computePowerIndication();
                    if (animate) {
                    if (animate) {
@@ -336,9 +335,9 @@ public class KeyguardIndicationController implements StateListener,
                powerIndication = computePowerIndication();
                powerIndication = computePowerIndication();
            }
            }


            boolean isError = false;
            if (!mKeyguardUpdateMonitor.isUserUnlocked(userId)) {
            if (!mKeyguardUpdateMonitor.isUserUnlocked(userId)) {
                mTextView.switchIndication(com.android.internal.R.string.lockscreen_storage_locked);
                mTextView.switchIndication(com.android.internal.R.string.lockscreen_storage_locked);
                mTextView.setTextColor(mInitialTextColorState);
            } else if (!TextUtils.isEmpty(mTransientIndication)) {
            } else if (!TextUtils.isEmpty(mTransientIndication)) {
                if (powerIndication != null && !mTransientIndication.equals(powerIndication)) {
                if (powerIndication != null && !mTransientIndication.equals(powerIndication)) {
                    String indication = mContext.getResources().getString(
                    String indication = mContext.getResources().getString(
@@ -348,7 +347,7 @@ public class KeyguardIndicationController implements StateListener,
                } else {
                } else {
                    mTextView.switchIndication(mTransientIndication);
                    mTextView.switchIndication(mTransientIndication);
                }
                }
                mTextView.setTextColor(mTransientTextColorState);
                isError = mTransientTextIsError;
            } else if (!TextUtils.isEmpty(trustGrantedIndication)
            } else if (!TextUtils.isEmpty(trustGrantedIndication)
                    && mKeyguardUpdateMonitor.getUserHasTrust(userId)) {
                    && mKeyguardUpdateMonitor.getUserHasTrust(userId)) {
                if (powerIndication != null) {
                if (powerIndication != null) {
@@ -359,15 +358,13 @@ public class KeyguardIndicationController implements StateListener,
                } else {
                } else {
                    mTextView.switchIndication(trustGrantedIndication);
                    mTextView.switchIndication(trustGrantedIndication);
                }
                }
                mTextView.setTextColor(mInitialTextColorState);
            } else if (!TextUtils.isEmpty(mAlignmentIndication)) {
            } else if (!TextUtils.isEmpty(mAlignmentIndication)) {
                mTextView.switchIndication(mAlignmentIndication);
                mTextView.switchIndication(mAlignmentIndication);
                mTextView.setTextColor(Utils.getColorError(mContext));
                isError = true;
            } else if (mPowerPluggedIn) {
            } else if (mPowerPluggedIn) {
                if (DEBUG_CHARGING_SPEED) {
                if (DEBUG_CHARGING_SPEED) {
                    powerIndication += ",  " + (mChargingWattage / 1000) + " mW";
                    powerIndication += ",  " + (mChargingWattage / 1000) + " mW";
                }
                }
                mTextView.setTextColor(mInitialTextColorState);
                if (animate) {
                if (animate) {
                    animateText(mTextView, powerIndication);
                    animateText(mTextView, powerIndication);
                } else {
                } else {
@@ -377,11 +374,11 @@ public class KeyguardIndicationController implements StateListener,
                    && mKeyguardUpdateMonitor.getUserTrustIsManaged(userId)
                    && mKeyguardUpdateMonitor.getUserTrustIsManaged(userId)
                    && !mKeyguardUpdateMonitor.getUserHasTrust(userId)) {
                    && !mKeyguardUpdateMonitor.getUserHasTrust(userId)) {
                mTextView.switchIndication(trustManagedIndication);
                mTextView.switchIndication(trustManagedIndication);
                mTextView.setTextColor(mInitialTextColorState);
            } else {
            } else {
                mTextView.switchIndication(mRestingIndication);
                mTextView.switchIndication(mRestingIndication);
                mTextView.setTextColor(mInitialTextColorState);
            }
            }
            mTextView.setTextColor(isError ? Utils.getColorError(mContext)
                    : mInitialTextColorState);
        }
        }
    }
    }


@@ -532,7 +529,7 @@ public class KeyguardIndicationController implements StateListener,
            mStatusBarKeyguardViewManager.showBouncerMessage(message, mInitialTextColorState);
            mStatusBarKeyguardViewManager.showBouncerMessage(message, mInitialTextColorState);
        } else if (mKeyguardUpdateMonitor.isScreenOn()) {
        } else if (mKeyguardUpdateMonitor.isScreenOn()) {
            showTransientIndication(mContext.getString(R.string.keyguard_unlock),
            showTransientIndication(mContext.getString(R.string.keyguard_unlock),
                    mInitialTextColorState, true /* hideOnScreenOff */);
                    false /* isError */, true /* hideOnScreenOff */);
            hideTransientIndicationDelayed(BaseKeyguardCallback.HIDE_DELAY_MS);
            hideTransientIndicationDelayed(BaseKeyguardCallback.HIDE_DELAY_MS);
        }
        }
    }
    }
@@ -551,7 +548,7 @@ public class KeyguardIndicationController implements StateListener,


    public void dump(FileDescriptor fd, PrintWriter pw, String[] args) {
    public void dump(FileDescriptor fd, PrintWriter pw, String[] args) {
        pw.println("KeyguardIndicationController:");
        pw.println("KeyguardIndicationController:");
        pw.println("  mTransientTextColorState: " + mTransientTextColorState);
        pw.println("  mTransientTextIsError: " + mTransientTextIsError);
        pw.println("  mInitialTextColorState: " + mInitialTextColorState);
        pw.println("  mInitialTextColorState: " + mInitialTextColorState);
        pw.println("  mPowerPluggedInWired: " + mPowerPluggedInWired);
        pw.println("  mPowerPluggedInWired: " + mPowerPluggedInWired);
        pw.println("  mPowerPluggedIn: " + mPowerPluggedIn);
        pw.println("  mPowerPluggedIn: " + mPowerPluggedIn);
@@ -630,7 +627,7 @@ public class KeyguardIndicationController implements StateListener,
                mStatusBarKeyguardViewManager.showBouncerMessage(helpString,
                mStatusBarKeyguardViewManager.showBouncerMessage(helpString,
                        mInitialTextColorState);
                        mInitialTextColorState);
            } else if (mKeyguardUpdateMonitor.isScreenOn()) {
            } else if (mKeyguardUpdateMonitor.isScreenOn()) {
                showTransientIndication(helpString, mInitialTextColorState, showSwipeToUnlock);
                showTransientIndication(helpString, false /* isError */, showSwipeToUnlock);
                if (!showSwipeToUnlock) {
                if (!showSwipeToUnlock) {
                    hideTransientIndicationDelayed(TRANSIENT_BIOMETRIC_ERROR_TIMEOUT);
                    hideTransientIndicationDelayed(TRANSIENT_BIOMETRIC_ERROR_TIMEOUT);
                }
                }
@@ -704,14 +701,13 @@ public class KeyguardIndicationController implements StateListener,


        @Override
        @Override
        public void onTrustAgentErrorMessage(CharSequence message) {
        public void onTrustAgentErrorMessage(CharSequence message) {
            showTransientIndication(message, Utils.getColorError(mContext),
            showTransientIndication(message, true /* isError */, false /* hideOnScreenOff */);
                    false /* hideOnScreenOff */);
        }
        }


        @Override
        @Override
        public void onScreenTurnedOn() {
        public void onScreenTurnedOn() {
            if (mMessageToShowOnScreenOn != null) {
            if (mMessageToShowOnScreenOn != null) {
                showTransientIndication(mMessageToShowOnScreenOn, Utils.getColorError(mContext),
                showTransientIndication(mMessageToShowOnScreenOn, true /* isError */,
                        false /* hideOnScreenOff */);
                        false /* hideOnScreenOff */);
                // We want to keep this message around in case the screen was off
                // We want to keep this message around in case the screen was off
                hideTransientIndicationDelayed(HIDE_DELAY_MS);
                hideTransientIndicationDelayed(HIDE_DELAY_MS);
+2 −4
Original line number Original line Diff line number Diff line
@@ -192,8 +192,7 @@ public class KeyguardIndicationControllerTest extends SysuiTestCase {


        assertThat(mTextView.getText()).isEqualTo(
        assertThat(mTextView.getText()).isEqualTo(
                mContext.getResources().getString(R.string.dock_alignment_slow_charging));
                mContext.getResources().getString(R.string.dock_alignment_slow_charging));
        assertThat(mTextView.getCurrentTextColor()).isEqualTo(
        assertThat(mTextView.getCurrentTextColor()).isEqualTo(Color.WHITE);
                Utils.getColorError(mContext).getDefaultColor());
    }
    }


    @Test
    @Test
@@ -210,8 +209,7 @@ public class KeyguardIndicationControllerTest extends SysuiTestCase {


        assertThat(mTextView.getText()).isEqualTo(
        assertThat(mTextView.getText()).isEqualTo(
                mContext.getResources().getString(R.string.dock_alignment_not_charging));
                mContext.getResources().getString(R.string.dock_alignment_not_charging));
        assertThat(mTextView.getCurrentTextColor()).isEqualTo(
        assertThat(mTextView.getCurrentTextColor()).isEqualTo(Color.WHITE);
                Utils.getColorError(mContext).getDefaultColor());
    }
    }


    @Test
    @Test