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

Commit 9c81e63d authored by chaviw's avatar chaviw
Browse files

Move WS insets into WindowFrames

Moved inset values and calculations into WindowFrames. Also used
InsetUtils helper method to calculate inset diffs.

Test: go/winscope
Bug: 111359087
Change-Id: I90d1bd1faa36a08d5c4d7d93bbaae09a244e8ac1
parent 98bb3f5c
Loading
Loading
Loading
Loading
+10 −5
Original line number Diff line number Diff line
@@ -271,7 +271,7 @@ message WindowStateProto {
    optional .android.graphics.RectProto containing_frame = 8 [deprecated=true];
    optional .android.graphics.RectProto parent_frame = 9 [deprecated=true];
    optional .android.graphics.RectProto content_frame = 10 [deprecated=true];
    optional .android.graphics.RectProto content_insets = 11;
    optional .android.graphics.RectProto content_insets = 11 [deprecated=true];
    optional .android.graphics.RectProto surface_insets = 12;
    optional WindowStateAnimatorProto animator = 13;
    optional bool animating_exit = 14;
@@ -288,10 +288,10 @@ message WindowStateProto {
    optional .android.graphics.RectProto visible_frame = 26 [deprecated=true];
    optional .android.graphics.RectProto decor_frame = 27 [deprecated=true];
    optional .android.graphics.RectProto outset_frame = 28 [deprecated=true];
    optional .android.graphics.RectProto overscan_insets = 29;
    optional .android.graphics.RectProto visible_insets = 30;
    optional .android.graphics.RectProto stable_insets = 31;
    optional .android.graphics.RectProto outsets = 32;
    optional .android.graphics.RectProto overscan_insets = 29 [deprecated=true];
    optional .android.graphics.RectProto visible_insets = 30 [deprecated=true];
    optional .android.graphics.RectProto stable_insets = 31 [deprecated=true];
    optional .android.graphics.RectProto outsets = 32 [deprecated=true];
    optional .android.view.DisplayCutoutProto cutout = 33 [deprecated=true];
    optional bool remove_on_exit = 34;
    optional bool destroying = 35;
@@ -380,4 +380,9 @@ message WindowFramesProto {
    optional .android.graphics.RectProto parent_frame = 8;
    optional .android.graphics.RectProto visible_frame = 9;
    optional .android.view.DisplayCutoutProto cutout = 10;
    optional .android.graphics.RectProto content_insets = 11;
    optional .android.graphics.RectProto overscan_insets = 12;
    optional .android.graphics.RectProto visible_insets = 13;
    optional .android.graphics.RectProto stable_insets = 14;
    optional .android.graphics.RectProto outsets = 15;
}
+22 −23
Original line number Diff line number Diff line
@@ -32,29 +32,11 @@ import static android.view.WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED;
import static android.view.WindowManager.LayoutParams.TYPE_APPLICATION;
import static android.view.WindowManager.LayoutParams.TYPE_APPLICATION_STARTING;
import static android.view.WindowManager.LayoutParams.TYPE_BASE_APPLICATION;

import static android.view.WindowManager.TRANSIT_UNSET;
import static android.view.WindowManager.TRANSIT_WALLPAPER_OPEN;

import static com.android.server.policy.WindowManagerPolicy.FINISH_LAYOUT_REDO_ANIM;
import static com.android.server.policy.WindowManagerPolicy.FINISH_LAYOUT_REDO_WALLPAPER;
import static android.view.WindowManager.TRANSIT_UNSET;

import static com.android.server.wm.WindowManagerDebugConfig.DEBUG_ADD_REMOVE;
import static com.android.server.wm.WindowManagerDebugConfig.DEBUG_ANIM;
import static com.android.server.wm.WindowManagerDebugConfig.DEBUG_APP_TRANSITIONS;
import static com.android.server.wm.WindowManagerDebugConfig.DEBUG_FOCUS_LIGHT;
import static com.android.server.wm.WindowManagerDebugConfig.DEBUG_LAYOUT_REPEATS;
import static com.android.server.wm.WindowManagerDebugConfig.DEBUG_ORIENTATION;
import static com.android.server.wm.WindowManagerDebugConfig.DEBUG_STARTING_WINDOW;
import static com.android.server.wm.WindowManagerDebugConfig.DEBUG_STARTING_WINDOW_VERBOSE;
import static com.android.server.wm.WindowManagerDebugConfig.DEBUG_TOKEN_MOVEMENT;
import static com.android.server.wm.WindowManagerDebugConfig.DEBUG_VISIBILITY;
import static com.android.server.wm.WindowManagerDebugConfig.DEBUG_WINDOW_MOVEMENT;
import static com.android.server.wm.WindowManagerDebugConfig.TAG_WITH_CLASS_NAME;
import static com.android.server.wm.WindowManagerDebugConfig.TAG_WM;
import static com.android.server.wm.WindowManagerService.H.NOTIFY_ACTIVITY_DRAWN;
import static com.android.server.wm.WindowManagerService.UPDATE_FOCUS_NORMAL;
import static com.android.server.wm.WindowManagerService.UPDATE_FOCUS_WILL_PLACE_SURFACES;
import static com.android.server.wm.WindowManagerService.logWithStack;
import static com.android.server.wm.AppWindowTokenProto.ALL_DRAWN;
import static com.android.server.wm.AppWindowTokenProto.APP_STOPPED;
import static com.android.server.wm.AppWindowTokenProto.CLIENT_HIDDEN;
@@ -78,6 +60,23 @@ import static com.android.server.wm.AppWindowTokenProto.STARTING_MOVED;
import static com.android.server.wm.AppWindowTokenProto.STARTING_WINDOW;
import static com.android.server.wm.AppWindowTokenProto.THUMBNAIL;
import static com.android.server.wm.AppWindowTokenProto.WINDOW_TOKEN;
import static com.android.server.wm.WindowManagerDebugConfig.DEBUG_ADD_REMOVE;
import static com.android.server.wm.WindowManagerDebugConfig.DEBUG_ANIM;
import static com.android.server.wm.WindowManagerDebugConfig.DEBUG_APP_TRANSITIONS;
import static com.android.server.wm.WindowManagerDebugConfig.DEBUG_FOCUS_LIGHT;
import static com.android.server.wm.WindowManagerDebugConfig.DEBUG_LAYOUT_REPEATS;
import static com.android.server.wm.WindowManagerDebugConfig.DEBUG_ORIENTATION;
import static com.android.server.wm.WindowManagerDebugConfig.DEBUG_STARTING_WINDOW;
import static com.android.server.wm.WindowManagerDebugConfig.DEBUG_STARTING_WINDOW_VERBOSE;
import static com.android.server.wm.WindowManagerDebugConfig.DEBUG_TOKEN_MOVEMENT;
import static com.android.server.wm.WindowManagerDebugConfig.DEBUG_VISIBILITY;
import static com.android.server.wm.WindowManagerDebugConfig.DEBUG_WINDOW_MOVEMENT;
import static com.android.server.wm.WindowManagerDebugConfig.TAG_WITH_CLASS_NAME;
import static com.android.server.wm.WindowManagerDebugConfig.TAG_WM;
import static com.android.server.wm.WindowManagerService.H.NOTIFY_ACTIVITY_DRAWN;
import static com.android.server.wm.WindowManagerService.UPDATE_FOCUS_NORMAL;
import static com.android.server.wm.WindowManagerService.UPDATE_FOCUS_WILL_PLACE_SURFACES;
import static com.android.server.wm.WindowManagerService.logWithStack;
import static com.android.server.wm.WindowStateAnimator.STACK_CLIP_AFTER_ANIM;

import android.annotation.CallSuper;
@@ -1845,8 +1844,8 @@ class AppWindowToken extends WindowToken implements WindowManagerService.AppFree
            surfaceInsets = win.getAttrs().surfaceInsets;
            // XXX(b/72757033): These are insets relative to the window frame, but we're really
            // interested in the insets relative to the frame we chose in the if-blocks above.
            insets.set(win.mContentInsets);
            stableInsets.set(win.mStableInsets);
            win.getContentInsets(insets);
            win.getStableInsets(stableInsets);
        }

        if (mLaunchTaskBehind) {
@@ -2099,7 +2098,7 @@ class AppWindowToken extends WindowToken implements WindowManagerService.AppFree
        WindowState win = findMainWindow();
        Rect appRect = win != null ? win.getContentFrameLw() :
                new Rect(0, 0, displayInfo.appWidth, displayInfo.appHeight);
        Rect insets = win != null ? win.mContentInsets : null;
        final Rect insets = win != null ? win.getContentInsets() : null;
        final Configuration displayConfig = mDisplayContent.getConfiguration();
        return mService.mAppTransition.createThumbnailAspectScaleAnimationLocked(
                appRect, insets, thumbnailHeader, getTask().mTaskId, displayConfig.uiMode,
+1 −1
Original line number Diff line number Diff line
@@ -3009,7 +3009,7 @@ class DisplayContent extends WindowContainer<DisplayContent.DisplayChildWindowCo
            if (w.isVisibleLw() && (w.mAppToken != null || keyguard)) {
                w.mWinAnimator.mDrawState = DRAW_PENDING;
                // Force add to mResizingWindows.
                w.mLastContentInsets.set(-1, -1, -1, -1);
                w.resetLastContentInsets();
                mService.mWaitingForDrawn.add(w);
            }
        }, true /* traverseTopToBottom */);
+3 −2
Original line number Diff line number Diff line
@@ -373,7 +373,7 @@ public class RecentsAnimationController implements DeathRecipient {
                            : null;
            final Rect contentInsets;
            if (mTargetAppToken != null && mTargetAppToken.findMainWindow() != null) {
                contentInsets = mTargetAppToken.findMainWindow().mContentInsets;
                contentInsets = mTargetAppToken.findMainWindow().getContentInsets();
            } else {
                // If the window for the activity had not yet been created, use the display insets.
                mService.getStableInsets(mDisplayId, mTmpRect);
@@ -583,7 +583,8 @@ public class RecentsAnimationController implements DeathRecipient {
            if (mainWindow == null) {
                return null;
            }
            final Rect insets = new Rect(mainWindow.mContentInsets);
            final Rect insets = new Rect();
            mainWindow.getContentInsets(insets);
            InsetUtils.addInsets(insets, mainWindow.mAppToken.getLetterboxInsets());
            mTarget = new RemoteAnimationTarget(mTask.mTaskId, MODE_CLOSING, mCapturedLeash,
                    !topApp.fillsParent(), mainWindow.mWinAnimator.mLastClipRect,
+2 −1
Original line number Diff line number Diff line
@@ -305,7 +305,8 @@ class RemoteAnimationController implements DeathRecipient {
                    || mCapturedLeash == null) {
                return null;
            }
            final Rect insets = new Rect(mainWindow.mContentInsets);
            final Rect insets = new Rect();
            mainWindow.getContentInsets(insets);
            InsetUtils.addInsets(insets, mAppWindowToken.getLetterboxInsets());
            mTarget = new RemoteAnimationTarget(task.mTaskId, getMode(),
                    mCapturedLeash, !mAppWindowToken.fillsParent(),
Loading