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

Commit 49584e3f authored by Aaron Liu's avatar Aaron Liu
Browse files

[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
parent 55d73f2e
Loading
Loading
Loading
Loading
+3 −4
Original line number Diff line number Diff line
@@ -142,7 +142,8 @@ public abstract class KeyguardInputViewController<T extends KeyguardInputView>
    }

    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<T extends KeyguardInputView>
    }

    /** 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 {
+5 −0
Original line number Diff line number Diff line
@@ -139,4 +139,9 @@ public abstract class KeyguardPinBasedInputViewController<T extends KeyguardPinB
        super.startErrorAnimation();
        mView.startErrorAnimation();
    }

    @Override
    protected int getInitialMessageResId() {
        return R.string.keyguard_enter_your_pin;
    }
}
+0 −5
Original line number Diff line number Diff line
@@ -74,9 +74,4 @@ public class KeyguardPinViewController
        return mView.startDisappearAnimation(
                mKeyguardUpdateMonitor.needsSlowUnlockTransition(), finishRunnable);
    }

    @Override
    protected int getInitialMessageResId() {
        return R.string.keyguard_enter_your_pin;
    }
}
+5 −0
Original line number Diff line number Diff line
@@ -156,5 +156,10 @@ public class KeyguardSecurityViewFlipperController
        @Override
        public void onStartingToHide() {
        }

        @Override
        protected int getInitialMessageResId() {
            return 0;
        }
    }
}
+5 −0
Original line number Diff line number Diff line
@@ -99,6 +99,11 @@ public class KeyguardAbsKeyInputViewControllerTest extends SysuiTestCase {
            public void onResume(int reason) {
                super.onResume(reason);
            }

            @Override
            protected int getInitialMessageResId() {
                return 0;
            }
        };
        mKeyguardAbsKeyInputViewController.init();
        reset(mKeyguardMessageAreaController);  // Clear out implicit call to init.
Loading