diff options
4 files changed, 13 insertions, 22 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardIndicationRotateTextViewController.java b/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardIndicationRotateTextViewController.java index df9977fddf5b..2d215e0f1f62 100644 --- a/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardIndicationRotateTextViewController.java +++ b/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardIndicationRotateTextViewController.java @@ -23,7 +23,6 @@ import android.text.TextUtils; import androidx.annotation.IntDef; -import com.android.settingslib.Utils; import com.android.systemui.Dumpable; import com.android.systemui.dagger.qualifiers.Main; import com.android.systemui.plugins.statusbar.StatusBarStateController; @@ -164,17 +163,14 @@ public class KeyguardIndicationRotateTextViewController extends * Transient messages: * - show immediately * - will continue to be in the rotation of messages shown until hideTransient is called. - * - can be presented with an "error" color if isError is true */ - public void showTransient(CharSequence newIndication, boolean isError) { + public void showTransient(CharSequence newIndication) { final long inAnimationDuration = 600L; // see KeyguardIndicationTextView.getYInDuration updateIndication(INDICATION_TYPE_TRANSIENT, new KeyguardIndication.Builder() .setMessage(newIndication) - .setTextColor(isError - ? Utils.getColorError(getContext()) - : mInitialTextColorState) .setMinVisibilityMillis(2000L + inAnimationDuration) + .setTextColor(mInitialTextColorState) .build(), /* showImmediately */true); } diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/KeyguardIndicationController.java b/packages/SystemUI/src/com/android/systemui/statusbar/KeyguardIndicationController.java index c09f98dd609f..875b1e7e71af 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/KeyguardIndicationController.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/KeyguardIndicationController.java @@ -66,7 +66,6 @@ import com.android.internal.widget.LockPatternUtils; import com.android.internal.widget.ViewClippingUtil; import com.android.keyguard.KeyguardUpdateMonitor; import com.android.keyguard.KeyguardUpdateMonitorCallback; -import com.android.settingslib.Utils; import com.android.settingslib.fuelgauge.BatteryStatus; import com.android.systemui.R; import com.android.systemui.animation.Interpolators; @@ -130,7 +129,6 @@ public class KeyguardIndicationController implements KeyguardStateController.Cal private String mRestingIndication; private String mAlignmentIndication; private CharSequence mTransientIndication; - private boolean mTransientTextIsError; protected ColorStateList mInitialTextColorState; private boolean mVisible; private boolean mHideTransientMessageOnScreenOff; @@ -382,8 +380,7 @@ public class KeyguardIndicationController implements KeyguardStateController.Cal private void updateTransient() { if (!TextUtils.isEmpty(mTransientIndication)) { - mRotateTextViewController.showTransient(mTransientIndication, - mTransientTextIsError); + mRotateTextViewController.showTransient(mTransientIndication); } else { mRotateTextViewController.hideTransient(); } @@ -421,7 +418,8 @@ public class KeyguardIndicationController implements KeyguardStateController.Cal INDICATION_TYPE_ALIGNMENT, new KeyguardIndication.Builder() .setMessage(mAlignmentIndication) - .setTextColor(Utils.getColorError(mContext)) + .setTextColor(ColorStateList.valueOf( + mContext.getColor(R.color.misalignment_text_color))) .build(), true); } else { @@ -594,7 +592,6 @@ public class KeyguardIndicationController implements KeyguardStateController.Cal boolean isError, boolean hideOnScreenOff) { mTransientIndication = transientIndication; mHideTransientMessageOnScreenOff = hideOnScreenOff && transientIndication != null; - mTransientTextIsError = isError; mHandler.removeMessages(MSG_HIDE_TRANSIENT); mHandler.removeMessages(MSG_SWIPE_UP_TO_UNLOCK); if (mDozing && !TextUtils.isEmpty(mTransientIndication)) { @@ -811,7 +808,6 @@ public class KeyguardIndicationController implements KeyguardStateController.Cal public void dump(FileDescriptor fd, PrintWriter pw, String[] args) { pw.println("KeyguardIndicationController:"); - pw.println(" mTransientTextIsError: " + mTransientTextIsError); pw.println(" mInitialTextColorState: " + mInitialTextColorState); pw.println(" mPowerPluggedInWired: " + mPowerPluggedInWired); pw.println(" mPowerPluggedIn: " + mPowerPluggedIn); diff --git a/packages/SystemUI/tests/src/com/android/systemui/keyguard/KeyguardIndicationRotateTextViewControllerTest.java b/packages/SystemUI/tests/src/com/android/systemui/keyguard/KeyguardIndicationRotateTextViewControllerTest.java index 51576687880c..61b404107519 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/keyguard/KeyguardIndicationRotateTextViewControllerTest.java +++ b/packages/SystemUI/tests/src/com/android/systemui/keyguard/KeyguardIndicationRotateTextViewControllerTest.java @@ -211,7 +211,7 @@ public class KeyguardIndicationRotateTextViewControllerTest extends SysuiTestCas reset(mExecutor); // WHEN we have a transient message - mController.showTransient(TEST_MESSAGE_2, false); + mController.showTransient(TEST_MESSAGE_2); // THEN // - we immediately update diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/KeyguardIndicationControllerTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/KeyguardIndicationControllerTest.java index b8db1156b85d..1ba3831277cd 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/KeyguardIndicationControllerTest.java +++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/KeyguardIndicationControllerTest.java @@ -72,7 +72,6 @@ import androidx.test.runner.AndroidJUnit4; import com.android.internal.app.IBatteryStats; import com.android.internal.widget.LockPatternUtils; import com.android.keyguard.KeyguardUpdateMonitor; -import com.android.settingslib.Utils; import com.android.settingslib.fuelgauge.BatteryStatus; import com.android.systemui.R; import com.android.systemui.SysuiTestCase; @@ -248,8 +247,8 @@ public class KeyguardIndicationControllerTest extends SysuiTestCase { verifyIndicationMessage(INDICATION_TYPE_ALIGNMENT, mContext.getResources().getString(R.string.dock_alignment_slow_charging)); - assertThat(mKeyguardIndicationCaptor.getValue().getTextColor()) - .isEqualTo(Utils.getColorError(mContext)); + assertThat(mKeyguardIndicationCaptor.getValue().getTextColor().getDefaultColor()) + .isEqualTo(mContext.getColor(R.color.misalignment_text_color)); } @Test @@ -265,8 +264,8 @@ public class KeyguardIndicationControllerTest extends SysuiTestCase { verifyIndicationMessage(INDICATION_TYPE_ALIGNMENT, mContext.getResources().getString(R.string.dock_alignment_not_charging)); - assertThat(mKeyguardIndicationCaptor.getValue().getTextColor()) - .isEqualTo(Utils.getColorError(mContext)); + assertThat(mKeyguardIndicationCaptor.getValue().getTextColor().getDefaultColor()) + .isEqualTo(mContext.getColor(R.color.misalignment_text_color)); } @Test @@ -680,7 +679,7 @@ public class KeyguardIndicationControllerTest extends SysuiTestCase { private void verifyHideIndication(int type) { if (type == INDICATION_TYPE_TRANSIENT) { verify(mRotateTextViewController).hideTransient(); - verify(mRotateTextViewController, never()).showTransient(anyString(), anyBoolean()); + verify(mRotateTextViewController, never()).showTransient(anyString()); } else { verify(mRotateTextViewController).hideIndication(type); verify(mRotateTextViewController, never()).updateIndication(eq(type), @@ -689,10 +688,10 @@ public class KeyguardIndicationControllerTest extends SysuiTestCase { } private void verifyTransientMessage(String message) { - verify(mRotateTextViewController).showTransient(eq(message), anyBoolean()); + verify(mRotateTextViewController).showTransient(eq(message)); } private void verifyNoTransientMessage() { - verify(mRotateTextViewController, never()).showTransient(any(), anyBoolean()); + verify(mRotateTextViewController, never()).showTransient(any()); } } |