diff --git a/packages/SystemUI/src/com/android/keyguard/KeyguardInputView.java b/packages/SystemUI/src/com/android/keyguard/KeyguardInputView.java index d42a53cc875e0..d58b95c6220f4 100644 --- a/packages/SystemUI/src/com/android/keyguard/KeyguardInputView.java +++ b/packages/SystemUI/src/com/android/keyguard/KeyguardInputView.java @@ -43,6 +43,10 @@ public abstract class KeyguardInputView extends LinearLayout { abstract CharSequence getTitle(); + void animateForIme(float interpolatedFraction) { + return; + } + boolean disallowInterceptTouch(MotionEvent event) { return false; } diff --git a/packages/SystemUI/src/com/android/keyguard/KeyguardPasswordView.java b/packages/SystemUI/src/com/android/keyguard/KeyguardPasswordView.java index aaa5efec807e5..92b65b242b0e9 100644 --- a/packages/SystemUI/src/com/android/keyguard/KeyguardPasswordView.java +++ b/packages/SystemUI/src/com/android/keyguard/KeyguardPasswordView.java @@ -136,24 +136,14 @@ public class KeyguardPasswordView extends KeyguardAbsKeyInputView { @Override public void startAppearAnimation() { + // Reset state, and let IME animation reveal the view as it slides in setAlpha(0f); setTranslationY(0f); - animate() - .alpha(1) - .withLayer() - .setDuration(300) - .setInterpolator(mLinearOutSlowInInterpolator); } @Override - public boolean startDisappearAnimation(Runnable finishRunnable) { - animate() - .alpha(0f) - .translationY(mDisappearYTranslation) - .setInterpolator(mFastOutLinearInInterpolator) - .setDuration(100) - .withEndAction(finishRunnable); - return true; + public void animateForIme(float interpolatedFraction) { + setAlpha(interpolatedFraction); } @Override diff --git a/packages/SystemUI/src/com/android/keyguard/KeyguardPasswordViewController.java b/packages/SystemUI/src/com/android/keyguard/KeyguardPasswordViewController.java index 5e339172ca28b..0f1c3c8a20b76 100644 --- a/packages/SystemUI/src/com/android/keyguard/KeyguardPasswordViewController.java +++ b/packages/SystemUI/src/com/android/keyguard/KeyguardPasswordViewController.java @@ -194,14 +194,18 @@ public class KeyguardPasswordViewController @Override public void onResume(int reason) { super.onResume(reason); - // Wait a bit to focus the field so the focusable flag on the window is already set then. - mMainExecutor.execute(() -> { - if (mView.isShown() && mPasswordEntry.isEnabled()) { - mPasswordEntry.requestFocus(); - if (reason != KeyguardSecurityView.SCREEN_ON || mShowImeAtScreenOn) { - mInputMethodManager.showSoftInput( - mPasswordEntry, InputMethodManager.SHOW_IMPLICIT); - } + + mPasswordEntry.requestFocus(); + if (reason != KeyguardSecurityView.SCREEN_ON || mShowImeAtScreenOn) { + showInput(); + } + } + + private void showInput() { + mPasswordEntry.post(() -> { + if (mPasswordEntry.isFocused() && mView.isShown()) { + mInputMethodManager.showSoftInput( + mPasswordEntry, InputMethodManager.SHOW_IMPLICIT); } }); } diff --git a/packages/SystemUI/src/com/android/keyguard/KeyguardSecurityContainer.java b/packages/SystemUI/src/com/android/keyguard/KeyguardSecurityContainer.java index b62ea6bc2ff63..42f3cc7069ba8 100644 --- a/packages/SystemUI/src/com/android/keyguard/KeyguardSecurityContainer.java +++ b/packages/SystemUI/src/com/android/keyguard/KeyguardSecurityContainer.java @@ -119,21 +119,24 @@ public class KeyguardSecurityContainer extends FrameLayout { @Override public WindowInsets onProgress(WindowInsets windowInsets, List list) { - int translationY = 0; if (mDisappearAnimRunning) { mSecurityViewFlipper.setTranslationY( mInitialBounds.bottom - mFinalBounds.bottom); } else { + int translationY = 0; + float interpolatedFraction = 1f; for (WindowInsetsAnimation animation : list) { if ((animation.getTypeMask() & WindowInsets.Type.ime()) == 0) { continue; } + interpolatedFraction = animation.getInterpolatedFraction(); + final int paddingBottom = (int) MathUtils.lerp( mInitialBounds.bottom - mFinalBounds.bottom, 0, - animation.getInterpolatedFraction()); + interpolatedFraction); translationY += paddingBottom; } - mSecurityViewFlipper.setTranslationY(translationY); + mSecurityViewFlipper.animateForIme(translationY, interpolatedFraction); } return windowInsets; } @@ -141,7 +144,7 @@ public class KeyguardSecurityContainer extends FrameLayout { @Override public void onEnd(WindowInsetsAnimation animation) { if (!mDisappearAnimRunning) { - mSecurityViewFlipper.setTranslationY(0); + mSecurityViewFlipper.animateForIme(0, /* interpolatedFraction */ 1f); } } }; diff --git a/packages/SystemUI/src/com/android/keyguard/KeyguardSecurityViewFlipper.java b/packages/SystemUI/src/com/android/keyguard/KeyguardSecurityViewFlipper.java index b8439af6daaad..7773fe9fab755 100644 --- a/packages/SystemUI/src/com/android/keyguard/KeyguardSecurityViewFlipper.java +++ b/packages/SystemUI/src/com/android/keyguard/KeyguardSecurityViewFlipper.java @@ -83,6 +83,16 @@ public class KeyguardSecurityViewFlipper extends ViewFlipper { return ""; } + /** + * Translate the entire view, and optionally inform the wrapped view of the progress + * so it can animate with the parent. + */ + public void animateForIme(int translationY, float interpolatedFraction) { + super.setTranslationY(translationY); + KeyguardInputView v = getSecurityView(); + if (v != null) v.animateForIme(interpolatedFraction); + } + @Override protected boolean checkLayoutParams(ViewGroup.LayoutParams p) { return p instanceof LayoutParams; diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardBouncer.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardBouncer.java index 7c7c6e62f45fb..713daaa9fd4a5 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardBouncer.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardBouncer.java @@ -451,10 +451,6 @@ public class KeyguardBouncer { } } - public boolean onBackPressed() { - return mKeyguardViewController != null && mKeyguardViewController.handleBackKey(); - } - /** * @return True if and only if the security method should be shown before showing the * notifications on Keyguard, like SIM PIN/PUK.