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

Commit ffce58bb authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Polish IME insets not provided for non-IME target in split-screen"

parents d31d5486 a61b3ca0
Loading
Loading
Loading
Loading
+1 −8
Original line number Diff line number Diff line
@@ -727,6 +727,7 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A
    /**
     * When set to true, the IME insets will be frozen until the next app becomes IME input target.
     * @see InsetsPolicy#adjustVisibilityForIme
     * @see ImeInsetsSourceProvider#updateClientVisibility
     */
    boolean mImeInsetsFrozenUntilStartInput;

@@ -1576,7 +1577,6 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A
        if (newParent != null) {
            if (isState(RESUMED)) {
                newParent.setResumedActivity(this, "onParentChanged");
                mImeInsetsFrozenUntilStartInput = false;
            }
            mLetterboxUiController.onActivityParentChanged(newParent);
        }
@@ -8874,13 +8874,6 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A
        }
    }

    @Override
    void onResize() {
        // Reset freezing IME insets flag when the activity resized.
        mImeInsetsFrozenUntilStartInput = false;
        super.onResize();
    }

    private boolean applyAspectRatio(Rect outBounds, Rect containingAppBounds,
            Rect containingBounds) {
        return applyAspectRatio(outBounds, containingAppBounds, containingBounds,
+28 −4
Original line number Diff line number Diff line
@@ -4509,11 +4509,35 @@ class DisplayContent extends RootDisplayArea implements WindowManagerPolicy.Disp
                            mImeWindowsContainer.getParent().mSurfaceControl));
            updateImeControlTarget(forceUpdateImeParent);
        }
        // Unfreeze IME insets after the new target updated, in case updateAboveInsetsState may
        // deliver unrelated IME insets change to the non-IME requester.
        if (target != null) {
            target.unfreezeInsetsAfterStartInput();
    }

    /**
     * Callback from {@link ImeInsetsSourceProvider#updateClientVisibility} for the system to
     * judge whether or not to notify the IME insets provider to dispatch this reported IME client
     * visibility state to the app clients when needed.
     */
    boolean onImeInsetsClientVisibilityUpdate() {
        boolean[] changed = new boolean[1];

        // Unlike the IME layering target or the control target can be updated during the layout
        // change, the IME input target requires to be changed after gaining the input focus.
        // In case unfreezing IME insets state may too early during IME focus switching, we unfreeze
        // when activities going to be visible until the input target changed, or the
        // activity was the current input target that has to unfreeze after updating the IME
        // client visibility.
        final ActivityRecord inputTargetActivity =
                mImeInputTarget != null ? mImeInputTarget.getActivityRecord() : null;
        final boolean targetChanged = mImeInputTarget != mLastImeInputTarget;
        if (targetChanged || inputTargetActivity != null && inputTargetActivity.isVisibleRequested()
                && inputTargetActivity.mImeInsetsFrozenUntilStartInput) {
            forAllActivities(r -> {
                if (r.mImeInsetsFrozenUntilStartInput && r.isVisibleRequested()) {
                    r.mImeInsetsFrozenUntilStartInput = false;
                    changed[0] = true;
                }
            });
        }
        return changed[0];
    }

    void updateImeControlTarget() {
+0 −4
Original line number Diff line number Diff line
@@ -334,10 +334,6 @@ class EmbeddedWindowController {
            return true;
        }

        @Override
        public void unfreezeInsetsAfterStartInput() {
        }

        @Override
        public InsetsControlTarget getImeControlTarget() {
            return mWmService.getDefaultDisplayContentLocked().mRemoteInsetsControlTarget;
+4 −0
Original line number Diff line number Diff line
@@ -140,10 +140,14 @@ final class ImeInsetsSourceProvider extends WindowContainerInsetsSourceProvider

    @Override
    protected boolean updateClientVisibility(InsetsControlTarget caller) {
        if (caller != getControlTarget()) {
            return false;
        }
        boolean changed = super.updateClientVisibility(caller);
        if (changed && caller.isRequestedVisible(mSource.getType())) {
            reportImeDrawnForOrganizer(caller);
        }
        changed |= mDisplayContent.onImeInsetsClientVisibilityUpdate();
        return changed;
    }

+1 −2
Original line number Diff line number Diff line
@@ -16,8 +16,8 @@

package com.android.server.wm;

import android.view.IWindow;
import android.util.proto.ProtoOutputStream;
import android.view.IWindow;

/**
 * Common interface between focusable objects.
@@ -58,7 +58,6 @@ interface InputTarget {
    boolean canScreenshotIme();

    ActivityRecord getActivityRecord();
    void unfreezeInsetsAfterStartInput();

    boolean isInputMethodClientFocus(int uid, int pid);

Loading