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

Commit 06fc801d authored by Riddle Hsu's avatar Riddle Hsu
Browse files

Update IME relative layer if it can be the control target

It handles the case from InputMethodManagerService#reportStartInput
with
Activity <- IME container LastRelativeLayer
 - Base Window
 - Dialog Window <- ImeControlTarget, ImeLayeringTarget

The LastRelativeLayer should update to Dialog window, so IME container
can show above Dialog.

Test: atest ZOrderingTests# \
      testAssignWindowLayers_ForImeOnPopupImeLayeringTarget
Bug: 301134949
Bug: 301261260
Change-Id: I7ab44f7fc4724bcb79cf3f58979de21c143edb34
parent 55722bf5
Loading
Loading
Loading
Loading
+11 −0
Original line number Diff line number Diff line
@@ -4668,6 +4668,17 @@ class DisplayContent extends RootDisplayArea implements WindowManagerPolicy.Disp
            scheduleAnimation();

            mWmService.mH.post(() -> InputMethodManagerInternal.get().onImeParentChanged());
        } else if (mImeControlTarget != null && mImeControlTarget == mImeLayeringTarget) {
            // Even if the IME surface parent is not changed, the layer target belonging to the
            // parent may have changes. Then attempt to reassign if the IME control target is
            // possible to be the relative layer.
            final SurfaceControl lastRelativeLayer = mImeWindowsContainer.getLastRelativeLayer();
            if (lastRelativeLayer != mImeLayeringTarget.mSurfaceControl) {
                assignRelativeLayerForIme(getSyncTransaction(), false /* forceUpdate */);
                if (lastRelativeLayer != mImeWindowsContainer.getLastRelativeLayer()) {
                    scheduleAnimation();
                }
            }
        }
    }

+4 −0
Original line number Diff line number Diff line
@@ -2635,6 +2635,10 @@ class WindowContainer<E extends WindowContainer> extends ConfigurationContainer<
        return mLastLayer;
    }

    SurfaceControl getLastRelativeLayer() {
        return mLastRelativeToLayer;
    }

    protected void setRelativeLayer(Transaction t, SurfaceControl relativeTo, int layer) {
        if (mSurfaceFreezer.hasLeash()) {
            // When the freezer has created animation leash parent for the window, set the layer
+0 −1
Original line number Diff line number Diff line
@@ -448,7 +448,6 @@ public class ZOrderingTests extends WindowTestsBase {
        mDisplayContent.updateImeParent();

        // Ime should on top of the popup IME layering target window.
        mDisplayContent.assignChildLayers(mTransaction);
        assertWindowHigher(mImeWindow, popupImeTargetWin);
    }