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

Commit 617e1431 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Automerger Merge Worker
Browse files

Merge "Check resolved override bounds for attaching IME to activity" into...

Merge "Check resolved override bounds for attaching IME to activity" into rvc-dev am: 4e11c244 am: cbab1a34

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/11881940

Change-Id: Iaca4eaa648f94ccc847da3574a0dc9d18397b5e1
parents 646c9ed6 cbab1a34
Loading
Loading
Loading
Loading
+6 −5
Original line number Original line Diff line number Diff line
@@ -6456,14 +6456,15 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A


    @Override
    @Override
    public boolean matchParentBounds() {
    public boolean matchParentBounds() {
        if (super.matchParentBounds() && mCompatDisplayInsets == null) {
        final Rect overrideBounds = getResolvedOverrideBounds();
        if (overrideBounds.isEmpty()) {
            return true;
            return true;
        }
        }
        // An activity in size compatibility mode may have resolved override bounds, so the exact
        // An activity in size compatibility mode may have override bounds which equals to its
        // bounds should also be checked. Otherwise IME window will show with offset. See
        // parent bounds, so the exact bounds should also be checked to allow IME window to attach
        // {@link DisplayContent#isImeAttachedToApp}.
        // to the activity. See {@link DisplayContent#isImeAttachedToApp}.
        final WindowContainer parent = getParent();
        final WindowContainer parent = getParent();
        return parent == null || parent.getBounds().equals(getResolvedOverrideBounds());
        return parent == null || parent.getBounds().equals(overrideBounds);
    }
    }


    @Override
    @Override
+7 −0
Original line number Original line Diff line number Diff line
@@ -251,6 +251,13 @@ public class SizeCompatTests extends ActivityTestsBase {
        mActivity.mDisplayContent.mInputMethodTarget = addWindowToActivity(mActivity);
        mActivity.mDisplayContent.mInputMethodTarget = addWindowToActivity(mActivity);
        // Make sure IME cannot attach to the app, otherwise IME window will also be shifted.
        // Make sure IME cannot attach to the app, otherwise IME window will also be shifted.
        assertFalse(mActivity.mDisplayContent.isImeAttachedToApp());
        assertFalse(mActivity.mDisplayContent.isImeAttachedToApp());

        // Recompute the natural configuration without resolving size compat configuration.
        mActivity.clearSizeCompatMode();
        mActivity.onConfigurationChanged(mTask.getConfiguration());
        // It should keep non-attachable because the resolved bounds will be computed according to
        // the aspect ratio that won't match its parent bounds.
        assertFalse(mActivity.mDisplayContent.isImeAttachedToApp());
    }
    }


    @Test
    @Test