diff --git a/packages/SystemUI/res-keyguard/layout/keyguard_pin_view.xml b/packages/SystemUI/res-keyguard/layout/keyguard_pin_view.xml index c7d2d81ded36b..29e14c57a047e 100644 --- a/packages/SystemUI/res-keyguard/layout/keyguard_pin_view.xml +++ b/packages/SystemUI/res-keyguard/layout/keyguard_pin_view.xml @@ -16,202 +16,10 @@ ** limitations under the License. */ --> - - - + android:layout_height="match_parent"> - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + diff --git a/packages/SystemUI/res-keyguard/layout/keyguard_pin_view_portrait.xml b/packages/SystemUI/res-keyguard/layout/keyguard_pin_view_portrait.xml new file mode 100644 index 0000000000000..f3cd9e49b49ce --- /dev/null +++ b/packages/SystemUI/res-keyguard/layout/keyguard_pin_view_portrait.xml @@ -0,0 +1,218 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/packages/SystemUI/src/com/android/keyguard/KeyguardSecurityViewFlipperController.java b/packages/SystemUI/src/com/android/keyguard/KeyguardSecurityViewFlipperController.java index fbacd6818648b..bc5b1ba9a294b 100644 --- a/packages/SystemUI/src/com/android/keyguard/KeyguardSecurityViewFlipperController.java +++ b/packages/SystemUI/src/com/android/keyguard/KeyguardSecurityViewFlipperController.java @@ -117,15 +117,19 @@ public class KeyguardSecurityViewFlipperController KeyguardSecurityCallback keyguardSecurityCallback, @Nullable OnViewInflatedCallback onViewInflatedListener) { int layoutId = getLayoutIdFor(securityMode); - if (layoutId != 0) { - if (DEBUG) Log.v(TAG, "inflating on bg thread id = " + layoutId); + int viewID = getKeyguardInputViewId(securityMode); + if (layoutId != 0 && viewID != 0) { + if (DEBUG) { + Log.v(TAG, "inflating on bg thread id = " + + layoutId + " . viewID = " + viewID); + } mAsyncLayoutInflater.inflate(layoutId, mView, (view, resId, parent) -> { mView.addView(view); KeyguardInputViewController childController = mKeyguardSecurityViewControllerFactory.create( - (KeyguardInputView) view, securityMode, - keyguardSecurityCallback); + (KeyguardInputView) view.findViewById(viewID), + securityMode, keyguardSecurityCallback); childController.init(); mChildren.add(childController); if (onViewInflatedListener != null) { @@ -147,6 +151,19 @@ public class KeyguardSecurityViewFlipperController } } + private int getKeyguardInputViewId(SecurityMode securityMode) { + //Keyguard Input View is not the root view of the layout, use these IDs for lookup. + switch (securityMode) { + case Pattern: return R.id.keyguard_pattern_view; + case PIN: return R.id.keyguard_pin_view; + case Password: return R.id.keyguard_password_view; + case SimPin: return R.id.keyguard_sim_pin_view; + case SimPuk: return R.id.keyguard_sim_puk_view; + default: + return 0; + } + } + /** Makes the supplied child visible if it is contained win this view, */ public void show(KeyguardInputViewController childController) { int index = childController.getIndexIn(mView); diff --git a/packages/SystemUI/tests/src/com/android/keyguard/KeyguardSecurityViewFlipperControllerTest.java b/packages/SystemUI/tests/src/com/android/keyguard/KeyguardSecurityViewFlipperControllerTest.java index cd187540ba742..64e1458c42d41 100644 --- a/packages/SystemUI/tests/src/com/android/keyguard/KeyguardSecurityViewFlipperControllerTest.java +++ b/packages/SystemUI/tests/src/com/android/keyguard/KeyguardSecurityViewFlipperControllerTest.java @@ -138,6 +138,11 @@ public class KeyguardSecurityViewFlipperControllerTest extends SysuiTestCase { @Test public void asynchronouslyInflateView_setNeedsInput() { + when(mKeyguardSecurityViewControllerFactory.create( + any(), any(SecurityMode.class), + any(KeyguardSecurityCallback.class))) + .thenReturn(mKeyguardInputViewController); + ArgumentCaptor argumentCaptor = ArgumentCaptor.forClass(AsyncLayoutInflater.OnInflateFinishedListener.class); mKeyguardSecurityViewFlipperController.asynchronouslyInflateView(SecurityMode.PIN,