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

Commit 4ec0def3 authored by Robert Carr's avatar Robert Carr
Browse files

Nuke WindowState#mShownPosition. Rework mXOffset/mYOffset.

Ignoring Wallpaper Offsets, the WindowStateAnimator is now
always positioned at (0,0), so we don't need to calculate or store this. For
Wallpaper Offsets we can manipulate the position of the WindowStateAnimator surface
directly. This seems to be a nice level to model the concept of scrolling a buffer
larger than the "Window" to which it is assigned.
Everything on top of WSA can ignore the offsets by only interacting with the WS and above.

Test: Manual. go/wm-smoke
Change-Id: I631ad97bb07b092e795c9530ca34139ccc3e0af7
parent 850f29a1
Loading
Loading
Loading
Loading
+0 −1
Original line number Diff line number Diff line
@@ -295,7 +295,6 @@ message WindowStateProto {
  optional bool animating_exit = 14;
  repeated WindowStateProto child_windows = 15;
  optional .android.graphics.RectProto surface_position = 16;
  optional .android.graphics.RectProto shown_position = 17;
  optional int32 requested_width = 18;
  optional int32 requested_height = 19;
  optional int32 view_visibility = 20;
+1 −3
Original line number Diff line number Diff line
@@ -5603,9 +5603,7 @@ public class PhoneWindowManager implements WindowManagerPolicy {
        final int fl = PolicyControl.getWindowFlags(null,
                mTopFullscreenOpaqueWindowState.getAttrs());
        if (localLOGV) {
            Slog.d(TAG, "frame: " + mTopFullscreenOpaqueWindowState.getFrameLw()
                    + " shown position: "
                    + mTopFullscreenOpaqueWindowState.getShownPositionLw());
            Slog.d(TAG, "frame: " + mTopFullscreenOpaqueWindowState.getFrameLw());
            Slog.d(TAG, "attr: " + mTopFullscreenOpaqueWindowState.getAttrs()
                    + " lp.flags=0x" + Integer.toHexString(fl));
        }
+0 −8
Original line number Diff line number Diff line
@@ -231,14 +231,6 @@ public interface WindowManagerPolicy extends WindowManagerPolicyConstants {
         */
        public Rect getFrameLw();

        /**
         * Retrieve the current position of the window that is actually shown.
         * Must be called with the window manager lock held.
         *
         * @return Point The point holding the shown window position.
         */
        public Point getShownPositionLw();

        /**
         * Retrieve the frame of the display that this window was last
         * laid out in.  Must be called with the
+8 −10
Original line number Diff line number Diff line
@@ -272,6 +272,8 @@ class WallpaperController {
    }

    boolean updateWallpaperOffset(WindowState wallpaperWin, int dw, int dh, boolean sync) {
        int xOffset = 0;
        int yOffset = 0;
        boolean rawChanged = false;
        // Set the default wallpaper x-offset to either edge of the screen (depending on RTL), to
        // match the behavior of most Launchers
@@ -283,11 +285,8 @@ class WallpaperController {
        if (mLastWallpaperDisplayOffsetX != Integer.MIN_VALUE) {
            offset += mLastWallpaperDisplayOffsetX;
        }
        boolean changed = wallpaperWin.mXOffset != offset;
        if (changed) {
            if (DEBUG_WALLPAPER) Slog.v(TAG, "Update wallpaper " + wallpaperWin + " x: " + offset);
            wallpaperWin.mXOffset = offset;
        }
        xOffset = offset;

        if (wallpaperWin.mWallpaperX != wpx || wallpaperWin.mWallpaperXStep != wpxs) {
            wallpaperWin.mWallpaperX = wpx;
            wallpaperWin.mWallpaperXStep = wpxs;
@@ -301,17 +300,16 @@ class WallpaperController {
        if (mLastWallpaperDisplayOffsetY != Integer.MIN_VALUE) {
            offset += mLastWallpaperDisplayOffsetY;
        }
        if (wallpaperWin.mYOffset != offset) {
            if (DEBUG_WALLPAPER) Slog.v(TAG, "Update wallpaper " + wallpaperWin + " y: " + offset);
            changed = true;
            wallpaperWin.mYOffset = offset;
        }
        yOffset = offset;

        if (wallpaperWin.mWallpaperY != wpy || wallpaperWin.mWallpaperYStep != wpys) {
            wallpaperWin.mWallpaperY = wpy;
            wallpaperWin.mWallpaperYStep = wpys;
            rawChanged = true;
        }

        boolean changed = wallpaperWin.mWinAnimator.setWallpaperOffset(xOffset, yOffset);

        if (rawChanged && (wallpaperWin.mAttrs.privateFlags &
                WindowManager.LayoutParams.PRIVATE_FLAG_WANTS_OFFSET_NOTIFICATIONS) != 0) {
            try {
+0 −4
Original line number Diff line number Diff line
@@ -74,10 +74,6 @@ class WallpaperWindowToken extends WindowToken {
        for (int wallpaperNdx = mChildren.size() - 1; wallpaperNdx >= 0; wallpaperNdx--) {
            final WindowState wallpaper = mChildren.get(wallpaperNdx);
            if (wallpaperController.updateWallpaperOffset(wallpaper, dw, dh, sync)) {
                final WindowStateAnimator winAnimator = wallpaper.mWinAnimator;
                winAnimator.computeShownFrameLocked();
                // No need to lay out the windows - we can just set the wallpaper position directly.
                winAnimator.setWallpaperOffset(wallpaper.mShownPosition);
                // We only want to be synchronous with one wallpaper.
                sync = false;
            }
Loading