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

Commit a1521dae authored by Beverly's avatar Beverly Committed by Beverly Tai
Browse files

KeyguardIndication: Allow no message as long as there's an icon

Test: manual
Bug: 180101407
Change-Id: I9e2b71e3ee4cf7f3136be2eee475e6a52932360b
parent f6888b8d
Loading
Loading
Loading
Loading
+8 −3
Original line number Diff line number Diff line
@@ -29,7 +29,7 @@ import android.view.View;
 * See {@link com.android.systemui.statusbar.phone.KeyguardBottomAreaView}.
 */
public class KeyguardIndication {
    @NonNull
    @Nullable
    private final CharSequence mMessage;
    @NonNull
    private final ColorStateList mTextColor;
@@ -146,8 +146,13 @@ public class KeyguardIndication {
         * Build the KeyguardIndication.
         */
        public KeyguardIndication build() {
            if (mMessage == null) throw new IllegalStateException("message must be set");
            if (mTextColor == null) throw new IllegalStateException("text color must be set");
            if (mMessage == null && mIcon == null) {
                throw new IllegalStateException("message or icon must be set");
            }
            if (mTextColor == null) {
                throw new IllegalStateException("text color must be set");
            }

            return new KeyguardIndication(
                    mMessage, mTextColor, mIcon, mOnClickListener, mBackground);
        }
+2 −2
Original line number Diff line number Diff line
@@ -106,7 +106,8 @@ public class KeyguardIndicationRotateTextViewController extends
            boolean showImmediately) {
        final boolean hasPreviousIndication = mIndicationMessages.get(type) != null;
        final boolean hasNewIndication = newIndication != null
                && !TextUtils.isEmpty(newIndication.getMessage());
                && (!TextUtils.isEmpty(newIndication.getMessage())
                    || newIndication.getIcon() != null);
        if (!hasNewIndication) {
            mIndicationMessages.remove(type);
            mIndicationQueue.removeIf(x -> x == type);
@@ -203,7 +204,6 @@ public class KeyguardIndicationRotateTextViewController extends
            mIndicationQueue.add(type); // re-add to show later
        }

        // pass the style update to be run right before our new indication is shown:
        mView.switchIndication(mIndicationMessages.get(type));

        // only schedule next indication if there's more than just this indication in the queue