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

Commit f9c81497 authored by Wale Ogunwale's avatar Wale Ogunwale
Browse files

Account for IME and screen decors when laying out a resized window.

* Adjust position of target IME resized window if it is been obscured
by the IME.
* Make sure resized window frame is within content frame so it doesn't
extend to the screen decoration regions.

Bug: 19424276
Bug: 19500488
Change-Id: I561338101697e10ea5072ee65a180dd0155d0da4
parent 47ed3195
Loading
Loading
Loading
Loading
+0 −6
Original line number Diff line number Diff line
@@ -93,10 +93,6 @@ public class TaskStack {
    // stack bounds once the stack is no longer forced to fullscreen.
    final private Rect mPreForceFullscreenBounds;

    // When true this stack is at the top of the screen and should be layed out to extend under
    // the status bar.
    boolean mUnderStatusBar;

    // Device rotation as of the last time {@link #mBounds} was set.
    int mRotation;

@@ -106,7 +102,6 @@ public class TaskStack {
        mOverrideConfig = Configuration.EMPTY;
        mForceFullscreen = false;
        mPreForceFullscreenBounds = new Rect();
        mUnderStatusBar = true;
        // TODO: remove bounds from log, they are always 0.
        EventLog.writeEvent(EventLogTags.WM_STACK_CREATED, stackId, mBounds.left, mBounds.top,
                mBounds.right, mBounds.bottom);
@@ -165,7 +160,6 @@ public class TaskStack {
        mDimLayer.setBounds(bounds);
        mAnimationBackgroundSurface.setBounds(bounds);
        mBounds.set(bounds);
        mUnderStatusBar = (mBounds.top == 0);
        mRotation = rotation;
        updateOverrideConfiguration();
        return true;
+17 −11
Original line number Diff line number Diff line
@@ -16,21 +16,21 @@

package com.android.server.wm;

import static com.android.server.wm.WindowManagerService.DEBUG_CONFIGURATION;
import static com.android.server.wm.WindowManagerService.DEBUG_LAYOUT;
import static com.android.server.wm.WindowManagerService.DEBUG_ORIENTATION;
import static com.android.server.wm.WindowManagerService.DEBUG_POWER;
import static com.android.server.wm.WindowManagerService.DEBUG_RESIZE;
import static com.android.server.wm.WindowManagerService.DEBUG_VISIBILITY;
import static android.view.WindowManager.LayoutParams.FIRST_SUB_WINDOW;
import static android.view.WindowManager.LayoutParams.PRIVATE_FLAG_KEYGUARD;
import static android.view.WindowManager.LayoutParams.PRIVATE_FLAG_COMPATIBLE_WINDOW;
import static android.view.WindowManager.LayoutParams.LAST_SUB_WINDOW;
import static android.view.WindowManager.LayoutParams.PRIVATE_FLAG_COMPATIBLE_WINDOW;
import static android.view.WindowManager.LayoutParams.PRIVATE_FLAG_NO_MOVE_ANIMATION;
import static android.view.WindowManager.LayoutParams.PRIVATE_FLAG_KEYGUARD;
import static android.view.WindowManager.LayoutParams.TYPE_APPLICATION_STARTING;
import static android.view.WindowManager.LayoutParams.TYPE_INPUT_METHOD;
import static android.view.WindowManager.LayoutParams.TYPE_INPUT_METHOD_DIALOG;
import static android.view.WindowManager.LayoutParams.TYPE_APPLICATION_STARTING;
import static android.view.WindowManager.LayoutParams.TYPE_WALLPAPER;
import static com.android.server.wm.WindowManagerService.DEBUG_CONFIGURATION;
import static com.android.server.wm.WindowManagerService.DEBUG_LAYOUT;
import static com.android.server.wm.WindowManagerService.DEBUG_ORIENTATION;
import static com.android.server.wm.WindowManagerService.DEBUG_POWER;
import static com.android.server.wm.WindowManagerService.DEBUG_RESIZE;
import static com.android.server.wm.WindowManagerService.DEBUG_VISIBILITY;

import android.app.AppOpsManager;
import android.os.Debug;
@@ -519,9 +519,15 @@ final class WindowState implements WindowManagerPolicy.WindowState {
        TaskStack stack = mAppToken != null ? getStack() : null;
        if (stack != null && !stack.isFullscreen()) {
            stack.getBounds(mContainingFrame);
            if (stack.mUnderStatusBar) {
                mContainingFrame.top = pf.top;
            }
            final WindowState imeWin = mService.mInputMethodWindow;
            if (imeWin != null && imeWin.isVisibleNow() && mService.mInputMethodTarget == this
                    && mContainingFrame.bottom > cf.bottom) {
                // IME is up and obscuring this window. Adjust the window position so it is visible.
                mContainingFrame.top -= mContainingFrame.bottom - cf.bottom;
            }
            // Make sure the containing frame is within the content frame so we don't layout
            // resized window under screen decorations.
            mContainingFrame.intersect(cf);
            mDisplayFrame.set(mContainingFrame);
        } else {
            mContainingFrame.set(pf);