From 49584e3fe6e8d702c845dad5e84dcdf077bfedeb Mon Sep 17 00:00:00 2001 From: Aaron Liu Date: Mon, 12 Dec 2022 09:57:18 -0800 Subject: [PATCH] [Bouncer] Have initial message id for sim pin. Seems like we can get into a state where the sim pin view does not have an initial message and is getting an exception because 0 is not a valid resource id. Moving the getInitialMessageResId to the parent of the sim pin view controller. Fixes: 261941458 Test: Add unit test. Open sim pin view. Change-Id: Ia2782c7c8acd0775bd2fb1cf9774f477264cf899 --- .../com/android/keyguard/KeyguardInputViewController.java | 7 +++---- .../keyguard/KeyguardPinBasedInputViewController.java | 5 +++++ .../com/android/keyguard/KeyguardPinViewController.java | 5 ----- .../keyguard/KeyguardSecurityViewFlipperController.java | 5 +++++ .../keyguard/KeyguardAbsKeyInputViewControllerTest.java | 5 +++++ .../keyguard/KeyguardPinBasedInputViewControllerTest.java | 7 +++++++ 6 files changed, 25 insertions(+), 9 deletions(-) diff --git a/packages/SystemUI/src/com/android/keyguard/KeyguardInputViewController.java b/packages/SystemUI/src/com/android/keyguard/KeyguardInputViewController.java index 2e9ad5868ebac..f6dca9e02a8ae 100644 --- a/packages/SystemUI/src/com/android/keyguard/KeyguardInputViewController.java +++ b/packages/SystemUI/src/com/android/keyguard/KeyguardInputViewController.java @@ -142,7 +142,8 @@ public abstract class KeyguardInputViewController } public void startAppearAnimation() { - if (TextUtils.isEmpty(mMessageAreaController.getMessage())) { + if (TextUtils.isEmpty(mMessageAreaController.getMessage()) + && getInitialMessageResId() != 0) { mMessageAreaController.setMessage(getInitialMessageResId()); } mView.startAppearAnimation(); @@ -163,9 +164,7 @@ public abstract class KeyguardInputViewController } /** Determines the message to show in the bouncer when it first appears. */ - protected int getInitialMessageResId() { - return 0; - } + protected abstract int getInitialMessageResId(); /** Factory for a {@link KeyguardInputViewController}. */ public static class Factory { diff --git a/packages/SystemUI/src/com/android/keyguard/KeyguardPinBasedInputViewController.java b/packages/SystemUI/src/com/android/keyguard/KeyguardPinBasedInputViewController.java index f7423ed12e684..8011efdc1ae7a 100644 --- a/packages/SystemUI/src/com/android/keyguard/KeyguardPinBasedInputViewController.java +++ b/packages/SystemUI/src/com/android/keyguard/KeyguardPinBasedInputViewController.java @@ -139,4 +139,9 @@ public abstract class KeyguardPinBasedInputViewController