diff options
| -rw-r--r-- | packages/SystemUI/src/com/android/systemui/keyguard/KeyguardIndication.java | 11 | ||||
| -rw-r--r-- | packages/SystemUI/src/com/android/systemui/keyguard/KeyguardIndicationRotateTextViewController.java | 4 |
2 files changed, 10 insertions, 5 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardIndication.java b/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardIndication.java index 3a06f7aeb6bf..d65d16951191 100644 --- a/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardIndication.java +++ b/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardIndication.java @@ -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); } diff --git a/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardIndicationRotateTextViewController.java b/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardIndicationRotateTextViewController.java index 8c04143abc54..2e599de1970d 100644 --- a/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardIndicationRotateTextViewController.java +++ b/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardIndicationRotateTextViewController.java @@ -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 |