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

Commit 6c625f68 authored by Riddle Hsu's avatar Riddle Hsu
Browse files

Relax condition to hide unready IME with fixed rotation

This reduces flickering when opening app in a different
orientation with IME, and the layering target is not the
opening app due to a ALT_FOCUSABLE_IM floating window.

Also
- Make sure mLastConfigReportedToClient detect changes
  if the window (e.g. IME) is a config listener of process.
  So it can report to redraw.
- Reduce duplicated hidden operation.

Bug: 271352469
Test: DisplayContentTests#testApplyTopFixedRotationTransform
Change-Id: I6d24b0ee5294f0e7e145a4cf24e1b142dc8569d6
parent dd218cba
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -364,6 +364,7 @@ class AsyncRotationController extends FadeAnimationController implements Consume

    /** Hides the window immediately until it is drawn in new rotation. */
    void hideImmediately(WindowToken windowToken) {
        if (isTargetToken(windowToken)) return;
        final boolean original = mHideImmediately;
        mHideImmediately = true;
        final Operation op = new Operation(Operation.ACTION_FADE);
+3 −3
Original line number Diff line number Diff line
@@ -4150,13 +4150,13 @@ class DisplayContent extends RootDisplayArea implements WindowManagerPolicy.Disp

    /** @see WindowManagerInternal#onToggleImeRequested */
    void onShowImeRequested() {
        if (mImeLayeringTarget == null || mInputMethodWindow == null) {
        if (mInputMethodWindow == null) {
            return;
        }
        // If IME window will be shown on the rotated activity, share the transformed state to
        // IME window so it can compute rotated frame with rotated configuration.
        if (mImeLayeringTarget.mToken.isFixedRotationTransforming()) {
            mInputMethodWindow.mToken.linkFixedRotationTransform(mImeLayeringTarget.mToken);
        if (mFixedRotationLaunchingApp != null) {
            mInputMethodWindow.mToken.linkFixedRotationTransform(mFixedRotationLaunchingApp);
            // Hide the window until the rotation is done to avoid intermediate artifacts if the
            // parent surface of IME container is changed.
            if (mAsyncRotationController != null) {
+4 −2
Original line number Diff line number Diff line
@@ -2342,9 +2342,11 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP

    @Override
    public void onConfigurationChanged(Configuration newParentConfig) {
        mTempConfiguration.setTo(getConfiguration());
        // Get from super to avoid using the updated global config from the override method.
        final Configuration selfConfiguration = super.getConfiguration();
        mTempConfiguration.setTo(selfConfiguration);
        super.onConfigurationChanged(newParentConfig);
        final int diff = getConfiguration().diff(mTempConfiguration);
        final int diff = selfConfiguration.diff(mTempConfiguration);
        if (diff != 0) {
            mLastConfigReportedToClient = false;
        }
+0 −1
Original line number Diff line number Diff line
@@ -1620,7 +1620,6 @@ public class DisplayContentTests extends WindowTestsBase {

        // If the rotated activity requests to show IME, the IME window should use the
        // transformation from activity to lay out in the same orientation.
        mDisplayContent.setImeLayeringTarget(mAppWindow);
        LocalServices.getService(WindowManagerInternal.class).onToggleImeRequested(true /* show */,
                app.token, app.token, mDisplayContent.mDisplayId);
        assertTrue(asyncRotationController.isTargetToken(mImeWindow.mToken));