Loading core/java/android/inputmethodservice/InputMethodService.java +1 −0 Original line number Diff line number Diff line Loading @@ -1249,6 +1249,7 @@ public class InputMethodService extends AbstractInputMethodService { WindowManager.LayoutParams.TYPE_INPUT_METHOD, Gravity.BOTTOM, false); mWindow.getWindow().getAttributes().setFitInsetsTypes(statusBars() | navigationBars()); mWindow.getWindow().getAttributes().setFitInsetsSides(Side.all() & ~Side.BOTTOM); mWindow.getWindow().getAttributes().setFitInsetsIgnoringVisibility(true); // IME layout should always be inset by navigation bar, no matter its current visibility, // unless automotive requests it, since automotive may hide the navigation bar. Loading packages/SystemUI/src/com/android/systemui/wm/DisplayImeController.java +15 −11 Original line number Diff line number Diff line Loading @@ -20,6 +20,7 @@ import android.animation.Animator; import android.animation.AnimatorListenerAdapter; import android.animation.ValueAnimator; import android.content.res.Configuration; import android.graphics.Point; import android.os.Handler; import android.os.RemoteException; import android.util.Slog; Loading Loading @@ -97,7 +98,7 @@ public class DisplayImeController implements DisplayController.OnDisplaysChanged } if (mSystemWindows.mDisplayController.getDisplayLayout(displayId).rotation() != pd.mRotation && isImeShowing(displayId)) { pd.startAnimation(true); pd.startAnimation(true, false /* forceRestart */); } } Loading Loading @@ -200,7 +201,15 @@ public class DisplayImeController implements DisplayController.OnDisplaysChanged continue; } if (activeControl.getType() == InsetsState.ITYPE_IME) { mHandler.post(() -> { final Point lastSurfacePosition = mImeSourceControl != null ? mImeSourceControl.getSurfacePosition() : null; mImeSourceControl = activeControl; if (!activeControl.getSurfacePosition().equals(lastSurfacePosition) && mAnimation != null) { startAnimation(mImeShowing, true /* forceRestart */); } }); } } } Loading @@ -212,7 +221,7 @@ public class DisplayImeController implements DisplayController.OnDisplaysChanged return; } if (DEBUG) Slog.d(TAG, "Got showInsets for ime"); startAnimation(true /* show */); startAnimation(true /* show */, false /* forceRestart */); } @Override Loading @@ -221,7 +230,7 @@ public class DisplayImeController implements DisplayController.OnDisplaysChanged return; } if (DEBUG) Slog.d(TAG, "Got hideInsets for ime"); startAnimation(false /* show */); startAnimation(false /* show */, false /* forceRestart */); } /** Loading @@ -239,7 +248,7 @@ public class DisplayImeController implements DisplayController.OnDisplaysChanged return imeSource.getFrame().top + (int) surfaceOffset; } private void startAnimation(final boolean show) { private void startAnimation(final boolean show, final boolean forceRestart) { final InsetsSource imeSource = mInsetsState.getSource(InsetsState.ITYPE_IME); if (imeSource == null || mImeSourceControl == null) { return; Loading @@ -250,7 +259,7 @@ public class DisplayImeController implements DisplayController.OnDisplaysChanged + (mAnimationDirection == DIRECTION_SHOW ? "SHOW" : (mAnimationDirection == DIRECTION_HIDE ? "HIDE" : "NONE"))); } if ((mAnimationDirection == DIRECTION_SHOW && show) if (!forceRestart && (mAnimationDirection == DIRECTION_SHOW && show) || (mAnimationDirection == DIRECTION_HIDE && !show)) { return; } Loading @@ -270,11 +279,6 @@ public class DisplayImeController implements DisplayController.OnDisplaysChanged final float shownY = defaultY; final float startY = show ? hiddenY : shownY; final float endY = show ? shownY : hiddenY; if (mImeShowing && show) { // IME is already showing, so set seek to end seekValue = shownY; seek = true; } mImeShowing = show; mAnimation = ValueAnimator.ofFloat(startY, endY); mAnimation.setDuration( Loading services/core/java/com/android/server/wm/WindowState.java +3 −3 Original line number Diff line number Diff line Loading @@ -2275,9 +2275,9 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP return false; } if (PixelFormat.formatHasAlpha(mAttrs.format) && mAttrs.alpha == 0) { // Support legacy use cases where completely transparent windows can still be ime target // with FLAG_NOT_FOCUSABLE and ALT_FOCUSABLE_IM set. if (PixelFormat.formatHasAlpha(mAttrs.format)) { // Support legacy use cases where transparent windows can still be ime target with // FLAG_NOT_FOCUSABLE and ALT_FOCUSABLE_IM set. // Certain apps listen for IME insets using transparent windows and ADJUST_NOTHING to // manually synchronize app content to IME animation b/144619551. // TODO(b/145812508): remove this once new focus management is complete b/141738570 Loading services/tests/wmtests/src/com/android/server/wm/WindowStateTests.java +0 −2 Original line number Diff line number Diff line Loading @@ -251,11 +251,9 @@ public class WindowStateTests extends WindowTestsBase { // b/145812508: special legacy use-case for transparent/translucent windows. appWindow.mAttrs.format = PixelFormat.TRANSPARENT; appWindow.mAttrs.alpha = 0; assertTrue(appWindow.canBeImeTarget()); appWindow.mAttrs.format = PixelFormat.OPAQUE; appWindow.mAttrs.alpha = 1; appWindow.mAttrs.flags &= ~FLAG_ALT_FOCUSABLE_IM; assertFalse(appWindow.canBeImeTarget()); appWindow.mAttrs.flags &= ~FLAG_NOT_FOCUSABLE; Loading Loading
core/java/android/inputmethodservice/InputMethodService.java +1 −0 Original line number Diff line number Diff line Loading @@ -1249,6 +1249,7 @@ public class InputMethodService extends AbstractInputMethodService { WindowManager.LayoutParams.TYPE_INPUT_METHOD, Gravity.BOTTOM, false); mWindow.getWindow().getAttributes().setFitInsetsTypes(statusBars() | navigationBars()); mWindow.getWindow().getAttributes().setFitInsetsSides(Side.all() & ~Side.BOTTOM); mWindow.getWindow().getAttributes().setFitInsetsIgnoringVisibility(true); // IME layout should always be inset by navigation bar, no matter its current visibility, // unless automotive requests it, since automotive may hide the navigation bar. Loading
packages/SystemUI/src/com/android/systemui/wm/DisplayImeController.java +15 −11 Original line number Diff line number Diff line Loading @@ -20,6 +20,7 @@ import android.animation.Animator; import android.animation.AnimatorListenerAdapter; import android.animation.ValueAnimator; import android.content.res.Configuration; import android.graphics.Point; import android.os.Handler; import android.os.RemoteException; import android.util.Slog; Loading Loading @@ -97,7 +98,7 @@ public class DisplayImeController implements DisplayController.OnDisplaysChanged } if (mSystemWindows.mDisplayController.getDisplayLayout(displayId).rotation() != pd.mRotation && isImeShowing(displayId)) { pd.startAnimation(true); pd.startAnimation(true, false /* forceRestart */); } } Loading Loading @@ -200,7 +201,15 @@ public class DisplayImeController implements DisplayController.OnDisplaysChanged continue; } if (activeControl.getType() == InsetsState.ITYPE_IME) { mHandler.post(() -> { final Point lastSurfacePosition = mImeSourceControl != null ? mImeSourceControl.getSurfacePosition() : null; mImeSourceControl = activeControl; if (!activeControl.getSurfacePosition().equals(lastSurfacePosition) && mAnimation != null) { startAnimation(mImeShowing, true /* forceRestart */); } }); } } } Loading @@ -212,7 +221,7 @@ public class DisplayImeController implements DisplayController.OnDisplaysChanged return; } if (DEBUG) Slog.d(TAG, "Got showInsets for ime"); startAnimation(true /* show */); startAnimation(true /* show */, false /* forceRestart */); } @Override Loading @@ -221,7 +230,7 @@ public class DisplayImeController implements DisplayController.OnDisplaysChanged return; } if (DEBUG) Slog.d(TAG, "Got hideInsets for ime"); startAnimation(false /* show */); startAnimation(false /* show */, false /* forceRestart */); } /** Loading @@ -239,7 +248,7 @@ public class DisplayImeController implements DisplayController.OnDisplaysChanged return imeSource.getFrame().top + (int) surfaceOffset; } private void startAnimation(final boolean show) { private void startAnimation(final boolean show, final boolean forceRestart) { final InsetsSource imeSource = mInsetsState.getSource(InsetsState.ITYPE_IME); if (imeSource == null || mImeSourceControl == null) { return; Loading @@ -250,7 +259,7 @@ public class DisplayImeController implements DisplayController.OnDisplaysChanged + (mAnimationDirection == DIRECTION_SHOW ? "SHOW" : (mAnimationDirection == DIRECTION_HIDE ? "HIDE" : "NONE"))); } if ((mAnimationDirection == DIRECTION_SHOW && show) if (!forceRestart && (mAnimationDirection == DIRECTION_SHOW && show) || (mAnimationDirection == DIRECTION_HIDE && !show)) { return; } Loading @@ -270,11 +279,6 @@ public class DisplayImeController implements DisplayController.OnDisplaysChanged final float shownY = defaultY; final float startY = show ? hiddenY : shownY; final float endY = show ? shownY : hiddenY; if (mImeShowing && show) { // IME is already showing, so set seek to end seekValue = shownY; seek = true; } mImeShowing = show; mAnimation = ValueAnimator.ofFloat(startY, endY); mAnimation.setDuration( Loading
services/core/java/com/android/server/wm/WindowState.java +3 −3 Original line number Diff line number Diff line Loading @@ -2275,9 +2275,9 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP return false; } if (PixelFormat.formatHasAlpha(mAttrs.format) && mAttrs.alpha == 0) { // Support legacy use cases where completely transparent windows can still be ime target // with FLAG_NOT_FOCUSABLE and ALT_FOCUSABLE_IM set. if (PixelFormat.formatHasAlpha(mAttrs.format)) { // Support legacy use cases where transparent windows can still be ime target with // FLAG_NOT_FOCUSABLE and ALT_FOCUSABLE_IM set. // Certain apps listen for IME insets using transparent windows and ADJUST_NOTHING to // manually synchronize app content to IME animation b/144619551. // TODO(b/145812508): remove this once new focus management is complete b/141738570 Loading
services/tests/wmtests/src/com/android/server/wm/WindowStateTests.java +0 −2 Original line number Diff line number Diff line Loading @@ -251,11 +251,9 @@ public class WindowStateTests extends WindowTestsBase { // b/145812508: special legacy use-case for transparent/translucent windows. appWindow.mAttrs.format = PixelFormat.TRANSPARENT; appWindow.mAttrs.alpha = 0; assertTrue(appWindow.canBeImeTarget()); appWindow.mAttrs.format = PixelFormat.OPAQUE; appWindow.mAttrs.alpha = 1; appWindow.mAttrs.flags &= ~FLAG_ALT_FOCUSABLE_IM; assertFalse(appWindow.canBeImeTarget()); appWindow.mAttrs.flags &= ~FLAG_NOT_FOCUSABLE; Loading