diff options
author | Jorim Jaggi <jjaggi@google.com> | 2019-10-24 16:24:54 +0200 |
---|---|---|
committer | Jorim Jaggi <jjaggi@google.com> | 2019-11-12 17:49:51 +0100 |
commit | f081f06a4808291b72cb31f641ea4deed0b61e18 (patch) | |
tree | 0051f348745dd7a847a133ab3cd8c50f525c3c5b | |
parent | 379f81b2e98a38c445b8a259b8ce059fc4c40ba9 (diff) |
Kill overscan insets and outsets
Also remove WindowManagerStressTest because that has been replaced
with proper perf test.
Test: Boots
Bug: 143255833
Change-Id: I1d293cda7c82d0aa1c3a6cc694c74bf7d10cc974
51 files changed, 168 insertions, 1383 deletions
diff --git a/apct-tests/perftests/core/src/android/wm/RelayoutPerfTest.java b/apct-tests/perftests/core/src/android/wm/RelayoutPerfTest.java index f43bdf8348ea..f32bf9a4b9e6 100644 --- a/apct-tests/perftests/core/src/android/wm/RelayoutPerfTest.java +++ b/apct-tests/perftests/core/src/android/wm/RelayoutPerfTest.java @@ -111,11 +111,9 @@ public class RelayoutPerfTest extends WindowManagerPerfTestBase { private static class RelayoutRunner { final Rect mOutFrame = new Rect(); - final Rect mOutOverscanInsets = new Rect(); final Rect mOutContentInsets = new Rect(); final Rect mOutVisibleInsets = new Rect(); final Rect mOutStableInsets = new Rect(); - final Rect mOutOutsets = new Rect(); final Rect mOutBackDropFrame = new Rect(); final DisplayCutout.ParcelableWrapper mOutDisplayCutout = new DisplayCutout.ParcelableWrapper(DisplayCutout.NO_CUTOUT); @@ -149,8 +147,8 @@ public class RelayoutPerfTest extends WindowManagerPerfTestBase { while (state.keepRunning()) { session.relayout(mWindow, mSeq, mParams, mWidth, mHeight, mViewVisibility.getAsInt(), mFlags, mFrameNumber, mOutFrame, - mOutOverscanInsets, mOutContentInsets, mOutVisibleInsets, mOutStableInsets, - mOutOutsets, mOutBackDropFrame, mOutDisplayCutout, mOutMergedConfiguration, + mOutContentInsets, mOutVisibleInsets, mOutStableInsets, + mOutBackDropFrame, mOutDisplayCutout, mOutMergedConfiguration, mOutSurfaceControl, mOutInsetsState); } } diff --git a/apct-tests/perftests/core/src/android/wm/WindowAddRemovePerfTest.java b/apct-tests/perftests/core/src/android/wm/WindowAddRemovePerfTest.java index 27790e649a26..82eb97be54bd 100644 --- a/apct-tests/perftests/core/src/android/wm/WindowAddRemovePerfTest.java +++ b/apct-tests/perftests/core/src/android/wm/WindowAddRemovePerfTest.java @@ -70,7 +70,6 @@ public class WindowAddRemovePerfTest extends WindowManagerPerfTestBase { final Rect mOutFrame = new Rect(); final Rect mOutContentInsets = new Rect(); final Rect mOutStableInsets = new Rect(); - final Rect mOutOutsets = new Rect(); final DisplayCutout.ParcelableWrapper mOutDisplayCutout = new DisplayCutout.ParcelableWrapper(); final InsetsState mOutInsetsState = new InsetsState(); @@ -92,7 +91,7 @@ public class WindowAddRemovePerfTest extends WindowManagerPerfTestBase { long startTime = SystemClock.elapsedRealtimeNanos(); session.addToDisplay(this, mSeq, mLayoutParams, View.VISIBLE, Display.DEFAULT_DISPLAY, mOutFrame, mOutContentInsets, mOutStableInsets, - mOutOutsets, mOutDisplayCutout, inputChannel, mOutInsetsState); + mOutDisplayCutout, inputChannel, mOutInsetsState); final long elapsedTimeNsOfAdd = SystemClock.elapsedRealtimeNanos() - startTime; state.addExtraResult("add", elapsedTimeNsOfAdd); diff --git a/api/current.txt b/api/current.txt index d6f785f0cb53..be7688fd21bf 100644 --- a/api/current.txt +++ b/api/current.txt @@ -1597,7 +1597,7 @@ package android { field public static final int windowMinWidthMinor = 16843607; // 0x1010357 field public static final int windowNoDisplay = 16843294; // 0x101021e field public static final int windowNoTitle = 16842838; // 0x1010056 - field public static final int windowOverscan = 16843727; // 0x10103cf + field @Deprecated public static final int windowOverscan = 16843727; // 0x10103cf field public static final int windowReenterTransition = 16843951; // 0x10104af field public static final int windowReturnTransition = 16843950; // 0x10104ae field public static final int windowSharedElementEnterTransition = 16843833; // 0x1010439 @@ -2324,13 +2324,13 @@ package android { field public static final int Theme_Material_Light_LightStatusBar = 16974549; // 0x10302d5 field public static final int Theme_Material_Light_NoActionBar = 16974401; // 0x1030241 field public static final int Theme_Material_Light_NoActionBar_Fullscreen = 16974402; // 0x1030242 - field public static final int Theme_Material_Light_NoActionBar_Overscan = 16974403; // 0x1030243 + field @Deprecated public static final int Theme_Material_Light_NoActionBar_Overscan = 16974403; // 0x1030243 field public static final int Theme_Material_Light_NoActionBar_TranslucentDecor = 16974404; // 0x1030244 field public static final int Theme_Material_Light_Panel = 16974405; // 0x1030245 field public static final int Theme_Material_Light_Voice = 16974406; // 0x1030246 field public static final int Theme_Material_NoActionBar = 16974382; // 0x103022e field public static final int Theme_Material_NoActionBar_Fullscreen = 16974383; // 0x103022f - field public static final int Theme_Material_NoActionBar_Overscan = 16974384; // 0x1030230 + field @Deprecated public static final int Theme_Material_NoActionBar_Overscan = 16974384; // 0x1030230 field public static final int Theme_Material_NoActionBar_TranslucentDecor = 16974385; // 0x1030231 field public static final int Theme_Material_Panel = 16974386; // 0x1030232 field public static final int Theme_Material_Settings = 16974387; // 0x1030233 @@ -52255,7 +52255,7 @@ package android.view { field public static final int FLAG_KEEP_SCREEN_ON = 128; // 0x80 field public static final int FLAG_LAYOUT_ATTACHED_IN_DECOR = 1073741824; // 0x40000000 field public static final int FLAG_LAYOUT_INSET_DECOR = 65536; // 0x10000 - field public static final int FLAG_LAYOUT_IN_OVERSCAN = 33554432; // 0x2000000 + field @Deprecated public static final int FLAG_LAYOUT_IN_OVERSCAN = 33554432; // 0x2000000 field public static final int FLAG_LAYOUT_IN_SCREEN = 256; // 0x100 field public static final int FLAG_LAYOUT_NO_LIMITS = 512; // 0x200 field public static final int FLAG_LOCAL_FOCUS_MODE = 268435456; // 0x10000000 diff --git a/core/java/android/service/wallpaper/WallpaperService.java b/core/java/android/service/wallpaper/WallpaperService.java index e784ad3e3188..d5c67668b88e 100644 --- a/core/java/android/service/wallpaper/WallpaperService.java +++ b/core/java/android/service/wallpaper/WallpaperService.java @@ -176,14 +176,10 @@ public abstract class WallpaperService extends Service { int mCurWindowPrivateFlags = mWindowPrivateFlags; final Rect mVisibleInsets = new Rect(); final Rect mWinFrame = new Rect(); - final Rect mOverscanInsets = new Rect(); final Rect mContentInsets = new Rect(); final Rect mStableInsets = new Rect(); - final Rect mOutsets = new Rect(); - final Rect mDispatchedOverscanInsets = new Rect(); final Rect mDispatchedContentInsets = new Rect(); final Rect mDispatchedStableInsets = new Rect(); - final Rect mDispatchedOutsets = new Rect(); final Rect mFinalSystemInsets = new Rect(); final Rect mFinalStableInsets = new Rect(); final Rect mBackdropFrame = new Rect(); @@ -317,13 +313,13 @@ public abstract class WallpaperService extends Service { final BaseIWindow mWindow = new BaseIWindow() { @Override - public void resized(Rect frame, Rect overscanInsets, Rect contentInsets, - Rect visibleInsets, Rect stableInsets, Rect outsets, boolean reportDraw, + public void resized(Rect frame, Rect contentInsets, + Rect visibleInsets, Rect stableInsets, boolean reportDraw, MergedConfiguration mergedConfiguration, Rect backDropRect, boolean forceLayout, boolean alwaysConsumeSystemBars, int displayId, DisplayCutout.ParcelableWrapper displayCutout) { - Message msg = mCaller.obtainMessageIO(MSG_WINDOW_RESIZED, - reportDraw ? 1 : 0, outsets); + Message msg = mCaller.obtainMessageI(MSG_WINDOW_RESIZED, + reportDraw ? 1 : 0); mCaller.sendMessage(msg); } @@ -822,7 +818,7 @@ public abstract class WallpaperService extends Service { if (mSession.addToDisplay(mWindow, mWindow.mSeq, mLayout, View.VISIBLE, mDisplay.getDisplayId(), mWinFrame, mContentInsets, mStableInsets, - mOutsets, mDisplayCutout, inputChannel, + mDisplayCutout, inputChannel, mInsetsState) < 0) { Log.w(TAG, "Failed to add window while updating wallpaper surface."); return; @@ -838,17 +834,13 @@ public abstract class WallpaperService extends Service { if (!fixedSize) { mLayout.surfaceInsets.set(mIWallpaperEngine.mDisplayPadding); - mLayout.surfaceInsets.left += mOutsets.left; - mLayout.surfaceInsets.top += mOutsets.top; - mLayout.surfaceInsets.right += mOutsets.right; - mLayout.surfaceInsets.bottom += mOutsets.bottom; } else { mLayout.surfaceInsets.set(0, 0, 0, 0); } final int relayoutResult = mSession.relayout( mWindow, mWindow.mSeq, mLayout, mWidth, mHeight, - View.VISIBLE, 0, -1, mWinFrame, mOverscanInsets, mContentInsets, - mVisibleInsets, mStableInsets, mOutsets, mBackdropFrame, + View.VISIBLE, 0, -1, mWinFrame, mContentInsets, + mVisibleInsets, mStableInsets, mBackdropFrame, mDisplayCutout, mMergedConfiguration, mSurfaceControl, mInsetsState); if (mSurfaceControl.isValid()) { @@ -864,12 +856,8 @@ public abstract class WallpaperService extends Service { if (!fixedSize) { final Rect padding = mIWallpaperEngine.mDisplayPadding; - w += padding.left + padding.right + mOutsets.left + mOutsets.right; - h += padding.top + padding.bottom + mOutsets.top + mOutsets.bottom; - mOverscanInsets.left += padding.left; - mOverscanInsets.top += padding.top; - mOverscanInsets.right += padding.right; - mOverscanInsets.bottom += padding.bottom; + w += padding.left + padding.right; + h += padding.top + padding.bottom; mContentInsets.left += padding.left; mContentInsets.top += padding.top; mContentInsets.right += padding.right; @@ -898,10 +886,8 @@ public abstract class WallpaperService extends Service { Log.v(TAG, "Wallpaper size has changed: (" + mCurWidth + ", " + mCurHeight); } - insetsChanged |= !mDispatchedOverscanInsets.equals(mOverscanInsets); insetsChanged |= !mDispatchedContentInsets.equals(mContentInsets); insetsChanged |= !mDispatchedStableInsets.equals(mStableInsets); - insetsChanged |= !mDispatchedOutsets.equals(mOutsets); insetsChanged |= !mDispatchedDisplayCutout.equals(mDisplayCutout.get()); mSurfaceHolder.setSurfaceFrameSize(w, h); @@ -961,16 +947,9 @@ public abstract class WallpaperService extends Service { } if (insetsChanged) { - mDispatchedOverscanInsets.set(mOverscanInsets); - mDispatchedOverscanInsets.left += mOutsets.left; - mDispatchedOverscanInsets.top += mOutsets.top; - mDispatchedOverscanInsets.right += mOutsets.right; - mDispatchedOverscanInsets.bottom += mOutsets.bottom; mDispatchedContentInsets.set(mContentInsets); mDispatchedStableInsets.set(mStableInsets); - mDispatchedOutsets.set(mOutsets); mDispatchedDisplayCutout = mDisplayCutout.get(); - mFinalSystemInsets.set(mDispatchedOverscanInsets); mFinalStableInsets.set(mDispatchedStableInsets); WindowInsets insets = new WindowInsets(mFinalSystemInsets, mFinalStableInsets, @@ -1457,7 +1436,6 @@ public abstract class WallpaperService extends Service { } break; case MSG_WINDOW_RESIZED: { final boolean reportDraw = message.arg1 != 0; - mEngine.mOutsets.set((Rect) message.obj); mEngine.updateSurface(true, false, reportDraw); mEngine.doOffsetsChanged(true); } break; diff --git a/core/java/android/view/Display.java b/core/java/android/view/Display.java index b3d98b8de0a3..03e68b0058b2 100644 --- a/core/java/android/view/Display.java +++ b/core/java/android/view/Display.java @@ -749,20 +749,6 @@ public final class Display { } /** - * @hide - * Return a rectangle defining the insets of the overscan region of the display. - * Each field of the rectangle is the number of pixels the overscan area extends - * into the display on that side. - */ - public void getOverscanInsets(Rect outRect) { - synchronized (this) { - updateDisplayInfoLocked(); - outRect.set(mDisplayInfo.overscanLeft, mDisplayInfo.overscanTop, - mDisplayInfo.overscanRight, mDisplayInfo.overscanBottom); - } - } - - /** * Returns the rotation of the screen from its "natural" orientation. * The returned value may be {@link Surface#ROTATION_0 Surface.ROTATION_0} * (no rotation), {@link Surface#ROTATION_90 Surface.ROTATION_90}, diff --git a/core/java/android/view/DisplayInfo.java b/core/java/android/view/DisplayInfo.java index 7e22dd9f0ac8..38baccbc009f 100644 --- a/core/java/android/view/DisplayInfo.java +++ b/core/java/android/view/DisplayInfo.java @@ -136,30 +136,6 @@ public final class DisplayInfo implements Parcelable { public int logicalHeight; /** - * @hide - * Number of overscan pixels on the left side of the display. - */ - public int overscanLeft; - - /** - * @hide - * Number of overscan pixels on the top side of the display. - */ - public int overscanTop; - - /** - * @hide - * Number of overscan pixels on the right side of the display. - */ - public int overscanRight; - - /** - * @hide - * Number of overscan pixels on the bottom side of the display. - */ - public int overscanBottom; - - /** * The {@link DisplayCutout} if present, otherwise {@code null}. * * @hide @@ -322,10 +298,6 @@ public final class DisplayInfo implements Parcelable { && largestNominalAppHeight == other.largestNominalAppHeight && logicalWidth == other.logicalWidth && logicalHeight == other.logicalHeight - && overscanLeft == other.overscanLeft - && overscanTop == other.overscanTop - && overscanRight == other.overscanRight - && overscanBottom == other.overscanBottom && Objects.equals(displayCutout, other.displayCutout) && rotation == other.rotation && modeId == other.modeId @@ -365,10 +337,6 @@ public final class DisplayInfo implements Parcelable { largestNominalAppHeight = other.largestNominalAppHeight; logicalWidth = other.logicalWidth; logicalHeight = other.logicalHeight; - overscanLeft = other.overscanLeft; - overscanTop = other.overscanTop; - overscanRight = other.overscanRight; - overscanBottom = other.overscanBottom; displayCutout = other.displayCutout; rotation = other.rotation; modeId = other.modeId; @@ -404,10 +372,6 @@ public final class DisplayInfo implements Parcelable { largestNominalAppHeight = source.readInt(); logicalWidth = source.readInt(); logicalHeight = source.readInt(); - overscanLeft = source.readInt(); - overscanTop = source.readInt(); - overscanRight = source.readInt(); - overscanBottom = source.readInt(); displayCutout = DisplayCutout.ParcelableWrapper.readCutoutFromParcel(source); rotation = source.readInt(); modeId = source.readInt(); @@ -452,10 +416,6 @@ public final class DisplayInfo implements Parcelable { dest.writeInt(largestNominalAppHeight); dest.writeInt(logicalWidth); dest.writeInt(logicalHeight); - dest.writeInt(overscanLeft); - dest.writeInt(overscanTop); - dest.writeInt(overscanRight); - dest.writeInt(overscanBottom); DisplayCutout.ParcelableWrapper.writeCutoutToParcel(displayCutout, dest, flags); dest.writeInt(rotation); dest.writeInt(modeId); @@ -632,17 +592,6 @@ public final class DisplayInfo implements Parcelable { sb.append(logicalWidth); sb.append(" x "); sb.append(logicalHeight); - if (overscanLeft != 0 || overscanTop != 0 || overscanRight != 0 || overscanBottom != 0) { - sb.append(", overscan ("); - sb.append(overscanLeft); - sb.append(","); - sb.append(overscanTop); - sb.append(","); - sb.append(overscanRight); - sb.append(","); - sb.append(overscanBottom); - sb.append(")"); - } sb.append(", largest app "); sb.append(largestNominalAppWidth); sb.append(" x "); diff --git a/core/java/android/view/IWindow.aidl b/core/java/android/view/IWindow.aidl index 8bf99ec4f251..37b685a23066 100644 --- a/core/java/android/view/IWindow.aidl +++ b/core/java/android/view/IWindow.aidl @@ -51,8 +51,8 @@ oneway interface IWindow { */ void executeCommand(String command, String parameters, in ParcelFileDescriptor descriptor); - void resized(in Rect frame, in Rect overscanInsets, in Rect contentInsets, - in Rect visibleInsets, in Rect stableInsets, in Rect outsets, boolean reportDraw, + void resized(in Rect frame, in Rect contentInsets, + in Rect visibleInsets, in Rect stableInsets, boolean reportDraw, in MergedConfiguration newMergedConfiguration, in Rect backDropFrame, boolean forceLayout, boolean alwaysConsumeSystemBars, int displayId, in DisplayCutout.ParcelableWrapper displayCutout); diff --git a/core/java/android/view/IWindowManager.aidl b/core/java/android/view/IWindowManager.aidl index 7f717a72b0f9..870732b2aac8 100644 --- a/core/java/android/view/IWindowManager.aidl +++ b/core/java/android/view/IWindowManager.aidl @@ -88,8 +88,6 @@ interface IWindowManager void clearForcedDisplayDensityForUser(int displayId, int userId); void setForcedDisplayScalingMode(int displayId, int mode); // 0 = auto, 1 = disable - void setOverscan(int displayId, int left, int top, int right, int bottom); - // These can only be called when holding the MANAGE_APP_TOKENS permission. void setEventDispatching(boolean enabled); void addWindowToken(IBinder token, int type, int displayId); diff --git a/core/java/android/view/IWindowSession.aidl b/core/java/android/view/IWindowSession.aidl index eaf6fca1b91f..0489e14993e3 100644 --- a/core/java/android/view/IWindowSession.aidl +++ b/core/java/android/view/IWindowSession.aidl @@ -43,7 +43,7 @@ import java.util.List; interface IWindowSession { int addToDisplay(IWindow window, int seq, in WindowManager.LayoutParams attrs, in int viewVisibility, in int layerStackId, out Rect outFrame, - out Rect outContentInsets, out Rect outStableInsets, out Rect outOutsets, + out Rect outContentInsets, out Rect outStableInsets, out DisplayCutout.ParcelableWrapper displayCutout, out InputChannel outInputChannel, out InsetsState insetsState); int addToDisplayWithoutInputChannel(IWindow window, int seq, in WindowManager.LayoutParams attrs, @@ -70,9 +70,6 @@ interface IWindowSession { * @param frameNumber A frame number in which changes requested in this layout will be rendered. * @param outFrame Rect in which is placed the new position/size on * screen. - * @param outOverscanInsets Rect in which is placed the offsets from - * <var>outFrame</var> in which the content of the window are inside - * of the display's overlay region. * @param outContentInsets Rect in which is placed the offsets from * <var>outFrame</var> in which the content of the window should be * placed. This can be used to modify the window layout to ensure its @@ -99,9 +96,9 @@ interface IWindowSession { */ int relayout(IWindow window, int seq, in WindowManager.LayoutParams attrs, int requestedWidth, int requestedHeight, int viewVisibility, - int flags, long frameNumber, out Rect outFrame, out Rect outOverscanInsets, + int flags, long frameNumber, out Rect outFrame, out Rect outContentInsets, out Rect outVisibleInsets, out Rect outStableInsets, - out Rect outOutsets, out Rect outBackdropFrame, + out Rect outBackdropFrame, out DisplayCutout.ParcelableWrapper displayCutout, out MergedConfiguration outMergedConfiguration, out SurfaceControl outSurfaceControl, out InsetsState insetsState); diff --git a/core/java/android/view/View.java b/core/java/android/view/View.java index 8d0800460775..e8e5d6ff22b3 100644 --- a/core/java/android/view/View.java +++ b/core/java/android/view/View.java @@ -11287,16 +11287,14 @@ public class View implements Drawable.Callback, KeyEvent.Callback, public WindowInsets computeSystemWindowInsets(WindowInsets in, Rect outLocalInsets) { if ((mViewFlags & OPTIONAL_FITS_SYSTEM_WINDOWS) == 0 || mAttachInfo == null - || ((mAttachInfo.mSystemUiVisibility & SYSTEM_UI_LAYOUT_FLAGS) == 0 - && !mAttachInfo.mOverscanRequested)) { + || ((mAttachInfo.mSystemUiVisibility & SYSTEM_UI_LAYOUT_FLAGS) == 0)) { outLocalInsets.set(in.getSystemWindowInsetsAsRect()); return in.consumeSystemWindowInsets().inset(outLocalInsets); } else { // The application wants to take care of fitting system window for - // the content... however we still need to take care of any overscan here. - final Rect overscan = mAttachInfo.mOverscanInsets; - outLocalInsets.set(overscan); - return in.inset(outLocalInsets); + // the content. + outLocalInsets.setEmpty(); + return in; } } @@ -11376,19 +11374,6 @@ public class View implements Drawable.Callback, KeyEvent.Callback, } /** - * Returns the outsets, which areas of the device that aren't a surface, but we would like to - * treat them as such. - * @hide - */ - public void getOutsets(Rect outOutsetRect) { - if (mAttachInfo != null) { - outOutsetRect.set(mAttachInfo.mOutsets); - } else { - outOutsetRect.setEmpty(); - } - } - - /** * Returns the visibility status for this view. * * @return One of {@link #VISIBLE}, {@link #INVISIBLE}, or {@link #GONE}. @@ -28444,13 +28429,6 @@ public class View implements Drawable.Callback, KeyEvent.Callback, /** * For windows that are full-screen but using insets to layout inside - * of the screen areas, these are the current insets to appear inside - * the overscan area of the display. - */ - final Rect mOverscanInsets = new Rect(); - - /** - * For windows that are full-screen but using insets to layout inside * of the screen decorations, these are the current insets for the * content of the window. */ @@ -28477,12 +28455,6 @@ public class View implements Drawable.Callback, KeyEvent.Callback, new DisplayCutout.ParcelableWrapper(DisplayCutout.NO_CUTOUT); /** - * For windows that include areas that are not covered by real surface these are the outsets - * for real surface. - */ - final Rect mOutsets = new Rect(); - - /** * In multi-window we force show the system bars. Because we don't want that the surface * size changes in this mode, we instead have a flag whether the system bars sizes should * always be consumed, so the app is treated like there are no virtual system bars at all. @@ -28591,12 +28563,6 @@ public class View implements Drawable.Callback, KeyEvent.Callback, boolean mHasSystemUiListeners; /** - * Set if the window has requested to extend into the overscan region - * via WindowManager.LayoutParams.FLAG_LAYOUT_IN_OVERSCAN. - */ - boolean mOverscanRequested; - - /** * Set if the visibility of any views has changed. */ @UnsupportedAppUsage diff --git a/core/java/android/view/ViewRootImpl.java b/core/java/android/view/ViewRootImpl.java index 97adaf57f9b4..8ee7a0ef5a66 100644 --- a/core/java/android/view/ViewRootImpl.java +++ b/core/java/android/view/ViewRootImpl.java @@ -219,10 +219,6 @@ public final class ViewRootImpl implements ViewParent, */ private static final String PROPERTY_PROFILE_RENDERING = "viewroot.profile_rendering"; - // properties used by emulator to determine display shape - public static final String PROPERTY_EMULATOR_WIN_OUTSET_BOTTOM_PX = - "ro.emu.win_outset_bottom_px"; - /** * Maximum time we allow the user to roll the trackball enough to generate * a key event, before resetting the counters. @@ -447,7 +443,6 @@ public final class ViewRootImpl implements ViewParent, boolean mIsDrawing; int mLastSystemUiVisibility; int mClientWindowLayoutFlags; - boolean mLastOverscanRequested; // Pool of queued input events. private static final int MAX_QUEUED_INPUT_EVENT_POOL_SIZE = 10; @@ -507,11 +502,9 @@ public final class ViewRootImpl implements ViewParent, // These are accessed by multiple threads. final Rect mWinFrame; // frame given by window manager. - final Rect mPendingOverscanInsets = new Rect(); final Rect mPendingVisibleInsets = new Rect(); final Rect mPendingStableInsets = new Rect(); final Rect mPendingContentInsets = new Rect(); - final Rect mPendingOutsets = new Rect(); final Rect mPendingBackDropFrame = new Rect(); final DisplayCutout.ParcelableWrapper mPendingDisplayCutout = new DisplayCutout.ParcelableWrapper(DisplayCutout.NO_CUTOUT); @@ -900,7 +893,7 @@ public final class ViewRootImpl implements ViewParent, res = mWindowSession.addToDisplay(mWindow, mSeq, mWindowAttributes, getHostVisibility(), mDisplay.getDisplayId(), mTmpFrame, mAttachInfo.mContentInsets, mAttachInfo.mStableInsets, - mAttachInfo.mOutsets, mAttachInfo.mDisplayCutout, inputChannel, + mAttachInfo.mDisplayCutout, inputChannel, mTempInsets); setFrame(mTmpFrame); } catch (RemoteException e) { @@ -921,7 +914,6 @@ public final class ViewRootImpl implements ViewParent, if (mTranslator != null) { mTranslator.translateRectInScreenToAppWindow(mAttachInfo.mContentInsets); } - mPendingOverscanInsets.set(0, 0, 0, 0); mPendingContentInsets.set(mAttachInfo.mContentInsets); mPendingStableInsets.set(mAttachInfo.mStableInsets); mPendingDisplayCutout.set(mAttachInfo.mDisplayCutout); @@ -1967,12 +1959,6 @@ public final class ViewRootImpl implements ViewParent, stableInsets = mPendingStableInsets; displayCutout = mPendingDisplayCutout.get(); } - Rect outsets = mAttachInfo.mOutsets; - if (outsets.left > 0 || outsets.top > 0 || outsets.right > 0 || outsets.bottom > 0) { - contentInsets = new Rect(contentInsets.left + outsets.left, - contentInsets.top + outsets.top, contentInsets.right + outsets.right, - contentInsets.bottom + outsets.bottom); - } contentInsets = ensureInsetsNonNegative(contentInsets, "content"); stableInsets = ensureInsetsNonNegative(stableInsets, "stable"); mLastWindowInsets = mInsetsController.calculateInsets( @@ -2146,9 +2132,6 @@ public final class ViewRootImpl implements ViewParent, mAttachInfo.mInTouchMode = !mAddedTouchMode; ensureTouchModeLocally(mAddedTouchMode); } else { - if (!mPendingOverscanInsets.equals(mAttachInfo.mOverscanInsets)) { - insetsChanged = true; - } if (!mPendingContentInsets.equals(mAttachInfo.mContentInsets)) { insetsChanged = true; } @@ -2163,9 +2146,6 @@ public final class ViewRootImpl implements ViewParent, if (DEBUG_LAYOUT) Log.v(mTag, "Visible insets changing to: " + mAttachInfo.mVisibleInsets); } - if (!mPendingOutsets.equals(mAttachInfo.mOutsets)) { - insetsChanged = true; - } if (mPendingAlwaysConsumeSystemBars != mAttachInfo.mAlwaysConsumeSystemBars) { insetsChanged = true; } @@ -2228,7 +2208,6 @@ public final class ViewRootImpl implements ViewParent, if (mApplyInsetsRequested) { mApplyInsetsRequested = false; - mLastOverscanRequested = mAttachInfo.mOverscanRequested; dispatchApplyInsets(host); if (mLayoutRequested) { // Short-circuit catching a new layout request here, so @@ -2292,8 +2271,6 @@ public final class ViewRootImpl implements ViewParent, && !PixelFormat.formatHasAlpha(params.format)) { params.format = PixelFormat.TRANSLUCENT; } - mAttachInfo.mOverscanRequested = - (params.flags & WindowManager.LayoutParams.FLAG_LAYOUT_IN_OVERSCAN) != 0; } if (mFirst || windowShouldResize || insetsChanged || @@ -2342,12 +2319,10 @@ public final class ViewRootImpl implements ViewParent, relayoutResult = relayoutWindow(params, viewVisibility, insetsPending); if (DEBUG_LAYOUT) Log.v(mTag, "relayout: frame=" + frame.toShortString() - + " overscan=" + mPendingOverscanInsets.toShortString() + " content=" + mPendingContentInsets.toShortString() + " visible=" + mPendingVisibleInsets.toShortString() + " stable=" + mPendingStableInsets.toShortString() + " cutout=" + mPendingDisplayCutout.get().toString() - + " outsets=" + mPendingOutsets.toShortString() + " surface=" + mSurface); // If the pending {@link MergedConfiguration} handed back from @@ -2363,8 +2338,6 @@ public final class ViewRootImpl implements ViewParent, updatedConfiguration = true; } - final boolean overscanInsetsChanged = !mPendingOverscanInsets.equals( - mAttachInfo.mOverscanInsets); contentInsetsChanged = !mPendingContentInsets.equals( mAttachInfo.mContentInsets); final boolean visibleInsetsChanged = !mPendingVisibleInsets.equals( @@ -2373,7 +2346,6 @@ public final class ViewRootImpl implements ViewParent, mAttachInfo.mStableInsets); final boolean cutoutChanged = !mPendingDisplayCutout.equals( mAttachInfo.mDisplayCutout); - final boolean outsetsChanged = !mPendingOutsets.equals(mAttachInfo.mOutsets); surfaceSizeChanged = (relayoutResult & WindowManagerGlobal.RELAYOUT_RES_SURFACE_RESIZED) != 0; final boolean alwaysConsumeSystemBarsChanged = @@ -2389,13 +2361,6 @@ public final class ViewRootImpl implements ViewParent, if (DEBUG_LAYOUT) Log.v(mTag, "Content insets changing to: " + mAttachInfo.mContentInsets); } - if (overscanInsetsChanged) { - mAttachInfo.mOverscanInsets.set(mPendingOverscanInsets); - if (DEBUG_LAYOUT) Log.v(mTag, "Overscan insets changing to: " - + mAttachInfo.mOverscanInsets); - // Need to relayout with content insets. - contentInsetsChanged = true; - } if (stableInsetsChanged) { mAttachInfo.mStableInsets.set(mPendingStableInsets); if (DEBUG_LAYOUT) Log.v(mTag, "Decor insets changing to: " @@ -2416,12 +2381,8 @@ public final class ViewRootImpl implements ViewParent, contentInsetsChanged = true; } if (contentInsetsChanged || mLastSystemUiVisibility != - mAttachInfo.mSystemUiVisibility || mApplyInsetsRequested - || mLastOverscanRequested != mAttachInfo.mOverscanRequested - || outsetsChanged) { + mAttachInfo.mSystemUiVisibility || mApplyInsetsRequested) { mLastSystemUiVisibility = mAttachInfo.mSystemUiVisibility; - mLastOverscanRequested = mAttachInfo.mOverscanRequested; - mAttachInfo.mOutsets.set(mPendingOutsets); mApplyInsetsRequested = false; dispatchApplyInsets(host); // We applied insets so force contentInsetsChanged to ensure the @@ -4671,12 +4632,10 @@ public final class ViewRootImpl implements ViewParent, // Recycled in the fall through... SomeArgs args = (SomeArgs) msg.obj; if (mWinFrame.equals(args.arg1) - && mPendingOverscanInsets.equals(args.arg5) && mPendingContentInsets.equals(args.arg2) && mPendingStableInsets.equals(args.arg6) && mPendingDisplayCutout.get().equals(args.arg9) && mPendingVisibleInsets.equals(args.arg3) - && mPendingOutsets.equals(args.arg7) && mPendingBackDropFrame.equals(args.arg8) && args.arg4 == null && args.argi1 == 0 @@ -4706,20 +4665,16 @@ public final class ViewRootImpl implements ViewParent, } final boolean framesChanged = !mWinFrame.equals(args.arg1) - || !mPendingOverscanInsets.equals(args.arg5) || !mPendingContentInsets.equals(args.arg2) || !mPendingStableInsets.equals(args.arg6) || !mPendingDisplayCutout.get().equals(args.arg9) - || !mPendingVisibleInsets.equals(args.arg3) - || !mPendingOutsets.equals(args.arg7); + || !mPendingVisibleInsets.equals(args.arg3); setFrame((Rect) args.arg1); - mPendingOverscanInsets.set((Rect) args.arg5); mPendingContentInsets.set((Rect) args.arg2); mPendingStableInsets.set((Rect) args.arg6); mPendingDisplayCutout.set((DisplayCutout) args.arg9); mPendingVisibleInsets.set((Rect) args.arg3); - mPendingOutsets.set((Rect) args.arg7); mPendingBackDropFrame.set((Rect) args.arg8); mForceNextWindowRelayout = args.argi1 != 0; mPendingAlwaysConsumeSystemBars = args.argi2 != 0; @@ -7174,8 +7129,8 @@ public final class ViewRootImpl implements ViewParent, (int) (mView.getMeasuredWidth() * appScale + 0.5f), (int) (mView.getMeasuredHeight() * appScale + 0.5f), viewVisibility, insetsPending ? WindowManagerGlobal.RELAYOUT_INSETS_PENDING : 0, frameNumber, - mTmpFrame, mPendingOverscanInsets, mPendingContentInsets, mPendingVisibleInsets, - mPendingStableInsets, mPendingOutsets, mPendingBackDropFrame, mPendingDisplayCutout, + mTmpFrame, mPendingContentInsets, mPendingVisibleInsets, + mPendingStableInsets, mPendingBackDropFrame, mPendingDisplayCutout, mPendingMergedConfiguration, mSurfaceControl, mTempInsets); if (mSurfaceControl.isValid()) { if (USE_BLAST_BUFFERQUEUE == false) { @@ -7198,7 +7153,6 @@ public final class ViewRootImpl implements ViewParent, if (mTranslator != null) { mTranslator.translateRectInScreenToAppWinFrame(mTmpFrame); - mTranslator.translateRectInScreenToAppWindow(mPendingOverscanInsets); mTranslator.translateRectInScreenToAppWindow(mPendingContentInsets); mTranslator.translateRectInScreenToAppWindow(mPendingVisibleInsets); mTranslator.translateRectInScreenToAppWindow(mPendingStableInsets); @@ -7493,8 +7447,8 @@ public final class ViewRootImpl implements ViewParent, } @UnsupportedAppUsage - private void dispatchResized(Rect frame, Rect overscanInsets, Rect contentInsets, - Rect visibleInsets, Rect stableInsets, Rect outsets, boolean reportDraw, + private void dispatchResized(Rect frame, Rect contentInsets, + Rect visibleInsets, Rect stableInsets, boolean reportDraw, MergedConfiguration mergedConfiguration, Rect backDropFrame, boolean forceLayout, boolean alwaysConsumeSystemBars, int displayId, DisplayCutout.ParcelableWrapper displayCutout) { @@ -7519,7 +7473,6 @@ public final class ViewRootImpl implements ViewParent, Message msg = mHandler.obtainMessage(reportDraw ? MSG_RESIZED_REPORT : MSG_RESIZED); if (mTranslator != null) { mTranslator.translateRectInScreenToAppWindow(frame); - mTranslator.translateRectInScreenToAppWindow(overscanInsets); mTranslator.translateRectInScreenToAppWindow(contentInsets); mTranslator.translateRectInScreenToAppWindow(visibleInsets); } @@ -7530,9 +7483,7 @@ public final class ViewRootImpl implements ViewParent, args.arg3 = sameProcessCall ? new Rect(visibleInsets) : visibleInsets; args.arg4 = sameProcessCall && mergedConfiguration != null ? new MergedConfiguration(mergedConfiguration) : mergedConfiguration; - args.arg5 = sameProcessCall ? new Rect(overscanInsets) : overscanInsets; args.arg6 = sameProcessCall ? new Rect(stableInsets) : stableInsets; - args.arg7 = sameProcessCall ? new Rect(outsets) : outsets; args.arg8 = sameProcessCall ? new Rect(backDropFrame) : backDropFrame; args.arg9 = displayCutout.get(); // DisplayCutout is immutable. args.argi1 = forceLayout ? 1 : 0; @@ -8637,15 +8588,15 @@ public final class ViewRootImpl implements ViewParent, } @Override - public void resized(Rect frame, Rect overscanInsets, Rect contentInsets, - Rect visibleInsets, Rect stableInsets, Rect outsets, boolean reportDraw, + public void resized(Rect frame, Rect contentInsets, + Rect visibleInsets, Rect stableInsets, boolean reportDraw, MergedConfiguration mergedConfiguration, Rect backDropFrame, boolean forceLayout, boolean alwaysConsumeSystemBars, int displayId, DisplayCutout.ParcelableWrapper displayCutout) { final ViewRootImpl viewAncestor = mViewAncestor.get(); if (viewAncestor != null) { - viewAncestor.dispatchResized(frame, overscanInsets, contentInsets, - visibleInsets, stableInsets, outsets, reportDraw, mergedConfiguration, + viewAncestor.dispatchResized(frame, contentInsets, + visibleInsets, stableInsets, reportDraw, mergedConfiguration, backDropFrame, forceLayout, alwaysConsumeSystemBars, displayId, displayCutout); } diff --git a/core/java/android/view/WindowManager.java b/core/java/android/view/WindowManager.java index 742ab77b5068..39088112397c 100644 --- a/core/java/android/view/WindowManager.java +++ b/core/java/android/view/WindowManager.java @@ -1445,7 +1445,10 @@ public interface WindowManager extends ViewManager { * position its UI elements with this overscan flag is set:</p> * * {@sample development/samples/ApiDemos/res/layout/overscan_activity.xml complete} + * + * @deprecated Overscan areas aren't set by any Android product anymore. */ + @Deprecated public static final int FLAG_LAYOUT_IN_OVERSCAN = 0x02000000; /** diff --git a/core/java/android/view/WindowlessWindowManager.java b/core/java/android/view/WindowlessWindowManager.java index 403bfda78292..0ff6063d4ae2 100644 --- a/core/java/android/view/WindowlessWindowManager.java +++ b/core/java/android/view/WindowlessWindowManager.java @@ -90,7 +90,7 @@ class WindowlessWindowManager implements IWindowSession { @Override public int addToDisplay(IWindow window, int seq, WindowManager.LayoutParams attrs, int viewVisibility, int displayId, Rect outFrame, Rect outContentInsets, - Rect outStableInsets, Rect outOutsets, + Rect outStableInsets, DisplayCutout.ParcelableWrapper outDisplayCutout, InputChannel outInputChannel, InsetsState outInsetsState) { final SurfaceControl.Builder b = new SurfaceControl.Builder(mSurfaceSession) @@ -140,8 +140,8 @@ class WindowlessWindowManager implements IWindowSession { @Override public int relayout(IWindow window, int seq, WindowManager.LayoutParams inAttrs, int requestedWidth, int requestedHeight, int viewFlags, int flags, long frameNumber, - Rect outFrame, Rect outOverscanInsets, Rect outContentInsets, Rect outVisibleInsets, - Rect outStableInsets, Rect outsets, Rect outBackdropFrame, + Rect outFrame, Rect outContentInsets, Rect outVisibleInsets, + Rect outStableInsets, Rect outBackdropFrame, DisplayCutout.ParcelableWrapper cutout, MergedConfiguration mergedConfiguration, SurfaceControl outSurfaceControl, InsetsState outInsetsState) { State state = null; diff --git a/core/java/com/android/internal/policy/DecorView.java b/core/java/com/android/internal/policy/DecorView.java index b02563a67503..c33b6dc0bba2 100644 --- a/core/java/com/android/internal/policy/DecorView.java +++ b/core/java/com/android/internal/policy/DecorView.java @@ -236,7 +236,6 @@ public class DecorView extends FrameLayout implements RootViewSurfaceTaker, Wind ViewGroup mContentRoot; private Rect mTempRect; - private Rect mOutsets = new Rect(); // This is the caption view for the window, containing the caption and window control // buttons. The visibility of this decor depends on the workspace and the window type. @@ -729,24 +728,6 @@ public class DecorView extends FrameLayout implements RootViewSurfaceTaker, Wind } } - getOutsets(mOutsets); - if (mOutsets.top > 0 || mOutsets.bottom > 0) { - int mode = MeasureSpec.getMode(heightMeasureSpec); - if (mode != MeasureSpec.UNSPECIFIED) { - int height = MeasureSpec.getSize(heightMeasureSpec); - heightMeasureSpec = MeasureSpec.makeMeasureSpec( - height + mOutsets.top + mOutsets.bottom, mode); - } - } - if (mOutsets.left > 0 || mOutsets.right > 0) { - int mode = MeasureSpec.getMode(widthMeasureSpec); - if (mode != MeasureSpec.UNSPECIFIED) { - int width = MeasureSpec.getSize(widthMeasureSpec); - widthMeasureSpec = MeasureSpec.makeMeasureSpec( - width + mOutsets.left + mOutsets.right, mode); - } - } - super.onMeasure(widthMeasureSpec, heightMeasureSpec); int width = getMeasuredWidth(); @@ -785,13 +766,6 @@ public class DecorView extends FrameLayout implements RootViewSurfaceTaker, Wind @Override protected void onLayout(boolean changed, int left, int top, int right, int bottom) { super.onLayout(changed, left, top, right, bottom); - getOutsets(mOutsets); - if (mOutsets.left > 0) { - offsetLeftAndRight(-mOutsets.left); - } - if (mOutsets.top > 0) { - offsetTopAndBottom(-mOutsets.top); - } if (mApplyFloatingVerticalInsets) { offsetTopAndBottom(mFloatingInsets.top); } diff --git a/core/java/com/android/internal/policy/PhoneWindow.java b/core/java/com/android/internal/policy/PhoneWindow.java index c8ba0a0e25a2..227ef28cd129 100644 --- a/core/java/com/android/internal/policy/PhoneWindow.java +++ b/core/java/com/android/internal/policy/PhoneWindow.java @@ -2378,10 +2378,6 @@ public class PhoneWindow extends Window implements MenuBuilder.Callback { & (~getForcedWindowFlags())); } - if (a.getBoolean(R.styleable.Window_windowOverscan, false)) { - setFlags(FLAG_LAYOUT_IN_OVERSCAN, FLAG_LAYOUT_IN_OVERSCAN&(~getForcedWindowFlags())); - } - if (a.getBoolean(R.styleable.Window_windowShowWallpaper, false)) { setFlags(FLAG_SHOW_WALLPAPER, FLAG_SHOW_WALLPAPER&(~getForcedWindowFlags())); } diff --git a/core/java/com/android/internal/util/ScreenShapeHelper.java b/core/java/com/android/internal/util/ScreenShapeHelper.java deleted file mode 100644 index 5f390be05da5..000000000000 --- a/core/java/com/android/internal/util/ScreenShapeHelper.java +++ /dev/null @@ -1,23 +0,0 @@ -package com.android.internal.util; - -import android.content.res.Resources; -import android.os.Build; -import android.os.SystemProperties; -import android.view.ViewRootImpl; - -/** - * @hide - */ -public class ScreenShapeHelper { - /** - * Return the bottom pixel window outset of a window given its style attributes. - * @return An outset dimension in pixels or 0 if no outset should be applied. - */ - public static int getWindowOutsetBottomPx(Resources resources) { - if (Build.IS_EMULATOR) { - return SystemProperties.getInt(ViewRootImpl.PROPERTY_EMULATOR_WIN_OUTSET_BOTTOM_PX, 0); - } else { - return resources.getInteger(com.android.internal.R.integer.config_windowOutsetBottom); - } - } -} diff --git a/core/java/com/android/internal/view/BaseIWindow.java b/core/java/com/android/internal/view/BaseIWindow.java index 7e1f13afc2cb..c7cdc3b51bca 100644 --- a/core/java/com/android/internal/view/BaseIWindow.java +++ b/core/java/com/android/internal/view/BaseIWindow.java @@ -49,8 +49,8 @@ public class BaseIWindow extends IWindow.Stub { } @Override - public void resized(Rect frame, Rect overscanInsets, Rect contentInsets, Rect visibleInsets, - Rect stableInsets, Rect outsets, boolean reportDraw, + public void resized(Rect frame, Rect contentInsets, Rect visibleInsets, + Rect stableInsets, boolean reportDraw, MergedConfiguration mergedConfiguration, Rect backDropFrame, boolean forceLayout, boolean alwaysConsumeSystemBars, int displayId, DisplayCutout.ParcelableWrapper displayCutout) { diff --git a/core/proto/android/server/windowmanagerservice.proto b/core/proto/android/server/windowmanagerservice.proto index c9a18296a292..653d381e2960 100644 --- a/core/proto/android/server/windowmanagerservice.proto +++ b/core/proto/android/server/windowmanagerservice.proto @@ -385,12 +385,12 @@ message WindowFramesProto { optional .android.graphics.RectProto display_frame = 4; optional .android.graphics.RectProto frame = 5; optional .android.graphics.RectProto outset_frame = 6; - optional .android.graphics.RectProto overscan_frame = 7; + optional .android.graphics.RectProto overscan_frame = 7 [deprecated=true]; 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 overscan_insets = 12 [deprecated=true]; optional .android.graphics.RectProto visible_insets = 13; optional .android.graphics.RectProto stable_insets = 14; optional .android.graphics.RectProto outsets = 15; diff --git a/core/res/res/values/attrs.xml b/core/res/res/values/attrs.xml index bad5d6453bda..642dc929e88a 100644 --- a/core/res/res/values/attrs.xml +++ b/core/res/res/values/attrs.xml @@ -359,7 +359,9 @@ to {@link android.view.WindowManager.LayoutParams#FLAG_FULLSCREEN}. --> <attr name="windowFullscreen" format="boolean" /> <!-- Flag indicating whether this window should extend into overscan region. Corresponds - to {@link android.view.WindowManager.LayoutParams#FLAG_LAYOUT_IN_OVERSCAN}. --> + to {@link android.view.WindowManager.LayoutParams#FLAG_LAYOUT_IN_OVERSCAN}. + @deprecated Overscan areas aren't set by any Android product anymore. + --> <attr name="windowOverscan" format="boolean" /> <!-- Flag indicating whether this is a floating window. --> <attr name="windowIsFloating" format="boolean" /> diff --git a/core/res/res/values/config_material.xml b/core/res/res/values/config_material.xml index 840a551f914f..64483f1f32db 100644 --- a/core/res/res/values/config_material.xml +++ b/core/res/res/values/config_material.xml @@ -29,9 +29,6 @@ <!-- The alert controller to use for alert dialogs. --> <integer name="config_alertDialogController">0</integer> - <!-- True if windowOverscan should be on by default. --> - <bool name="config_windowOverscanByDefault">false</bool> - <!-- True if preference fragment should clip to padding. --> <bool name="config_preferenceFragmentClipToPadding">true</bool> diff --git a/core/res/res/values/themes_material.xml b/core/res/res/values/themes_material.xml index 78d218f9a438..f3905e93a525 100644 --- a/core/res/res/values/themes_material.xml +++ b/core/res/res/values/themes_material.xml @@ -162,7 +162,6 @@ please see themes_device_defaults.xml. <item name="windowFrame">@null</item> <item name="windowNoTitle">@bool/config_windowNoTitleDefault</item> <item name="windowFullscreen">false</item> - <item name="windowOverscan">@bool/config_windowOverscanByDefault</item> <item name="windowIsFloating">false</item> <item name="windowContentOverlay">@null</item> <item name="windowShowWallpaper">false</item> @@ -536,7 +535,6 @@ please see themes_device_defaults.xml. <item name="windowFrame">@null</item> <item name="windowNoTitle">@bool/config_windowNoTitleDefault</item> <item name="windowFullscreen">false</item> - <item name="windowOverscan">@bool/config_windowOverscanByDefault</item> <item name="windowIsFloating">false</item> <item name="windowContentOverlay">@null</item> <item name="windowShowWallpaper">false</item> @@ -963,10 +961,11 @@ please see themes_device_defaults.xml. <!-- Variant of the material (dark) theme that has no title bar and fills the entire screen and extends into the display overscan region. This theme sets {@link android.R.attr#windowFullscreen} and {@link android.R.attr#windowOverscan} - to true. --> + to true. + @deprecated Overscan areas aren't set by any Android product anymore. + --> <style name="Theme.Material.NoActionBar.Overscan"> <item name="windowFullscreen">true</item> - <item name="windowOverscan">true</item> <item name="windowContentOverlay">@null</item> </style> @@ -996,10 +995,11 @@ please see themes_device_defaults.xml. <!-- Variant of the material (light) theme that has no title bar and fills the entire screen and extends into the display overscan region. This theme sets {@link android.R.attr#windowFullscreen} and {@link android.R.attr#windowOverscan} - to true. --> + to true. + @deprecated Overscan areas aren't set by any Android product anymore. + --> <style name="Theme.Material.Light.NoActionBar.Overscan"> <item name="windowFullscreen">true</item> - <item name="windowOverscan">true</item> <item name="windowContentOverlay">@null</item> </style> diff --git a/services/core/java/com/android/server/display/LogicalDisplay.java b/services/core/java/com/android/server/display/LogicalDisplay.java index a7b90510e6c8..dcef99817fac 100644 --- a/services/core/java/com/android/server/display/LogicalDisplay.java +++ b/services/core/java/com/android/server/display/LogicalDisplay.java @@ -150,10 +150,6 @@ final class LogicalDisplay { mInfo.largestNominalAppHeight = mOverrideDisplayInfo.largestNominalAppHeight; mInfo.logicalWidth = mOverrideDisplayInfo.logicalWidth; mInfo.logicalHeight = mOverrideDisplayInfo.logicalHeight; - mInfo.overscanLeft = mOverrideDisplayInfo.overscanLeft; - mInfo.overscanTop = mOverrideDisplayInfo.overscanTop; - mInfo.overscanRight = mOverrideDisplayInfo.overscanRight; - mInfo.overscanBottom = mOverrideDisplayInfo.overscanBottom; mInfo.rotation = mOverrideDisplayInfo.rotation; mInfo.displayCutout = mOverrideDisplayInfo.displayCutout; mInfo.logicalDensityDpi = mOverrideDisplayInfo.logicalDensityDpi; diff --git a/services/core/java/com/android/server/policy/WindowManagerPolicy.java b/services/core/java/com/android/server/policy/WindowManagerPolicy.java index 01250db9c5c6..1f37fafc3442 100644 --- a/services/core/java/com/android/server/policy/WindowManagerPolicy.java +++ b/services/core/java/com/android/server/policy/WindowManagerPolicy.java @@ -213,15 +213,6 @@ public interface WindowManagerPolicy extends WindowManagerPolicyConstants { public Rect getDisplayFrameLw(); /** - * Retrieve the frame of the area inside the overscan region of the - * display that this window was last laid out in. Must be called with the - * window manager lock held. - * - * @return Rect The rectangle holding the display overscan frame. - */ - public Rect getOverscanFrameLw(); - - /** * Retrieve the frame of the content area that this window was last * laid out in. This is the area in which the content of the window * should be placed. It will be smaller than the display frame to diff --git a/services/core/java/com/android/server/wm/CircularDisplayMask.java b/services/core/java/com/android/server/wm/CircularDisplayMask.java deleted file mode 100644 index b73b481075ae..000000000000 --- a/services/core/java/com/android/server/wm/CircularDisplayMask.java +++ /dev/null @@ -1,161 +0,0 @@ -/* - * Copyright (C) 2014 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.android.server.wm; - - -import static com.android.server.wm.WindowManagerDebugConfig.TAG_WITH_CLASS_NAME; -import static com.android.server.wm.WindowManagerDebugConfig.TAG_WM; - -import android.graphics.Canvas; -import android.graphics.Color; -import android.graphics.Paint; -import android.graphics.PixelFormat; -import android.graphics.Point; -import android.graphics.PorterDuff; -import android.graphics.PorterDuffXfermode; -import android.graphics.Rect; -import android.util.Slog; -import android.view.Display; -import android.view.Surface; -import android.view.Surface.OutOfResourcesException; -import android.view.SurfaceControl; - -import java.util.function.Supplier; - -class CircularDisplayMask { - private static final String TAG = TAG_WITH_CLASS_NAME ? "CircularDisplayMask" : TAG_WM; - - // size of the chin - private int mScreenOffset = 0; - // Display dimensions - private Point mScreenSize; - - private final SurfaceControl mSurfaceControl; - private final Surface mSurface; - private int mLastDW; - private int mLastDH; - private boolean mDrawNeeded; - private Paint mPaint; - private int mRotation; - private boolean mVisible; - private boolean mDimensionsUnequal = false; - private int mMaskThickness; - - CircularDisplayMask(Supplier<Surface> surfaceFactory, DisplayContent dc, int zOrder, - int screenOffset, int maskThickness, SurfaceControl.Transaction t) { - final Display display = dc.getDisplay(); - mSurface = surfaceFactory.get(); - mScreenSize = new Point(); - display.getSize(mScreenSize); - if (mScreenSize.x != mScreenSize.y + screenOffset) { - Slog.w(TAG, "Screen dimensions of displayId = " + display.getDisplayId() + - "are not equal, circularMask will not be drawn."); - mDimensionsUnequal = true; - } - - SurfaceControl ctrl = null; - try { - ctrl = dc.makeOverlay() - .setName("CircularDisplayMask") - .setBufferSize(mScreenSize.x, mScreenSize.y) // not a typo - .setFormat(PixelFormat.TRANSLUCENT) - .build(); - - t.setLayerStack(ctrl, display.getLayerStack()); - t.setLayer(ctrl, zOrder); - t.setPosition(ctrl, 0, 0); - t.show(ctrl); - mSurface.copyFrom(ctrl); - } catch (OutOfResourcesException e) { - } - mSurfaceControl = ctrl; - mDrawNeeded = true; - mPaint = new Paint(); - mPaint.setAntiAlias(true); - mPaint.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.CLEAR)); - mScreenOffset = screenOffset; - mMaskThickness = maskThickness; - } - - private void drawIfNeeded(SurfaceControl.Transaction t) { - if (!mDrawNeeded || !mVisible || mDimensionsUnequal) { - return; - } - mDrawNeeded = false; - - Rect dirty = new Rect(0, 0, mScreenSize.x, mScreenSize.y); - Canvas c = null; - try { - c = mSurface.lockCanvas(dirty); - } catch (IllegalArgumentException e) { - } catch (Surface.OutOfResourcesException e) { - } - if (c == null) { - return; - } - switch (mRotation) { - case Surface.ROTATION_0: - case Surface.ROTATION_90: - // chin bottom or right - t.setPosition(mSurfaceControl, 0, 0); - break; - case Surface.ROTATION_180: - // chin top - t.setPosition(mSurfaceControl, 0, -mScreenOffset); - break; - case Surface.ROTATION_270: - // chin left - t.setPosition(mSurfaceControl, -mScreenOffset, 0); - break; - } - - int circleRadius = mScreenSize.x / 2; - c.drawColor(Color.BLACK); - - // The radius is reduced by mMaskThickness to provide an anti aliasing effect on the - // display edges. - c.drawCircle(circleRadius, circleRadius, circleRadius - mMaskThickness, mPaint); - mSurface.unlockCanvasAndPost(c); - } - - // Note: caller responsible for being inside - // Surface.openTransaction() / closeTransaction() - public void setVisibility(boolean on, SurfaceControl.Transaction t) { - if (mSurfaceControl == null) { - return; - } - mVisible = on; - drawIfNeeded(t); - if (on) { - t.show(mSurfaceControl); - } else { - t.hide(mSurfaceControl); - } - } - - void positionSurface(int dw, int dh, int rotation, SurfaceControl.Transaction t) { - if (mLastDW == dw && mLastDH == dh && mRotation == rotation) { - return; - } - mLastDW = dw; - mLastDH = dh; - mDrawNeeded = true; - mRotation = rotation; - drawIfNeeded(t); - } - -} diff --git a/services/core/java/com/android/server/wm/DisplayFrames.java b/services/core/java/com/android/server/wm/DisplayFrames.java index dc6b49127f7b..6b47c8a820d0 100644 --- a/services/core/java/com/android/server/wm/DisplayFrames.java +++ b/services/core/java/com/android/server/wm/DisplayFrames.java @@ -39,20 +39,11 @@ public class DisplayFrames { public final int mDisplayId; /** - * The current size of the screen; really; extends into the overscan area of the screen and - * doesn't account for any system elements like the status bar. - */ - public final Rect mOverscan = new Rect(); - - /** * The current visible size of the screen; really; (ir)regardless of whether the status bar can * be hidden but not extending into the overscan area. */ public final Rect mUnrestricted = new Rect(); - /** Like mOverscan*, but allowed to move into the overscan region where appropriate. */ - public final Rect mRestrictedOverscan = new Rect(); - /** * The current size of the screen; these may be different than (0,0)-(dw,dh) if the status bar * can't be hidden; in that case it effectively carves out that area of the display from all @@ -109,8 +100,6 @@ public class DisplayFrames { */ public final Rect mDisplayCutoutSafe = new Rect(); - private final Rect mDisplayInfoOverscan = new Rect(); - private final Rect mRotatedDisplayInfoOverscan = new Rect(); public int mDisplayWidth; public int mDisplayHeight; @@ -125,43 +114,13 @@ public class DisplayFrames { mDisplayWidth = info.logicalWidth; mDisplayHeight = info.logicalHeight; mRotation = info.rotation; - mDisplayInfoOverscan.set( - info.overscanLeft, info.overscanTop, info.overscanRight, info.overscanBottom); mDisplayInfoCutout = displayCutout != null ? displayCutout : WmDisplayCutout.NO_CUTOUT; } public void onBeginLayout() { - switch (mRotation) { - case ROTATION_90: - mRotatedDisplayInfoOverscan.left = mDisplayInfoOverscan.top; - mRotatedDisplayInfoOverscan.top = mDisplayInfoOverscan.right; - mRotatedDisplayInfoOverscan.right = mDisplayInfoOverscan.bottom; - mRotatedDisplayInfoOverscan.bottom = mDisplayInfoOverscan.left; - break; - case ROTATION_180: - mRotatedDisplayInfoOverscan.left = mDisplayInfoOverscan.right; - mRotatedDisplayInfoOverscan.top = mDisplayInfoOverscan.bottom; - mRotatedDisplayInfoOverscan.right = mDisplayInfoOverscan.left; - mRotatedDisplayInfoOverscan.bottom = mDisplayInfoOverscan.top; - break; - case ROTATION_270: - mRotatedDisplayInfoOverscan.left = mDisplayInfoOverscan.bottom; - mRotatedDisplayInfoOverscan.top = mDisplayInfoOverscan.left; - mRotatedDisplayInfoOverscan.right = mDisplayInfoOverscan.top; - mRotatedDisplayInfoOverscan.bottom = mDisplayInfoOverscan.right; - break; - default: - mRotatedDisplayInfoOverscan.set(mDisplayInfoOverscan); - break; - } - - mRestrictedOverscan.set(0, 0, mDisplayWidth, mDisplayHeight); - mOverscan.set(mRestrictedOverscan); - mSystem.set(mRestrictedOverscan); - mUnrestricted.set(mRotatedDisplayInfoOverscan); - mUnrestricted.right = mDisplayWidth - mUnrestricted.right; - mUnrestricted.bottom = mDisplayHeight - mUnrestricted.bottom; + mUnrestricted.set(0, 0, mDisplayWidth, mDisplayHeight); mRestricted.set(mUnrestricted); + mSystem.set(mUnrestricted); mDock.set(mUnrestricted); mContent.set(mUnrestricted); mVoiceContent.set(mUnrestricted); @@ -175,16 +134,16 @@ public class DisplayFrames { if (!mDisplayCutout.getDisplayCutout().isEmpty()) { final DisplayCutout c = mDisplayCutout.getDisplayCutout(); if (c.getSafeInsetLeft() > 0) { - mDisplayCutoutSafe.left = mRestrictedOverscan.left + c.getSafeInsetLeft(); + mDisplayCutoutSafe.left = mUnrestricted.left + c.getSafeInsetLeft(); } if (c.getSafeInsetTop() > 0) { - mDisplayCutoutSafe.top = mRestrictedOverscan.top + c.getSafeInsetTop(); + mDisplayCutoutSafe.top = mUnrestricted.top + c.getSafeInsetTop(); } if (c.getSafeInsetRight() > 0) { - mDisplayCutoutSafe.right = mRestrictedOverscan.right - c.getSafeInsetRight(); + mDisplayCutoutSafe.right = mUnrestricted.right - c.getSafeInsetRight(); } if (c.getSafeInsetBottom() > 0) { - mDisplayCutoutSafe.bottom = mRestrictedOverscan.bottom - c.getSafeInsetBottom(); + mDisplayCutoutSafe.bottom = mUnrestricted.bottom - c.getSafeInsetBottom(); } } } @@ -210,12 +169,8 @@ public class DisplayFrames { dumpFrame(mSystem, "mSystem", myPrefix, pw); dumpFrame(mContent, "mContent", myPrefix, pw); dumpFrame(mVoiceContent, "mVoiceContent", myPrefix, pw); - dumpFrame(mOverscan, "mOverscan", myPrefix, pw); - dumpFrame(mRestrictedOverscan, "mRestrictedOverscan", myPrefix, pw); dumpFrame(mRestricted, "mRestricted", myPrefix, pw); dumpFrame(mUnrestricted, "mUnrestricted", myPrefix, pw); - dumpFrame(mDisplayInfoOverscan, "mDisplayInfoOverscan", myPrefix, pw); - dumpFrame(mRotatedDisplayInfoOverscan, "mRotatedDisplayInfoOverscan", myPrefix, pw); pw.println(myPrefix + "mDisplayCutout=" + mDisplayCutout); } diff --git a/services/core/java/com/android/server/wm/DisplayPolicy.java b/services/core/java/com/android/server/wm/DisplayPolicy.java index 6a6b2517e1a5..f8c1ad951fc3 100644 --- a/services/core/java/com/android/server/wm/DisplayPolicy.java +++ b/services/core/java/com/android/server/wm/DisplayPolicy.java @@ -163,7 +163,6 @@ import com.android.internal.R; import com.android.internal.annotations.GuardedBy; import com.android.internal.annotations.VisibleForTesting; import com.android.internal.policy.ScreenDecorationsUtils; -import com.android.internal.util.ScreenShapeHelper; import com.android.internal.util.ScreenshotHelper; import com.android.internal.util.function.TriConsumer; import com.android.internal.view.AppearanceRegion; @@ -294,9 +293,6 @@ public class DisplayPolicy { private boolean mIsFreeformWindowOverlappingWithNavBar; - /** Cached value of {@link ScreenShapeHelper#getWindowOutsetBottomPx} */ - @Px private int mWindowOutsetBottom; - private final StatusBarController mStatusBarController; private final BarController mNavigationBarController; @@ -1209,7 +1205,6 @@ public class DisplayPolicy { * @param outContentInsets The areas covered by system windows, expressed as positive insets. * @param outStableInsets The areas covered by stable system windows irrespective of their * current visibility. Expressed as positive insets. - * @param outOutsets The areas that are not real display, but we would like to treat as such. * @param outDisplayCutout The area that has been cut away from the display. * @return Whether to always consume the system bars. * See {@link #areSystemBarsForcedShownLw(WindowState)}. @@ -1217,28 +1212,11 @@ public class DisplayPolicy { public boolean getLayoutHintLw(LayoutParams attrs, Rect taskBounds, DisplayFrames displayFrames, boolean floatingStack, Rect outFrame, Rect outContentInsets, Rect outStableInsets, - Rect outOutsets, DisplayCutout.ParcelableWrapper outDisplayCutout) { + DisplayCutout.ParcelableWrapper outDisplayCutout) { final int fl = PolicyControl.getWindowFlags(null, attrs); final int pfl = attrs.privateFlags; final int requestedSysUiVis = PolicyControl.getSystemUiVisibility(null, attrs); final int sysUiVis = requestedSysUiVis | getImpliedSysUiFlagsForLayout(attrs); - final int displayRotation = displayFrames.mRotation; - - final boolean useOutsets = outOutsets != null && shouldUseOutsets(attrs, fl); - if (useOutsets) { - int outset = mWindowOutsetBottom; - if (outset > 0) { - if (displayRotation == Surface.ROTATION_0) { - outOutsets.bottom += outset; - } else if (displayRotation == Surface.ROTATION_90) { - outOutsets.right += outset; - } else if (displayRotation == Surface.ROTATION_180) { - outOutsets.top += outset; - } else if (displayRotation == Surface.ROTATION_270) { - outOutsets.left += outset; - } - } - } final boolean layoutInScreen = (fl & FLAG_LAYOUT_IN_SCREEN) != 0; final boolean layoutInScreenAndInsetDecor = layoutInScreen @@ -1268,8 +1246,8 @@ public class DisplayPolicy { } else { cf = displayFrames.mStable; } - } else if ((fl & FLAG_FULLSCREEN) != 0 || (fl & FLAG_LAYOUT_IN_OVERSCAN) != 0) { - cf = displayFrames.mOverscan; + } else if ((fl & FLAG_FULLSCREEN) != 0) { + cf = displayFrames.mUnrestricted; } else { cf = displayFrames.mCurrent; } @@ -1312,11 +1290,6 @@ public class DisplayPolicy { return impliedFlags; } - private static boolean shouldUseOutsets(WindowManager.LayoutParams attrs, int fl) { - return attrs.type == TYPE_WALLPAPER || (fl & (WindowManager.LayoutParams.FLAG_FULLSCREEN - | WindowManager.LayoutParams.FLAG_LAYOUT_IN_OVERSCAN)) != 0; - } - private final Runnable mClearHideNavigationFlag = new Runnable() { @Override public void run() { @@ -1482,11 +1455,9 @@ public class DisplayPolicy { w.getWindowFrames().setFrames(displayFrames.mUnrestricted /* parentFrame */, displayFrames.mUnrestricted /* displayFrame */, - displayFrames.mUnrestricted /* overscanFrame */, displayFrames.mUnrestricted /* contentFrame */, displayFrames.mUnrestricted /* visibleFrame */, sTmpRect /* decorFrame */, - displayFrames.mUnrestricted /* stableFrame */, - displayFrames.mUnrestricted /* outsetFrame */); + displayFrames.mUnrestricted /* stableFrame */); w.getWindowFrames().setDisplayCutout(displayFrames.mDisplayCutout); w.computeFrameLw(); final Rect frame = w.getFrameLw(); @@ -1530,7 +1501,6 @@ public class DisplayPolicy { displayFrames.mVoiceContent.set(dockFrame); displayFrames.mSystem.set(dockFrame); displayFrames.mContent.set(dockFrame); - displayFrames.mRestrictedOverscan.set(dockFrame); } private boolean layoutStatusBar(DisplayFrames displayFrames, int sysui, @@ -1544,9 +1514,9 @@ public class DisplayPolicy { final WindowFrames windowFrames = mStatusBar.getWindowFrames(); windowFrames.setFrames(displayFrames.mUnrestricted /* parentFrame */, displayFrames.mUnrestricted /* displayFrame */, - displayFrames.mStable /* overscanFrame */, displayFrames.mStable /* contentFrame */, + displayFrames.mStable /* contentFrame */, displayFrames.mStable /* visibleFrame */, sTmpRect /* decorFrame */, - displayFrames.mStable /* stableFrame */, displayFrames.mStable /* outsetFrame */); + displayFrames.mStable /* stableFrame */); windowFrames.setDisplayCutout(displayFrames.mDisplayCutout); // Let the status bar determine its size. @@ -1630,8 +1600,7 @@ public class DisplayPolicy { mNavigationBarController.setBarShowingLw(true); } else if (navVisible) { mNavigationBarController.setBarShowingLw(true); - dockFrame.bottom = displayFrames.mRestricted.bottom = - displayFrames.mRestrictedOverscan.bottom = top; + dockFrame.bottom = displayFrames.mRestricted.bottom = top; } else { // We currently want to hide the navigation UI - unless we expanded the status bar. mNavigationBarController.setBarShowingLw(statusBarForcesShowingNavigation); @@ -1653,8 +1622,7 @@ public class DisplayPolicy { mNavigationBarController.setBarShowingLw(true); } else if (navVisible) { mNavigationBarController.setBarShowingLw(true); - dockFrame.right = displayFrames.mRestricted.right = - displayFrames.mRestrictedOverscan.right = left; + dockFrame.right = displayFrames.mRestricted.right = left; } else { // We currently want to hide the navigation UI - unless we expanded the status bar. mNavigationBarController.setBarShowingLw(statusBarForcesShowingNavigation); @@ -1676,8 +1644,7 @@ public class DisplayPolicy { mNavigationBarController.setBarShowingLw(true); } else if (navVisible) { mNavigationBarController.setBarShowingLw(true); - dockFrame.left = displayFrames.mRestricted.left = - displayFrames.mRestrictedOverscan.left = right; + dockFrame.left = displayFrames.mRestricted.left = right; } else { // We currently want to hide the navigation UI - unless we expanded the status bar. mNavigationBarController.setBarShowingLw(statusBarForcesShowingNavigation); @@ -1699,11 +1666,10 @@ public class DisplayPolicy { // And compute the final frame. sTmpRect.setEmpty(); mNavigationBar.getWindowFrames().setFrames(navigationFrame /* parentFrame */, - navigationFrame /* displayFrame */, navigationFrame /* overscanFrame */, + navigationFrame /* displayFrame */, displayFrames.mDisplayCutoutSafe /* contentFrame */, navigationFrame /* visibleFrame */, sTmpRect /* decorFrame */, - navigationFrame /* stableFrame */, - displayFrames.mDisplayCutoutSafe /* outsetFrame */); + navigationFrame /* stableFrame */); mNavigationBar.getWindowFrames().setDisplayCutout(displayFrames.mDisplayCutout); mNavigationBar.computeFrameLw(); mNavigationBarController.setContentFrame(mNavigationBar.getContentFrameLw()); @@ -1713,7 +1679,7 @@ public class DisplayPolicy { } private void setAttachedWindowFrames(WindowState win, int fl, int adjust, WindowState attached, - boolean insetDecors, Rect pf, Rect df, Rect of, Rect cf, Rect vf, + boolean insetDecors, Rect pf, Rect df, Rect cf, Rect vf, DisplayFrames displayFrames) { if (!win.isInputMethodTarget() && attached.isInputMethodTarget()) { // Here's a special case: if the child window is not the 'dock window' @@ -1725,29 +1691,25 @@ public class DisplayPolicy { // compute the frames that would be appropriate without the dock. vf.set(displayFrames.mDock); cf.set(displayFrames.mDock); - of.set(displayFrames.mDock); df.set(displayFrames.mDock); } else { - // In case we forced the window to draw behind the navigation bar, restrict df/of to - // DF.RestrictedOverscan to simulate old compat behavior. + // In case we forced the window to draw behind the navigation bar, restrict df to + // DF.Restricted to simulate old compat behavior. Rect parentDisplayFrame = attached.getDisplayFrameLw(); - Rect parentOverscan = attached.getOverscanFrameLw(); final WindowManager.LayoutParams attachedAttrs = attached.mAttrs; if ((attachedAttrs.privateFlags & PRIVATE_FLAG_FORCE_DRAW_BAR_BACKGROUNDS) != 0 && (attachedAttrs.flags & FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS) == 0 && (attachedAttrs.systemUiVisibility & SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION) == 0) { - parentOverscan = new Rect(parentOverscan); - parentOverscan.intersect(displayFrames.mRestrictedOverscan); parentDisplayFrame = new Rect(parentDisplayFrame); - parentDisplayFrame.intersect(displayFrames.mRestrictedOverscan); + parentDisplayFrame.intersect(displayFrames.mRestricted); } // The effective display frame of the attached window depends on whether it is taking // care of insetting its content. If not, we need to use the parent's content frame so // that the entire window is positioned within that content. Otherwise we can use the - // overscan frame and let the attached window take care of positioning its content + // parent display frame and let the attached window take care of positioning its content // appropriately. if (adjust != SOFT_INPUT_ADJUST_RESIZE) { // Set the content frame of the attached window to the parent's decor frame @@ -1755,7 +1717,7 @@ public class DisplayPolicy { // setting {@link WindowManager.LayoutParams#FLAG_LAYOUT_ATTACHED_IN_DECOR} flag. // Otherwise, use the overscan frame. cf.set((fl & FLAG_LAYOUT_ATTACHED_IN_DECOR) != 0 - ? attached.getContentFrameLw() : parentOverscan); + ? attached.getContentFrameLw() : parentDisplayFrame); } else { // If the window is resizing, then we want to base the content frame on our attached // content frame to resize...however, things can be tricky if the attached window is @@ -1770,7 +1732,6 @@ public class DisplayPolicy { } } df.set(insetDecors ? parentDisplayFrame : cf); - of.set(insetDecors ? parentOverscan : cf); vf.set(attached.getVisibleFrameLw()); } // The LAYOUT_IN_SCREEN flag is used to determine whether the attached window should be @@ -1820,7 +1781,6 @@ public class DisplayPolicy { return; } final WindowManager.LayoutParams attrs = win.getAttrs(); - final boolean isDefaultDisplay = win.isDefaultDisplay(); final int type = attrs.type; final int fl = PolicyControl.getWindowFlags(win, attrs); @@ -1831,11 +1791,9 @@ public class DisplayPolicy { final WindowFrames windowFrames = win.getWindowFrames(); - windowFrames.setHasOutsets(false); sTmpLastParentFrame.set(windowFrames.mParentFrame); final Rect pf = windowFrames.mParentFrame; final Rect df = windowFrames.mDisplayFrame; - final Rect of = windowFrames.mOverscanFrame; final Rect cf = windowFrames.mContentFrame; final Rect vf = windowFrames.mVisibleFrame; final Rect dcf = windowFrames.mDecorFrame; @@ -1860,21 +1818,20 @@ public class DisplayPolicy { if (type == TYPE_INPUT_METHOD) { vf.set(displayFrames.mDock); cf.set(displayFrames.mDock); - of.set(displayFrames.mDock); df.set(displayFrames.mDock); windowFrames.mParentFrame.set(displayFrames.mDock); // IM dock windows layout below the nav bar... - pf.bottom = df.bottom = of.bottom = displayFrames.mUnrestricted.bottom; + pf.bottom = df.bottom = displayFrames.mUnrestricted.bottom; // ...with content insets above the nav bar cf.bottom = vf.bottom = displayFrames.mStable.bottom; if (mStatusBar != null && mFocusedWindow == mStatusBar && canReceiveInput(mStatusBar)) { // The status bar forces the navigation bar while it's visible. Make sure the IME // avoids the navigation bar in that case. if (mNavigationBarPosition == NAV_BAR_RIGHT) { - pf.right = df.right = of.right = cf.right = vf.right = + pf.right = df.right = cf.right = vf.right = displayFrames.mStable.right; } else if (mNavigationBarPosition == NAV_BAR_LEFT) { - pf.left = df.left = of.left = cf.left = vf.left = displayFrames.mStable.left; + pf.left = df.left = cf.left = vf.left = displayFrames.mStable.left; } } @@ -1897,7 +1854,6 @@ public class DisplayPolicy { // IM dock windows always go to the bottom of the screen. attrs.gravity = Gravity.BOTTOM; } else if (type == TYPE_VOICE_INTERACTION) { - of.set(displayFrames.mUnrestricted); df.set(displayFrames.mUnrestricted); pf.set(displayFrames.mUnrestricted); if (adjust != SOFT_INPUT_ADJUST_RESIZE) { @@ -1911,9 +1867,8 @@ public class DisplayPolicy { vf.set(cf); } } else if (type == TYPE_WALLPAPER) { - layoutWallpaper(displayFrames, pf, df, of, cf); + layoutWallpaper(displayFrames, pf, df, cf); } else if (win == mStatusBar) { - of.set(displayFrames.mUnrestricted); df.set(displayFrames.mUnrestricted); pf.set(displayFrames.mUnrestricted); cf.set(displayFrames.mStable); @@ -1967,7 +1922,7 @@ public class DisplayPolicy { if (attached != null) { // If this window is attached to another, our display // frame is the same as the one we are attached to. - setAttachedWindowFrames(win, fl, adjust, attached, true, pf, df, of, cf, vf, + setAttachedWindowFrames(win, fl, adjust, attached, true, pf, df, cf, vf, displayFrames); } else { if (type == TYPE_STATUS_BAR_PANEL || type == TYPE_STATUS_BAR_SUB_PANEL) { @@ -1977,24 +1932,17 @@ public class DisplayPolicy { // // However, they should still dodge the navigation bar if it exists. - pf.left = df.left = of.left = hasNavBar + pf.left = df.left = hasNavBar ? displayFrames.mDock.left : displayFrames.mUnrestricted.left; - pf.top = df.top = of.top = displayFrames.mUnrestricted.top; - pf.right = df.right = of.right = hasNavBar + pf.top = df.top = displayFrames.mUnrestricted.top; + pf.right = df.right = hasNavBar ? displayFrames.mRestricted.right : displayFrames.mUnrestricted.right; - pf.bottom = df.bottom = of.bottom = hasNavBar + pf.bottom = df.bottom = hasNavBar ? displayFrames.mRestricted.bottom : displayFrames.mUnrestricted.bottom; if (DEBUG_LAYOUT) Slog.v(TAG, "Laying out status bar window: " + pf); - } else if ((fl & FLAG_LAYOUT_IN_OVERSCAN) != 0 - && type >= FIRST_APPLICATION_WINDOW && type <= LAST_SUB_WINDOW) { - // Asking to layout into the overscan region, so give it that pure - // unrestricted area. - of.set(displayFrames.mOverscan); - df.set(displayFrames.mOverscan); - pf.set(displayFrames.mOverscan); } else if ((sysUiFl & SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION) != 0 && (type >= FIRST_APPLICATION_WINDOW && type <= LAST_SUB_WINDOW || type == TYPE_VOLUME_OVERLAY @@ -2003,19 +1951,11 @@ public class DisplayPolicy { // extend into the unrestricted overscan screen area. We only do this for // application windows and certain system windows to ensure no window that // can be above the nav bar can do this. - df.set(displayFrames.mOverscan); - pf.set(displayFrames.mOverscan); - // We need to tell the app about where the frame inside the overscan is, so - // it can inset its content by that amount -- it didn't ask to actually - // extend itself into the overscan region. - of.set(displayFrames.mUnrestricted); + df.set(displayFrames.mUnrestricted); + pf.set(displayFrames.mUnrestricted); } else { - df.set(displayFrames.mRestrictedOverscan); - pf.set(displayFrames.mRestrictedOverscan); - // We need to tell the app about where the frame inside the overscan - // is, so it can inset its content by that amount -- it didn't ask - // to actually extend itself into the overscan region. - of.set(displayFrames.mUnrestricted); + df.set(displayFrames.mRestricted); + pf.set(displayFrames.mRestricted); } if ((fl & FLAG_FULLSCREEN) == 0) { @@ -2053,19 +1993,17 @@ public class DisplayPolicy { // gets everything, period. if (type == TYPE_STATUS_BAR_PANEL || type == TYPE_STATUS_BAR_SUB_PANEL) { cf.set(displayFrames.mUnrestricted); - of.set(displayFrames.mUnrestricted); df.set(displayFrames.mUnrestricted); pf.set(displayFrames.mUnrestricted); if (hasNavBar) { - pf.left = df.left = of.left = cf.left = displayFrames.mDock.left; - pf.right = df.right = of.right = cf.right = displayFrames.mRestricted.right; - pf.bottom = df.bottom = of.bottom = cf.bottom = + pf.left = df.left = cf.left = displayFrames.mDock.left; + pf.right = df.right = cf.right = displayFrames.mRestricted.right; + pf.bottom = df.bottom = cf.bottom = displayFrames.mRestricted.bottom; } if (DEBUG_LAYOUT) Slog.v(TAG, "Laying out IN_SCREEN status bar window: " + pf); } else if (type == TYPE_NAVIGATION_BAR || type == TYPE_NAVIGATION_BAR_PANEL) { // The navigation bar has Real Ultimate Power. - of.set(displayFrames.mUnrestricted); df.set(displayFrames.mUnrestricted); pf.set(displayFrames.mUnrestricted); if (DEBUG_LAYOUT) Slog.v(TAG, "Laying out navigation bar window: " + pf); @@ -2073,24 +2011,14 @@ public class DisplayPolicy { && ((fl & FLAG_FULLSCREEN) != 0)) { // Fullscreen secure system overlays get what they ask for. Screenshot region // selection overlay should also expand to full screen. - cf.set(displayFrames.mOverscan); - of.set(displayFrames.mOverscan); - df.set(displayFrames.mOverscan); - pf.set(displayFrames.mOverscan); + cf.set(displayFrames.mUnrestricted); + df.set(displayFrames.mUnrestricted); + pf.set(displayFrames.mUnrestricted); } else if (type == TYPE_BOOT_PROGRESS) { // Boot progress screen always covers entire display. - cf.set(displayFrames.mOverscan); - of.set(displayFrames.mOverscan); - df.set(displayFrames.mOverscan); - pf.set(displayFrames.mOverscan); - } else if ((fl & FLAG_LAYOUT_IN_OVERSCAN) != 0 - && type >= FIRST_APPLICATION_WINDOW && type <= LAST_SUB_WINDOW) { - // Asking to layout into the overscan region, so give it that pure unrestricted - // area. - cf.set(displayFrames.mOverscan); - of.set(displayFrames.mOverscan); - df.set(displayFrames.mOverscan); - pf.set(displayFrames.mOverscan); + cf.set(displayFrames.mUnrestricted); + df.set(displayFrames.mUnrestricted); + pf.set(displayFrames.mUnrestricted); } else if ((sysUiFl & SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION) != 0 && (type == TYPE_STATUS_BAR || type == TYPE_TOAST @@ -2105,11 +2033,9 @@ public class DisplayPolicy { // ask for layout in only content. We can't currently figure out // what the screen would be if only laying out to hide the nav bar. cf.set(displayFrames.mUnrestricted); - of.set(displayFrames.mUnrestricted); df.set(displayFrames.mUnrestricted); pf.set(displayFrames.mUnrestricted); } else if ((sysUiFl & View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN) != 0) { - of.set(displayFrames.mRestricted); df.set(displayFrames.mRestricted); pf.set(displayFrames.mRestricted); @@ -2123,7 +2049,6 @@ public class DisplayPolicy { } } else { cf.set(displayFrames.mRestricted); - of.set(displayFrames.mRestricted); df.set(displayFrames.mRestricted); pf.set(displayFrames.mRestricted); } @@ -2140,7 +2065,7 @@ public class DisplayPolicy { + "): attached to " + attached); // A child window should be placed inside of the same visible // frame that its parent had. - setAttachedWindowFrames(win, fl, adjust, attached, false, pf, df, of, cf, vf, + setAttachedWindowFrames(win, fl, adjust, attached, false, pf, df, cf, vf, displayFrames); } else { if (DEBUG_LAYOUT) Slog.v(TAG, "layoutWindowLw(" + attrs.getTitle() @@ -2152,28 +2077,23 @@ public class DisplayPolicy { // top of the status bar. They are protected by the STATUS_BAR_SERVICE // permission, so they have the same privileges as the status bar itself. cf.set(displayFrames.mRestricted); - of.set(displayFrames.mRestricted); df.set(displayFrames.mRestricted); pf.set(displayFrames.mRestricted); } else if (type == TYPE_TOAST || type == TYPE_SYSTEM_ALERT) { // These dialogs are stable to interim decor changes. cf.set(displayFrames.mStable); - of.set(displayFrames.mStable); df.set(displayFrames.mStable); pf.set(displayFrames.mStable); } else { pf.set(displayFrames.mContent); if (win.isVoiceInteraction()) { cf.set(displayFrames.mVoiceContent); - of.set(displayFrames.mVoiceContent); df.set(displayFrames.mVoiceContent); } else if (adjust != SOFT_INPUT_ADJUST_RESIZE) { cf.set(displayFrames.mDock); - of.set(displayFrames.mDock); df.set(displayFrames.mDock); } else { cf.set(displayFrames.mContent); - of.set(displayFrames.mContent); df.set(displayFrames.mContent); } if (adjust != SOFT_INPUT_ADJUST_NOTHING) { @@ -2252,34 +2172,8 @@ public class DisplayPolicy { df.left = df.top = -10000; df.right = df.bottom = 10000; if (type != TYPE_WALLPAPER) { - of.left = of.top = cf.left = cf.top = vf.left = vf.top = -10000; - of.right = of.bottom = cf.right = cf.bottom = vf.right = vf.bottom = 10000; - } - } - - // If the device has a chin (e.g. some watches), a dead area at the bottom of the screen we - // need to provide information to the clients that want to pretend that you can draw there. - // We only want to apply outsets to certain types of windows. For example, we never want to - // apply the outsets to floating dialogs, because they wouldn't make sense there. - final boolean useOutsets = shouldUseOutsets(attrs, fl); - if (isDefaultDisplay && useOutsets) { - final Rect osf = windowFrames.mOutsetFrame; - osf.set(cf.left, cf.top, cf.right, cf.bottom); - windowFrames.setHasOutsets(true); - int outset = mWindowOutsetBottom; - if (outset > 0) { - int rotation = displayFrames.mRotation; - if (rotation == Surface.ROTATION_0) { - osf.bottom += outset; - } else if (rotation == Surface.ROTATION_90) { - osf.right += outset; - } else if (rotation == Surface.ROTATION_180) { - osf.top -= outset; - } else if (rotation == Surface.ROTATION_270) { - osf.left -= outset; - } - if (DEBUG_LAYOUT) Slog.v(TAG, "applying bottom outset of " + outset - + " with rotation " + rotation + ", result: " + osf); + cf.left = cf.top = vf.left = vf.top = -10000; + cf.right = cf.bottom = vf.right = vf.bottom = 10000; } } @@ -2288,11 +2182,9 @@ public class DisplayPolicy { + " attach=" + attached + " type=" + type + String.format(" flags=0x%08x", fl) + " pf=" + pf.toShortString() + " df=" + df.toShortString() - + " of=" + of.toShortString() + " cf=" + cf.toShortString() + " vf=" + vf.toShortString() + " dcf=" + dcf.toShortString() - + " sf=" + sf.toShortString() - + " osf=" + windowFrames.mOutsetFrame.toShortString() + " " + win); + + " sf=" + sf.toShortString()); if (!sTmpLastParentFrame.equals(pf)) { windowFrames.setContentChanged(true); @@ -2311,12 +2203,11 @@ public class DisplayPolicy { } } - private void layoutWallpaper(DisplayFrames displayFrames, Rect pf, Rect df, Rect of, Rect cf) { - // The wallpaper has Real Ultimate Power, but we want to tell it about the overscan area. - df.set(displayFrames.mOverscan); - pf.set(displayFrames.mOverscan); + private void layoutWallpaper(DisplayFrames displayFrames, Rect pf, Rect df, Rect cf) { + // The wallpaper has Real Ultimate Power + df.set(displayFrames.mUnrestricted); + pf.set(displayFrames.mUnrestricted); cf.set(displayFrames.mUnrestricted); - of.set(displayFrames.mUnrestricted); } private void offsetInputMethodWindowLw(WindowState win, DisplayFrames displayFrames) { @@ -2722,7 +2613,6 @@ public class DisplayPolicy { - getNavigationBarFrameHeight(portraitRotation, uiMode); updateConfigurationAndScreenSizeDependentBehaviors(); - mWindowOutsetBottom = ScreenShapeHelper.getWindowOutsetBottomPx(mContext.getResources()); } void updateConfigurationAndScreenSizeDependentBehaviors() { diff --git a/services/core/java/com/android/server/wm/DisplayWindowSettings.java b/services/core/java/com/android/server/wm/DisplayWindowSettings.java index 8507918df480..dac8b14c8ff1 100644 --- a/services/core/java/com/android/server/wm/DisplayWindowSettings.java +++ b/services/core/java/com/android/server/wm/DisplayWindowSettings.java @@ -100,10 +100,6 @@ class DisplayWindowSettings { private static class Entry { private final String mName; - private int mOverscanLeft; - private int mOverscanTop; - private int mOverscanRight; - private int mOverscanBottom; private int mWindowingMode = WindowConfiguration.WINDOWING_MODE_UNDEFINED; private int mUserRotationMode = WindowManagerPolicy.USER_ROTATION_FREE; private int mUserRotation = Surface.ROTATION_0; @@ -124,10 +120,6 @@ class DisplayWindowSettings { private Entry(String name, Entry copyFrom) { this(name); - mOverscanLeft = copyFrom.mOverscanLeft; - mOverscanTop = copyFrom.mOverscanTop; - mOverscanRight = copyFrom.mOverscanRight; - mOverscanBottom = copyFrom.mOverscanBottom; mWindowingMode = copyFrom.mWindowingMode; mUserRotationMode = copyFrom.mUserRotationMode; mUserRotation = copyFrom.mUserRotation; @@ -144,9 +136,7 @@ class DisplayWindowSettings { /** @return {@code true} if all values are default. */ private boolean isEmpty() { - return mOverscanLeft == 0 && mOverscanTop == 0 && mOverscanRight == 0 - && mOverscanBottom == 0 - && mWindowingMode == WindowConfiguration.WINDOWING_MODE_UNDEFINED + return mWindowingMode == WindowConfiguration.WINDOWING_MODE_UNDEFINED && mUserRotationMode == WindowManagerPolicy.USER_ROTATION_FREE && mUserRotation == Surface.ROTATION_0 && mForcedWidth == 0 && mForcedHeight == 0 && mForcedDensity == 0 @@ -202,15 +192,6 @@ class DisplayWindowSettings { return newEntry; } - void setOverscanLocked(DisplayInfo displayInfo, int left, int top, int right, int bottom) { - final Entry entry = getOrCreateEntry(displayInfo); - entry.mOverscanLeft = left; - entry.mOverscanTop = top; - entry.mOverscanRight = right; - entry.mOverscanBottom = bottom; - writeSettingsIfNeeded(entry, displayInfo); - } - void setUserRotation(DisplayContent displayContent, int rotationMode, int rotation) { final DisplayInfo displayInfo = displayContent.getDisplayInfo(); final Entry entry = getOrCreateEntry(displayInfo); @@ -405,11 +386,6 @@ class DisplayWindowSettings { // Setting windowing mode first, because it may override overscan values later. dc.setWindowingMode(getWindowingModeLocked(entry, dc.getDisplayId())); - displayInfo.overscanLeft = entry.mOverscanLeft; - displayInfo.overscanTop = entry.mOverscanTop; - displayInfo.overscanRight = entry.mOverscanRight; - displayInfo.overscanBottom = entry.mOverscanBottom; - dc.getDisplayRotation().restoreSettings(entry.mUserRotationMode, entry.mUserRotation, entry.mFixedToUserRotation); @@ -536,10 +512,6 @@ class DisplayWindowSettings { String name = parser.getAttributeValue(null, "name"); if (name != null) { Entry entry = new Entry(name); - entry.mOverscanLeft = getIntAttribute(parser, "overscanLeft"); - entry.mOverscanTop = getIntAttribute(parser, "overscanTop"); - entry.mOverscanRight = getIntAttribute(parser, "overscanRight"); - entry.mOverscanBottom = getIntAttribute(parser, "overscanBottom"); entry.mWindowingMode = getIntAttribute(parser, "windowingMode", WindowConfiguration.WINDOWING_MODE_UNDEFINED); entry.mUserRotationMode = getIntAttribute(parser, "userRotationMode", @@ -602,18 +574,6 @@ class DisplayWindowSettings { for (Entry entry : mEntries.values()) { out.startTag(null, "display"); out.attribute(null, "name", entry.mName); - if (entry.mOverscanLeft != 0) { - out.attribute(null, "overscanLeft", Integer.toString(entry.mOverscanLeft)); - } - if (entry.mOverscanTop != 0) { - out.attribute(null, "overscanTop", Integer.toString(entry.mOverscanTop)); - } - if (entry.mOverscanRight != 0) { - out.attribute(null, "overscanRight", Integer.toString(entry.mOverscanRight)); - } - if (entry.mOverscanBottom != 0) { - out.attribute(null, "overscanBottom", Integer.toString(entry.mOverscanBottom)); - } if (entry.mWindowingMode != WindowConfiguration.WINDOWING_MODE_UNDEFINED) { out.attribute(null, "windowingMode", Integer.toString(entry.mWindowingMode)); } diff --git a/services/core/java/com/android/server/wm/RootWindowContainer.java b/services/core/java/com/android/server/wm/RootWindowContainer.java index 149bcfb991ea..63b11ffe158d 100644 --- a/services/core/java/com/android/server/wm/RootWindowContainer.java +++ b/services/core/java/com/android/server/wm/RootWindowContainer.java @@ -818,10 +818,6 @@ class RootWindowContainer extends WindowContainer<DisplayContent> if (mWmService.mStrictModeFlash != null) { mWmService.mStrictModeFlash.positionSurface(defaultDw, defaultDh, mDisplayTransaction); } - if (mWmService.mCircularDisplayMask != null) { - mWmService.mCircularDisplayMask.positionSurface(defaultDw, defaultDh, - mWmService.getDefaultDisplayRotation(), mDisplayTransaction); - } if (mWmService.mEmulatorDisplayOverlay != null) { mWmService.mEmulatorDisplayOverlay.positionSurface(defaultDw, defaultDh, mWmService.getDefaultDisplayRotation(), mDisplayTransaction); diff --git a/services/core/java/com/android/server/wm/Session.java b/services/core/java/com/android/server/wm/Session.java index 96be7cc416bd..265ca91e1d21 100644 --- a/services/core/java/com/android/server/wm/Session.java +++ b/services/core/java/com/android/server/wm/Session.java @@ -155,11 +155,11 @@ class Session extends IWindowSession.Stub implements IBinder.DeathRecipient { @Override public int addToDisplay(IWindow window, int seq, WindowManager.LayoutParams attrs, int viewVisibility, int displayId, Rect outFrame, Rect outContentInsets, - Rect outStableInsets, Rect outOutsets, + Rect outStableInsets, DisplayCutout.ParcelableWrapper outDisplayCutout, InputChannel outInputChannel, InsetsState outInsetsState) { return mService.addWindow(this, window, seq, attrs, viewVisibility, displayId, outFrame, - outContentInsets, outStableInsets, outOutsets, outDisplayCutout, outInputChannel, + outContentInsets, outStableInsets, outDisplayCutout, outInputChannel, outInsetsState); } @@ -168,7 +168,7 @@ class Session extends IWindowSession.Stub implements IBinder.DeathRecipient { int viewVisibility, int displayId, Rect outContentInsets, Rect outStableInsets, InsetsState outInsetsState) { return mService.addWindow(this, window, seq, attrs, viewVisibility, displayId, - new Rect() /* outFrame */, outContentInsets, outStableInsets, null /* outOutsets */, + new Rect() /* outFrame */, outContentInsets, outStableInsets, new DisplayCutout.ParcelableWrapper() /* cutout */, null /* outInputChannel */, outInsetsState); } @@ -186,8 +186,8 @@ class Session extends IWindowSession.Stub implements IBinder.DeathRecipient { @Override public int relayout(IWindow window, int seq, WindowManager.LayoutParams attrs, int requestedWidth, int requestedHeight, int viewFlags, int flags, long frameNumber, - Rect outFrame, Rect outOverscanInsets, Rect outContentInsets, Rect outVisibleInsets, - Rect outStableInsets, Rect outsets, Rect outBackdropFrame, + Rect outFrame, Rect outContentInsets, Rect outVisibleInsets, + Rect outStableInsets, Rect outBackdropFrame, DisplayCutout.ParcelableWrapper cutout, MergedConfiguration mergedConfiguration, SurfaceControl outSurfaceControl, InsetsState outInsetsState) { if (false) Slog.d(TAG_WM, ">>>>>> ENTERED relayout from " @@ -195,8 +195,8 @@ class Session extends IWindowSession.Stub implements IBinder.DeathRecipient { Trace.traceBegin(TRACE_TAG_WINDOW_MANAGER, mRelayoutTag); int res = mService.relayoutWindow(this, window, seq, attrs, requestedWidth, requestedHeight, viewFlags, flags, frameNumber, - outFrame, outOverscanInsets, outContentInsets, outVisibleInsets, - outStableInsets, outsets, outBackdropFrame, cutout, + outFrame, outContentInsets, outVisibleInsets, + outStableInsets, outBackdropFrame, cutout, mergedConfiguration, outSurfaceControl, outInsetsState); Trace.traceEnd(TRACE_TAG_WINDOW_MANAGER); if (false) Slog.d(TAG_WM, "<<<<<< EXITING relayout to " diff --git a/services/core/java/com/android/server/wm/TaskSnapshotSurface.java b/services/core/java/com/android/server/wm/TaskSnapshotSurface.java index b1e5c8f7f5ee..b3750e95fb36 100644 --- a/services/core/java/com/android/server/wm/TaskSnapshotSurface.java +++ b/services/core/java/com/android/server/wm/TaskSnapshotSurface.java @@ -209,7 +209,7 @@ class TaskSnapshotSurface implements StartingSurface { try { final int res = session.addToDisplay(window, window.mSeq, layoutParams, View.GONE, activity.getDisplayContent().getDisplayId(), tmpFrame, tmpRect, tmpRect, - tmpRect, tmpCutout, null, mTmpInsetsState); + tmpCutout, null, mTmpInsetsState); if (res < 0) { Slog.w(TAG, "Failed to add snapshot starting window res=" + res); return null; @@ -224,7 +224,7 @@ class TaskSnapshotSurface implements StartingSurface { window.setOuter(snapshotSurface); try { session.relayout(window, window.mSeq, layoutParams, -1, -1, View.VISIBLE, 0, -1, - tmpFrame, tmpRect, tmpContentInsets, tmpRect, tmpStableInsets, tmpRect, tmpRect, + tmpFrame, tmpContentInsets, tmpRect, tmpStableInsets, tmpRect, tmpCutout, tmpMergedConfiguration, surfaceControl, mTmpInsetsState); } catch (RemoteException e) { // Local call. @@ -466,8 +466,8 @@ class TaskSnapshotSurface implements StartingSurface { } @Override - public void resized(Rect frame, Rect overscanInsets, Rect contentInsets, Rect visibleInsets, - Rect stableInsets, Rect outsets, boolean reportDraw, + public void resized(Rect frame, Rect contentInsets, Rect visibleInsets, + Rect stableInsets, boolean reportDraw, MergedConfiguration mergedConfiguration, Rect backDropFrame, boolean forceLayout, boolean alwaysConsumeSystemBars, int displayId, DisplayCutout.ParcelableWrapper displayCutout) { diff --git a/services/core/java/com/android/server/wm/WindowFrames.java b/services/core/java/com/android/server/wm/WindowFrames.java index 9fe47604d704..70fc19470f83 100644 --- a/services/core/java/com/android/server/wm/WindowFrames.java +++ b/services/core/java/com/android/server/wm/WindowFrames.java @@ -23,10 +23,6 @@ import static com.android.server.wm.WindowFramesProto.CUTOUT; import static com.android.server.wm.WindowFramesProto.DECOR_FRAME; import static com.android.server.wm.WindowFramesProto.DISPLAY_FRAME; import static com.android.server.wm.WindowFramesProto.FRAME; -import static com.android.server.wm.WindowFramesProto.OUTSETS; -import static com.android.server.wm.WindowFramesProto.OUTSET_FRAME; -import static com.android.server.wm.WindowFramesProto.OVERSCAN_FRAME; -import static com.android.server.wm.WindowFramesProto.OVERSCAN_INSETS; import static com.android.server.wm.WindowFramesProto.PARENT_FRAME; import static com.android.server.wm.WindowFramesProto.STABLE_INSETS; import static com.android.server.wm.WindowFramesProto.VISIBLE_FRAME; @@ -70,14 +66,6 @@ public class WindowFrames { public final Rect mDisplayFrame = new Rect(); /** - * The region of the display frame that the display type supports displaying content on. This - * is mostly a special case for TV where some displays don’t have the entire display usable. - * {@link android.view.WindowManager.LayoutParams#FLAG_LAYOUT_IN_OVERSCAN} flag can be used to - * allow window display contents to extend into the overscan region. - */ - public final Rect mOverscanFrame = new Rect(); - - /** * Legacy stuff. Generally equal to the content frame expect when the IME for older apps * displays hint text. */ @@ -102,12 +90,6 @@ public class WindowFrames { public final Rect mStableFrame = new Rect(); /** - * Frame that includes dead area outside of the surface but where we want to pretend that it's - * possible to draw. - */ - final public Rect mOutsetFrame = new Rect(); - - /** * Similar to {@link #mDisplayFrame} * * TODO: Why is this different than mDisplayFrame @@ -148,14 +130,6 @@ public class WindowFrames { private boolean mDisplayCutoutChanged; /** - * Insets that determine the area covered by the display overscan region. These are in the - * application's coordinate space (without compatibility scale applied). - */ - final Rect mOverscanInsets = new Rect(); - final Rect mLastOverscanInsets = new Rect(); - private boolean mOverscanInsetsChanged; - - /** * Insets that determine the area covered by the stable system windows. These are in the * application's coordinate space (without compatibility scale applied). */ @@ -164,14 +138,6 @@ public class WindowFrames { private boolean mStableInsetsChanged; /** - * Outsets determine the area outside of the surface where we want to pretend that it's possible - * to draw anyway. - */ - final Rect mOutsets = new Rect(); - final Rect mLastOutsets = new Rect(); - private boolean mOutsetsChanged = false; - - /** * Insets that determine the actually visible area. These are in the application's * coordinate space (without compatibility scale applied). */ @@ -190,30 +156,25 @@ public class WindowFrames { private final Rect mTmpRect = new Rect(); - private boolean mHasOutsets; - private boolean mContentChanged; public WindowFrames() { } - public WindowFrames(Rect parentFrame, Rect displayFrame, Rect overscanFrame, Rect contentFrame, - Rect visibleFrame, Rect decorFrame, Rect stableFrame, Rect outsetFrame) { - setFrames(parentFrame, displayFrame, overscanFrame, contentFrame, visibleFrame, decorFrame, - stableFrame, outsetFrame); + public WindowFrames(Rect parentFrame, Rect displayFrame, Rect contentFrame, + Rect visibleFrame, Rect decorFrame, Rect stableFrame) { + setFrames(parentFrame, displayFrame, contentFrame, visibleFrame, decorFrame, + stableFrame); } - public void setFrames(Rect parentFrame, Rect displayFrame, Rect overscanFrame, - Rect contentFrame, Rect visibleFrame, Rect decorFrame, Rect stableFrame, - Rect outsetFrame) { + public void setFrames(Rect parentFrame, Rect displayFrame, + Rect contentFrame, Rect visibleFrame, Rect decorFrame, Rect stableFrame) { mParentFrame.set(parentFrame); mDisplayFrame.set(displayFrame); - mOverscanFrame.set(overscanFrame); mContentFrame.set(contentFrame); mVisibleFrame.set(visibleFrame); mDecorFrame.set(decorFrame); mStableFrame.set(stableFrame); - mOutsetFrame.set(outsetFrame); } public void setParentFrameWasClippedByDisplayCutout( @@ -237,17 +198,6 @@ public class WindowFrames { } /** - * Calculates the outsets for this windowFrame. The outsets are calculated by the area between - * the {@link #mOutsetFrame} and the {@link #mContentFrame}. If there are no outsets, then - * {@link #mOutsets} is set to empty. - */ - void calculateOutsets() { - if (mHasOutsets) { - InsetUtils.insetsBetweenFrames(mOutsetFrame, mContentFrame, mOutsets); - } - } - - /** * Calculate the insets for the type * {@link android.view.WindowManager.LayoutParams#TYPE_DOCK_DIVIDER} * @@ -301,11 +251,9 @@ public class WindowFrames { * @param scale The amount to scale the insets by. */ void scaleInsets(float scale) { - mOverscanInsets.scale(scale); mContentInsets.scale(scale); mVisibleInsets.scale(scale); mStableInsets.scale(scale); - mOutsets.scale(scale); } void offsetFrames(int layoutXDiff, int layoutYDiff) { @@ -321,15 +269,13 @@ public class WindowFrames { * @return true if info about size has changed since last reported. */ boolean setReportResizeHints() { - mOverscanInsetsChanged |= !mLastOverscanInsets.equals(mOverscanInsets); mContentInsetsChanged |= !mLastContentInsets.equals(mContentInsets); mVisibleInsetsChanged |= !mLastVisibleInsets.equals(mVisibleInsets); mStableInsetsChanged |= !mLastStableInsets.equals(mStableInsets); - mOutsetsChanged |= !mLastOutsets.equals(mOutsets); mFrameSizeChanged |= didFrameSizeChange(); mDisplayCutoutChanged |= !mLastDisplayCutout.equals(mDisplayCutout); - return mOverscanInsetsChanged || mContentInsetsChanged || mVisibleInsetsChanged - || mStableInsetsChanged || mOutsetsChanged || mFrameSizeChanged + return mContentInsetsChanged || mVisibleInsetsChanged + || mStableInsetsChanged || mFrameSizeChanged || mDisplayCutoutChanged; } @@ -338,11 +284,9 @@ public class WindowFrames { * after the insets are reported to client. */ void resetInsetsChanged() { - mOverscanInsetsChanged = false; mContentInsetsChanged = false; mVisibleInsetsChanged = false; mStableInsetsChanged = false; - mOutsetsChanged = false; mFrameSizeChanged = false; mDisplayCutoutChanged = false; } @@ -351,11 +295,9 @@ public class WindowFrames { * Copy over inset values as the last insets that were sent to the client. */ void updateLastInsetValues() { - mLastOverscanInsets.set(mOverscanInsets); mLastContentInsets.set(mContentInsets); mLastVisibleInsets.set(mVisibleInsets); mLastStableInsets.set(mStableInsets); - mLastOutsets.set(mOutsets); mLastDisplayCutout = mDisplayCutout; } @@ -368,19 +310,6 @@ public class WindowFrames { } /** - * Sets whether the frame has outsets. - */ - public void setHasOutsets(boolean hasOutsets) { - if (mHasOutsets == hasOutsets) { - return; - } - mHasOutsets = hasOutsets; - if (!hasOutsets) { - mOutsets.setEmpty(); - } - } - - /** * Sets whether the content has changed. This means that either the size or parent frame has * changed. */ @@ -400,18 +329,14 @@ public class WindowFrames { mParentFrame.writeToProto(proto, PARENT_FRAME); mContentFrame.writeToProto(proto, CONTENT_FRAME); mDisplayFrame.writeToProto(proto, DISPLAY_FRAME); - mOverscanFrame.writeToProto(proto, OVERSCAN_FRAME); mVisibleFrame.writeToProto(proto, VISIBLE_FRAME); mDecorFrame.writeToProto(proto, DECOR_FRAME); - mOutsetFrame.writeToProto(proto, OUTSET_FRAME); mContainingFrame.writeToProto(proto, CONTAINING_FRAME); mFrame.writeToProto(proto, FRAME); mDisplayCutout.getDisplayCutout().writeToProto(proto, CUTOUT); mContentInsets.writeToProto(proto, CONTENT_INSETS); - mOverscanInsets.writeToProto(proto, OVERSCAN_INSETS); mVisibleInsets.writeToProto(proto, VISIBLE_INSETS); mStableInsets.writeToProto(proto, STABLE_INSETS); - mOutsets.writeToProto(proto, OUTSETS); proto.end(token); } @@ -420,33 +345,26 @@ public class WindowFrames { pw.println(prefix + "Frames: containing=" + mContainingFrame.toShortString(sTmpSB) + " parent=" + mParentFrame.toShortString(sTmpSB)); - pw.println(prefix + " display=" + mDisplayFrame.toShortString(sTmpSB) - + " overscan=" + mOverscanFrame.toShortString(sTmpSB)); + pw.println(prefix + " display=" + mDisplayFrame.toShortString(sTmpSB)); pw.println(prefix + " content=" + mContentFrame.toShortString(sTmpSB) + " visible=" + mVisibleFrame.toShortString(sTmpSB)); pw.println(prefix + " decor=" + mDecorFrame.toShortString(sTmpSB)); - pw.println(prefix + " outset=" + mOutsetFrame.toShortString(sTmpSB)); pw.println(prefix + "mFrame=" + mFrame.toShortString(sTmpSB) + " last=" + mLastFrame.toShortString(sTmpSB)); pw.println(prefix + " cutout=" + mDisplayCutout.getDisplayCutout() + " last=" + mLastDisplayCutout.getDisplayCutout()); - pw.print(prefix + "Cur insets: overscan=" + mOverscanInsets.toShortString(sTmpSB) - + " content=" + mContentInsets.toShortString(sTmpSB) + pw.print(prefix + "Cur insets: content=" + mContentInsets.toShortString(sTmpSB) + " visible=" + mVisibleInsets.toShortString(sTmpSB) - + " stable=" + mStableInsets.toShortString(sTmpSB) - + " outsets=" + mOutsets.toShortString(sTmpSB)); - pw.println(prefix + "Lst insets: overscan=" + mLastOverscanInsets.toShortString(sTmpSB) - + " content=" + mLastContentInsets.toShortString(sTmpSB) + + " stable=" + mStableInsets.toShortString(sTmpSB)); + pw.println(prefix + "Lst insets: content=" + mLastContentInsets.toShortString(sTmpSB) + " visible=" + mLastVisibleInsets.toShortString(sTmpSB) - + " stable=" + mLastStableInsets.toShortString(sTmpSB) - + " outset=" + mLastOutsets.toShortString(sTmpSB)); + + " stable=" + mLastStableInsets.toShortString(sTmpSB)); } String getInsetsInfo() { return "ci=" + mContentInsets.toShortString() + " vi=" + mVisibleInsets.toShortString() - + " si=" + mStableInsets.toShortString() - + " of=" + mOutsets.toShortString(); + + " si=" + mStableInsets.toShortString(); } String getInsetsChangedInfo() { @@ -456,8 +374,6 @@ public class WindowFrames { + " " + mVisibleInsets.toShortString() + " stableInsetsChanged=" + mStableInsetsChanged + " " + mStableInsets.toShortString() - + " outsetsChanged=" + mOutsetsChanged - + " " + mOutsets.toShortString() + " displayCutoutChanged=" + mDisplayCutoutChanged; } } diff --git a/services/core/java/com/android/server/wm/WindowManagerService.java b/services/core/java/com/android/server/wm/WindowManagerService.java index fc8705bbaae6..649f347f5004 100644 --- a/services/core/java/com/android/server/wm/WindowManagerService.java +++ b/services/core/java/com/android/server/wm/WindowManagerService.java @@ -591,7 +591,6 @@ public class WindowManagerService extends IWindowManager.Stub Watermark mWatermark; StrictModeFlash mStrictModeFlash; - CircularDisplayMask mCircularDisplayMask; EmulatorDisplayOverlay mEmulatorDisplayOverlay; final float[] mTmpFloats = new float[9]; @@ -760,11 +759,6 @@ public class WindowManagerService extends IWindowManager.Stub return; } - if (mDisplayInversionEnabledUri.equals(uri)) { - updateCircularDisplayMaskIfNeeded(); - return; - } - if (mPointerLocationUri.equals(uri)) { updatePointerLocation(); return; @@ -1332,7 +1326,7 @@ public class WindowManagerService extends IWindowManager.Stub public int addWindow(Session session, IWindow client, int seq, LayoutParams attrs, int viewVisibility, int displayId, Rect outFrame, - Rect outContentInsets, Rect outStableInsets, Rect outOutsets, + Rect outContentInsets, Rect outStableInsets, DisplayCutout.ParcelableWrapper outDisplayCutout, InputChannel outInputChannel, InsetsState outInsetsState) { int[] appOp = new int[1]; @@ -1684,7 +1678,7 @@ public class WindowManagerService extends IWindowManager.Stub floatingStack = false; } if (displayPolicy.getLayoutHintLw(win.mAttrs, taskBounds, displayFrames, floatingStack, - outFrame, outContentInsets, outStableInsets, outOutsets, outDisplayCutout)) { + outFrame, outContentInsets, outStableInsets, outDisplayCutout)) { res |= WindowManagerGlobal.ADD_FLAG_ALWAYS_CONSUME_SYSTEM_BARS; } outInsetsState.set(displayContent.getInsetsPolicy().getInsetsForDispatch(win)); @@ -2087,8 +2081,8 @@ public class WindowManagerService extends IWindowManager.Stub public int relayoutWindow(Session session, IWindow client, int seq, LayoutParams attrs, int requestedWidth, int requestedHeight, int viewVisibility, int flags, - long frameNumber, Rect outFrame, Rect outOverscanInsets, Rect outContentInsets, - Rect outVisibleInsets, Rect outStableInsets, Rect outOutsets, Rect outBackdropFrame, + long frameNumber, Rect outFrame, Rect outContentInsets, + Rect outVisibleInsets, Rect outStableInsets, Rect outBackdropFrame, DisplayCutout.ParcelableWrapper outCutout, MergedConfiguration mergedConfiguration, SurfaceControl outSurfaceControl, InsetsState outInsetsState) { int result = 0; @@ -2380,8 +2374,8 @@ public class WindowManagerService extends IWindowManager.Stub win.updateLastInsetValues(); win.getCompatFrame(outFrame); - win.getInsetsForRelayout(outOverscanInsets, outContentInsets, outVisibleInsets, - outStableInsets, outOutsets); + win.getInsetsForRelayout(outContentInsets, outVisibleInsets, + outStableInsets); outCutout.set(win.getWmDisplayCutout().getDisplayCutout()); outBackdropFrame.set(win.getBackdropFrame(win.getFrameLw())); outInsetsState.set(displayContent.getInsetsPolicy().getInsetsForDispatch(win)); @@ -3428,26 +3422,6 @@ public class WindowManagerService extends IWindowManager.Stub } } - private void updateCircularDisplayMaskIfNeeded() { - if (mContext.getResources().getConfiguration().isScreenRound() - && mContext.getResources().getBoolean( - com.android.internal.R.bool.config_windowShowCircularMask)) { - final int currentUserId; - synchronized (mGlobalLock) { - currentUserId = mCurrentUserId; - } - // Device configuration calls for a circular display mask, but we only enable the mask - // if the accessibility color inversion feature is disabled, as the inverted mask - // causes artifacts. - int inversionState = Settings.Secure.getIntForUser(mContext.getContentResolver(), - Settings.Secure.ACCESSIBILITY_DISPLAY_INVERSION_ENABLED, 0, currentUserId); - int showMask = (inversionState == 1) ? 0 : 1; - Message m = mH.obtainMessage(H.SHOW_CIRCULAR_DISPLAY_MASK); - m.arg1 = showMask; - mH.sendMessage(m); - } - } - public void showEmulatorDisplayOverlayIfNeeded() { if (mContext.getResources().getBoolean( com.android.internal.R.bool.config_windowEnableCircularEmulatorDisplayOverlay) @@ -3457,35 +3431,6 @@ public class WindowManagerService extends IWindowManager.Stub } } - public void showCircularMask(boolean visible) { - synchronized (mGlobalLock) { - if (visible) { - // TODO(multi-display): support multiple displays - if (mCircularDisplayMask == null) { - int screenOffset = mContext.getResources().getInteger( - com.android.internal.R.integer.config_windowOutsetBottom); - int maskThickness = mContext.getResources().getDimensionPixelSize( - com.android.internal.R.dimen.circular_display_mask_thickness); - - - if (SHOW_LIGHT_TRANSACTIONS) { - Slog.i(TAG_WM, - ">>> showCircularMask(visible=" + visible + ")"); - } - mCircularDisplayMask = new CircularDisplayMask(mSurfaceFactory, - getDefaultDisplayContentLocked(), mPolicy.getWindowLayerFromTypeLw( - WindowManager.LayoutParams.TYPE_POINTER) * TYPE_LAYER_MULTIPLIER - + 10, screenOffset, maskThickness, mTransaction); - } - mCircularDisplayMask.setVisibility(true, mTransaction); - } else if (mCircularDisplayMask != null) { - mCircularDisplayMask.setVisibility(false, mTransaction); - mCircularDisplayMask = null; - } - mTransaction.apply(); - } - } - public void showEmulatorDisplayOverlay() { synchronized (mGlobalLock) { @@ -4436,8 +4381,6 @@ public class WindowManagerService extends IWindowManager.Stub mActivityTaskManager.updateConfiguration(null); } catch (RemoteException e) { } - - updateCircularDisplayMaskIfNeeded(); } public void systemReady() { @@ -4520,7 +4463,6 @@ public class WindowManagerService extends IWindowManager.Stub public static final int NEW_ANIMATOR_SCALE = 34; - public static final int SHOW_CIRCULAR_DISPLAY_MASK = 35; public static final int SHOW_EMULATOR_DISPLAY_OVERLAY = 36; public static final int CHECK_IF_BOOT_ANIMATION_FINISHED = 37; @@ -4754,11 +4696,6 @@ public class WindowManagerService extends IWindowManager.Stub break; } - case SHOW_CIRCULAR_DISPLAY_MASK: { - showCircularMask(msg.arg1 == 1); - break; - } - case SHOW_EMULATOR_DISPLAY_OVERLAY: { showEmulatorDisplayOverlay(); break; @@ -5168,38 +5105,6 @@ public class WindowManagerService extends IWindowManager.Stub } @Override - public void setOverscan(int displayId, int left, int top, int right, int bottom) { - if (mContext.checkCallingOrSelfPermission(WRITE_SECURE_SETTINGS) - != PackageManager.PERMISSION_GRANTED) { - throw new SecurityException("Must hold permission " + WRITE_SECURE_SETTINGS); - } - final long ident = Binder.clearCallingIdentity(); - try { - synchronized (mGlobalLock) { - DisplayContent displayContent = mRoot.getDisplayContent(displayId); - if (displayContent != null) { - setOverscanLocked(displayContent, left, top, right, bottom); - } - } - } finally { - Binder.restoreCallingIdentity(ident); - } - } - - private void setOverscanLocked(DisplayContent displayContent, - int left, int top, int right, int bottom) { - final DisplayInfo displayInfo = displayContent.getDisplayInfo(); - displayInfo.overscanLeft = left; - displayInfo.overscanTop = top; - displayInfo.overscanRight = right; - displayInfo.overscanBottom = bottom; - - mDisplayWindowSettings.setOverscanLocked(displayInfo, left, top, right, bottom); - - displayContent.reconfigureDisplayLocked(); - } - - @Override public void startWindowTrace(){ mWindowTracing.startTrace(null /* printwriter */); } diff --git a/services/core/java/com/android/server/wm/WindowManagerShellCommand.java b/services/core/java/com/android/server/wm/WindowManagerShellCommand.java index e01cbf26dadc..8e955cf3a8bb 100644 --- a/services/core/java/com/android/server/wm/WindowManagerShellCommand.java +++ b/services/core/java/com/android/server/wm/WindowManagerShellCommand.java @@ -66,8 +66,6 @@ public class WindowManagerShellCommand extends ShellCommand { return runDisplayDensity(pw); case "folded-area": return runDisplayFoldedArea(pw); - case "overscan": - return runDisplayOverscan(pw); case "scaling": return runDisplayScaling(pw); case "dismiss-keyguard": @@ -247,30 +245,6 @@ public class WindowManagerShellCommand extends ShellCommand { return 0; } - private int runDisplayOverscan(PrintWriter pw) throws RemoteException { - String overscanStr = getNextArgRequired(); - Rect rect = new Rect(); - final int displayId = getDisplayId(overscanStr); - if ("reset".equals(overscanStr)) { - rect.set(0, 0, 0, 0); - } else { - final Pattern FLATTENED_PATTERN = Pattern.compile( - "(-?\\d+),(-?\\d+),(-?\\d+),(-?\\d+)"); - Matcher matcher = FLATTENED_PATTERN.matcher(overscanStr); - if (!matcher.matches()) { - getErrPrintWriter().println("Error: bad rectangle arg: " + overscanStr); - return -1; - } - rect.left = Integer.parseInt(matcher.group(1)); - rect.top = Integer.parseInt(matcher.group(2)); - rect.right = Integer.parseInt(matcher.group(3)); - rect.bottom = Integer.parseInt(matcher.group(4)); - } - - mInterface.setOverscan(displayId, rect.left, rect.top, rect.right, rect.bottom); - return 0; - } - private int runDisplayScaling(PrintWriter pw) throws RemoteException { String scalingStr = getNextArgRequired(); if ("auto".equals(scalingStr)) { @@ -380,8 +354,6 @@ public class WindowManagerShellCommand extends ShellCommand { pw.println(" Return or override display density."); pw.println(" folded-area [reset|LEFT,TOP,RIGHT,BOTTOM]"); pw.println(" Return or override folded area."); - pw.println(" overscan [reset|LEFT,TOP,RIGHT,BOTTOM] [-d DISPLAY ID]"); - pw.println(" Set overscan area for display."); pw.println(" scaling [off|auto] [-d DISPLAY_ID]"); pw.println(" Set display scaling mode."); pw.println(" dismiss-keyguard"); diff --git a/services/core/java/com/android/server/wm/WindowState.java b/services/core/java/com/android/server/wm/WindowState.java index d5905720a611..62a3512c3cae 100644 --- a/services/core/java/com/android/server/wm/WindowState.java +++ b/services/core/java/com/android/server/wm/WindowState.java @@ -1047,9 +1047,6 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP applyGravityAndUpdateFrame(layoutContainingFrame, layoutDisplayFrame); - // Calculate the outsets before the content frame gets shrinked to the window frame. - mWindowFrames.calculateOutsets(); - // Make sure the content and visible frames are inside of the // final window frame. if (windowsAreFloating && !mWindowFrames.mFrame.isEmpty()) { @@ -1094,13 +1091,6 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP Math.min(mWindowFrames.mStableFrame.bottom, mWindowFrames.mFrame.bottom)); } - if (isFullscreenAndFillsDisplay && !windowsAreFloating) { - // Windows that are not fullscreen can be positioned outside of the display frame, - // but that is not a reason to provide them with overscan insets. - InsetUtils.insetsBetweenFrames(layoutContainingFrame, mWindowFrames.mOverscanFrame, - mWindowFrames.mOverscanInsets); - } - if (mAttrs.type == TYPE_DOCK_DIVIDER) { final WmDisplayCutout c = mWindowFrames.mDisplayCutout.calculateRelativeTo( mWindowFrames.mDisplayFrame); @@ -1170,11 +1160,6 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP } @Override - public Rect getOverscanFrameLw() { - return mWindowFrames.mOverscanFrame; - } - - @Override public Rect getContentFrameLw() { return mWindowFrames.mContentFrame; } @@ -3265,11 +3250,9 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP } final Rect frame = mWindowFrames.mCompatFrame; - final Rect overscanInsets = mWindowFrames.mLastOverscanInsets; final Rect contentInsets = mWindowFrames.mLastContentInsets; final Rect visibleInsets = mWindowFrames.mLastVisibleInsets; final Rect stableInsets = mWindowFrames.mLastStableInsets; - final Rect outsets = mWindowFrames.mLastOutsets; final boolean reportDraw = mWinAnimator.mDrawState == DRAW_PENDING; final boolean reportOrientation = mReportOrientationChanged; final int displayId = getDisplayId(); @@ -3281,8 +3264,8 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP @Override public void run() { try { - dispatchResized(frame, overscanInsets, contentInsets, visibleInsets, - stableInsets, outsets, reportDraw, mergedConfiguration, + dispatchResized(frame, contentInsets, visibleInsets, + stableInsets, reportDraw, mergedConfiguration, reportOrientation, displayId, displayCutout); } catch (RemoteException e) { // Not a remote call, RemoteException won't be raised. @@ -3290,8 +3273,8 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP } }); } else { - dispatchResized(frame, overscanInsets, contentInsets, visibleInsets, stableInsets, - outsets, reportDraw, mergedConfiguration, reportOrientation, displayId, + dispatchResized(frame, contentInsets, visibleInsets, stableInsets, + reportDraw, mergedConfiguration, reportOrientation, displayId, displayCutout); } if (mWmService.mAccessibilityController != null) { @@ -3423,14 +3406,14 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP return stack.mStackId; } - private void dispatchResized(Rect frame, Rect overscanInsets, Rect contentInsets, - Rect visibleInsets, Rect stableInsets, Rect outsets, boolean reportDraw, + private void dispatchResized(Rect frame, Rect contentInsets, + Rect visibleInsets, Rect stableInsets, boolean reportDraw, MergedConfiguration mergedConfiguration, boolean reportOrientation, int displayId, DisplayCutout displayCutout) throws RemoteException { final boolean forceRelayout = isDragResizeChanged() || reportOrientation; - mClient.resized(frame, overscanInsets, contentInsets, visibleInsets, stableInsets, outsets, + mClient.resized(frame, contentInsets, visibleInsets, stableInsets, reportDraw, mergedConfiguration, getBackdropFrame(frame), forceRelayout, getDisplayContent().getDisplayPolicy().areSystemBarsForcedShownLw(this), displayId, new DisplayCutout.ParcelableWrapper(displayCutout)); @@ -5282,13 +5265,11 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP /** * Copy the inset values over so they can be sent back to the client when a relayout occurs. */ - void getInsetsForRelayout(Rect outOverscanInsets, Rect outContentInsets, Rect outVisibleInsets, - Rect outStableInsets, Rect outOutsets) { - outOverscanInsets.set(mWindowFrames.mOverscanInsets); + void getInsetsForRelayout(Rect outContentInsets, Rect outVisibleInsets, + Rect outStableInsets) { outContentInsets.set(mWindowFrames.mContentInsets); outVisibleInsets.set(mWindowFrames.mVisibleInsets); outStableInsets.set(mWindowFrames.mStableInsets); - outOutsets.set(mWindowFrames.mOutsets); mLastRelayoutContentInsets.set(mWindowFrames.mContentInsets); } diff --git a/services/tests/wmtests/src/com/android/server/wm/DisplayPolicyLayoutTests.java b/services/tests/wmtests/src/com/android/server/wm/DisplayPolicyLayoutTests.java index 67b7a66b4794..62ab11c5a18f 100644 --- a/services/tests/wmtests/src/com/android/server/wm/DisplayPolicyLayoutTests.java +++ b/services/tests/wmtests/src/com/android/server/wm/DisplayPolicyLayoutTests.java @@ -515,18 +515,16 @@ public class DisplayPolicyLayoutTests extends DisplayPolicyTestsBase { final Rect outFrame = new Rect(); final Rect outContentInsets = new Rect(); final Rect outStableInsets = new Rect(); - final Rect outOutsets = new Rect(); final DisplayCutout.ParcelableWrapper outDisplayCutout = new DisplayCutout.ParcelableWrapper(); mDisplayPolicy.getLayoutHintLw(mWindow.mAttrs, null, mFrames, false /* floatingStack */, outFrame, outContentInsets, outStableInsets, - outOutsets, outDisplayCutout); + outDisplayCutout); assertThat(outFrame, is(mFrames.mUnrestricted)); assertThat(outContentInsets, is(new Rect(0, STATUS_BAR_HEIGHT, 0, NAV_BAR_HEIGHT))); assertThat(outStableInsets, is(new Rect(0, STATUS_BAR_HEIGHT, 0, NAV_BAR_HEIGHT))); - assertThat(outOutsets, is(new Rect())); assertThat(outDisplayCutout, is(new DisplayCutout.ParcelableWrapper())); } @@ -540,18 +538,16 @@ public class DisplayPolicyLayoutTests extends DisplayPolicyTestsBase { final Rect outFrame = new Rect(); final Rect outContentInsets = new Rect(); final Rect outStableInsets = new Rect(); - final Rect outOutsets = new Rect(); final DisplayCutout.ParcelableWrapper outDisplayCutout = new DisplayCutout.ParcelableWrapper(); mDisplayPolicy.getLayoutHintLw(mWindow.mAttrs, taskBounds, mFrames, false /* floatingStack */, outFrame, outContentInsets, outStableInsets, - outOutsets, outDisplayCutout); + outDisplayCutout); assertThat(outFrame, is(taskBounds)); assertThat(outContentInsets, is(new Rect())); assertThat(outStableInsets, is(new Rect())); - assertThat(outOutsets, is(new Rect())); assertThat(outDisplayCutout, is(new DisplayCutout.ParcelableWrapper())); } @@ -568,18 +564,16 @@ public class DisplayPolicyLayoutTests extends DisplayPolicyTestsBase { final Rect outFrame = new Rect(); final Rect outContentInsets = new Rect(); final Rect outStableInsets = new Rect(); - final Rect outOutsets = new Rect(); final DisplayCutout.ParcelableWrapper outDisplayCutout = new DisplayCutout.ParcelableWrapper(); mDisplayPolicy.getLayoutHintLw(mWindow.mAttrs, taskBounds, mFrames, true /* floatingStack */, outFrame, outContentInsets, outStableInsets, - outOutsets, outDisplayCutout); + outDisplayCutout); assertThat(outFrame, is(taskBounds)); assertThat(outContentInsets, is(new Rect())); assertThat(outStableInsets, is(new Rect())); - assertThat(outOutsets, is(new Rect())); assertThat(outDisplayCutout, is(new DisplayCutout.ParcelableWrapper())); } diff --git a/services/tests/wmtests/src/com/android/server/wm/DisplayWindowSettingsTests.java b/services/tests/wmtests/src/com/android/server/wm/DisplayWindowSettingsTests.java index 703ebc937082..e375f8344cb4 100644 --- a/services/tests/wmtests/src/com/android/server/wm/DisplayWindowSettingsTests.java +++ b/services/tests/wmtests/src/com/android/server/wm/DisplayWindowSettingsTests.java @@ -277,47 +277,6 @@ public class DisplayWindowSettingsTests extends WindowTestsBase { } @Test - public void testDefaultToZeroOverscan() { - mTarget.applySettingsToDisplayLocked(mPrimaryDisplay); - - assertOverscan(mPrimaryDisplay, 0 /* left */, 0 /* top */, 0 /* right */, 0 /* bottom */); - } - - @Test - public void testPersistOverscanInSameInstance() { - final DisplayInfo info = mPrimaryDisplay.getDisplayInfo(); - try { - mTarget.setOverscanLocked(info, 1 /* left */, 2 /* top */, 3 /* right */, - 4 /* bottom */); - - mTarget.applySettingsToDisplayLocked(mPrimaryDisplay); - - assertOverscan(mPrimaryDisplay, 1 /* left */, 2 /* top */, 3 /* right */, - 4 /* bottom */); - } finally { - mTarget.setOverscanLocked(info, 0, 0, 0, 0); - mTarget.applySettingsToDisplayLocked(mPrimaryDisplay); - } - } - - @Test - public void testPersistOverscanAcrossInstances() { - final DisplayInfo info = mPrimaryDisplay.getDisplayInfo(); - try { - mTarget.setOverscanLocked(info, 10 /* left */, 20 /* top */, 30 /* right */, - 40 /* bottom */); - - applySettingsToDisplayByNewInstance(mPrimaryDisplay); - - assertOverscan(mPrimaryDisplay, 10 /* left */, 20 /* top */, 30 /* right */, - 40 /* bottom */); - } finally { - mTarget.setOverscanLocked(info, 0, 0, 0, 0); - mTarget.applySettingsToDisplayLocked(mPrimaryDisplay); - } - } - - @Test public void testDefaultToFreeUserRotation() { mTarget.applySettingsToDisplayLocked(mSecondaryDisplay); @@ -690,16 +649,6 @@ public class DisplayWindowSettingsTests extends WindowTestsBase { return null; } - private static void assertOverscan(DisplayContent display, int left, int top, int right, - int bottom) { - final DisplayInfo info = display.getDisplayInfo(); - - assertEquals(left, info.overscanLeft); - assertEquals(top, info.overscanTop); - assertEquals(right, info.overscanRight); - assertEquals(bottom, info.overscanBottom); - } - /** * This method helps to ensure read and write persistent settings successfully because the * constructor of {@link DisplayWindowSettings} should read the persistent file from the given diff --git a/services/tests/wmtests/src/com/android/server/wm/TestIWindow.java b/services/tests/wmtests/src/com/android/server/wm/TestIWindow.java index 6a9413716a89..e1475a453330 100644 --- a/services/tests/wmtests/src/com/android/server/wm/TestIWindow.java +++ b/services/tests/wmtests/src/com/android/server/wm/TestIWindow.java @@ -37,8 +37,8 @@ public class TestIWindow extends IWindow.Stub { } @Override - public void resized(Rect frame, Rect overscanInsets, Rect contentInsets, Rect visibleInsets, - Rect stableInsets, Rect outsets, boolean reportDraw, MergedConfiguration mergedConfig, + public void resized(Rect frame, Rect contentInsets, Rect visibleInsets, + Rect stableInsets, boolean reportDraw, MergedConfiguration mergedConfig, Rect backDropFrame, boolean forceLayout, boolean alwaysConsumeSystemBars, int displayId, DisplayCutout.ParcelableWrapper displayCutout) throws RemoteException { } diff --git a/services/tests/wmtests/src/com/android/server/wm/WindowFrameTests.java b/services/tests/wmtests/src/com/android/server/wm/WindowFrameTests.java index 428d869fe3cd..0b8b6a1f23ec 100644 --- a/services/tests/wmtests/src/com/android/server/wm/WindowFrameTests.java +++ b/services/tests/wmtests/src/com/android/server/wm/WindowFrameTests.java @@ -150,7 +150,7 @@ public class WindowFrameTests extends WindowTestsBase { // When mFrame extends past cf, the content insets are // the difference between mFrame and ContentFrame. Visible // and stable frames work the same way. - w.getWindowFrames().setFrames(pf, df, of, cf, vf, dcf, sf, mEmptyRect); + w.getWindowFrames().setFrames(pf, df, cf, vf, dcf, sf); w.computeFrameLw(); assertFrame(w, 0, 0, 1000, 1000); assertContentInset(w, 0, topContentInset, 0, bottomContentInset); @@ -186,7 +186,7 @@ public class WindowFrameTests extends WindowTestsBase { // Here the window has FILL_PARENT, FILL_PARENT // so we expect it to fill the entire available frame. - w.getWindowFrames().setFrames(pf, pf, pf, pf, pf, pf, pf, pf); + w.getWindowFrames().setFrames(pf, pf, pf, pf, pf, pf); w.computeFrameLw(); assertFrame(w, 0, 0, 1000, 1000); @@ -274,7 +274,7 @@ public class WindowFrameTests extends WindowTestsBase { final Rect pf = new Rect(0, 0, logicalWidth, logicalHeight); final WindowFrames windowFrames = w.getWindowFrames(); - windowFrames.setFrames(pf, pf, pf, pf, pf, pf, pf, mEmptyRect); + windowFrames.setFrames(pf, pf, pf, pf, pf, pf); w.computeFrameLw(); // For non fullscreen tasks the containing frame is based off the // task bounds not the parent frame. @@ -287,7 +287,7 @@ public class WindowFrameTests extends WindowTestsBase { final int cfRight = logicalWidth / 2; final int cfBottom = logicalHeight / 2; final Rect cf = new Rect(0, 0, cfRight, cfBottom); - windowFrames.setFrames(pf, pf, pf, cf, cf, pf, cf, mEmptyRect); + windowFrames.setFrames(pf, pf, cf, cf, pf, cf); w.computeFrameLw(); assertEquals(resolvedTaskBounds, w.getFrameLw()); int contentInsetRight = resolvedTaskBounds.right - cfRight; @@ -306,7 +306,7 @@ public class WindowFrameTests extends WindowTestsBase { final int insetBottom = insetTop + (resolvedTaskBounds.bottom - resolvedTaskBounds.top); task.setOverrideDisplayedBounds(resolvedTaskBounds); task.setBounds(insetLeft, insetTop, insetRight, insetBottom); - windowFrames.setFrames(pf, pf, pf, cf, cf, pf, cf, mEmptyRect); + windowFrames.setFrames(pf, pf, cf, cf, pf, cf); w.computeFrameLw(); assertEquals(resolvedTaskBounds, w.getFrameLw()); contentInsetRight = insetRight - cfRight; @@ -328,7 +328,6 @@ public class WindowFrameTests extends WindowTestsBase { final int logicalHeight = displayInfo.logicalHeight; final Rect pf = new Rect(0, 0, logicalWidth, logicalHeight); final Rect df = pf; - final Rect of = df; final Rect cf = new Rect(pf); // Produce some insets cf.top += displayInfo.logicalWidth / 10; @@ -339,7 +338,7 @@ public class WindowFrameTests extends WindowTestsBase { Rect dcf = new Rect(cf); final WindowFrames windowFrames = w.getWindowFrames(); - windowFrames.setFrames(pf, df, of, cf, vf, dcf, sf, mEmptyRect); + windowFrames.setFrames(pf, df, cf, vf, dcf, sf); w.computeFrameLw(); assertPolicyCrop(w, 0, cf.top, logicalWidth, cf.bottom); @@ -353,7 +352,7 @@ public class WindowFrameTests extends WindowTestsBase { // we need to account for the fact the windows surface will be made // fullscreen and thus also make the crop fullscreen. - windowFrames.setFrames(pf, pf, pf, pf, pf, pf, pf, pf); + windowFrames.setFrames(pf, pf, pf, pf, pf, pf); w.mAttrs.gravity = Gravity.LEFT | Gravity.TOP; w.mAttrs.width = logicalWidth / 2; w.mAttrs.height = logicalHeight / 2; @@ -395,7 +394,7 @@ public class WindowFrameTests extends WindowTestsBase { final Rect pf = new Rect(0, 0, logicalWidth, logicalHeight); final WindowFrames windowFrames = w.getWindowFrames(); - windowFrames.setFrames(pf, pf, pf, pf, pf, pf, pf, mEmptyRect); + windowFrames.setFrames(pf, pf, pf, pf, pf, pf); w.computeFrameLw(); // For non fullscreen tasks the containing frame is based off the // task bounds not the parent frame. @@ -413,7 +412,7 @@ public class WindowFrameTests extends WindowTestsBase { pf.set(0, 0, logicalWidth, logicalHeight); task.setWindowingMode(WINDOWING_MODE_FULLSCREEN); task.setBounds(null); - windowFrames.setFrames(pf, pf, pf, cf, cf, pf, cf, mEmptyRect); + windowFrames.setFrames(pf, pf, cf, cf, pf, cf); w.computeFrameLw(); assertFrame(w, cf); assertContentFrame(w, cf); @@ -434,7 +433,7 @@ public class WindowFrameTests extends WindowTestsBase { pf.width(), pf.height()); final WindowFrames windowFrames = w.getWindowFrames(); - windowFrames.setFrames(pf, pf, pf, pf, pf, pf, pf, pf); + windowFrames.setFrames(pf, pf, pf, pf, pf, pf); windowFrames.setDisplayCutout(cutout); w.computeFrameLw(); @@ -461,7 +460,7 @@ public class WindowFrameTests extends WindowTestsBase { pf.width(), pf.height()); final WindowFrames windowFrames = w.getWindowFrames(); - windowFrames.setFrames(pf, pf, pf, pf, pf, pf, pf, pf); + windowFrames.setFrames(pf, pf, pf, pf, pf, pf); windowFrames.setDisplayCutout(cutout); w.computeFrameLw(); @@ -501,7 +500,7 @@ public class WindowFrameTests extends WindowTestsBase { final Rect winRect = new Rect(200, 200, 300, 500); task.setBounds(winRect); - w.getWindowFrames().setFrames(pf, df, of, cf, vf, dcf, sf, mEmptyRect); + w.getWindowFrames().setFrames(pf, df, cf, vf, dcf, sf); w.computeFrameLw(); final Rect expected = new Rect(winRect.left, cf.bottom - winRect.height(), @@ -514,7 +513,7 @@ public class WindowFrameTests extends WindowTestsBase { winRect.bottom = 600; task.setBounds(winRect); w.setBounds(winRect); - w.getWindowFrames().setFrames(pf, df, of, cf, vf, dcf, sf, mEmptyRect); + w.getWindowFrames().setFrames(pf, df, cf, vf, dcf, sf); w.computeFrameLw(); assertFrame(w, winRect.left, 0, winRect.right, winRect.height()); @@ -524,7 +523,7 @@ public class WindowFrameTests extends WindowTestsBase { assertVisibleFrame(w, expected); // Check that it's moved back without ime insets - w.getWindowFrames().setFrames(pf, df, of, pf, pf, dcf, sf, mEmptyRect); + w.getWindowFrames().setFrames(pf, df, pf, pf, dcf, sf); w.computeFrameLw(); assertEquals(winRect, w.getFrameLw()); } diff --git a/tests/WindowManagerStressTest/Android.bp b/tests/WindowManagerStressTest/Android.bp deleted file mode 100644 index 98749a7e4512..000000000000 --- a/tests/WindowManagerStressTest/Android.bp +++ /dev/null @@ -1,21 +0,0 @@ -// -// Copyright (C) 2016 The Android Open Source Project -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -android_test { - name: "WindowManagerStressTest", - srcs: ["**/*.java"], - platform_apis: true, -} diff --git a/tests/WindowManagerStressTest/AndroidManifest.xml b/tests/WindowManagerStressTest/AndroidManifest.xml deleted file mode 100644 index 17e0f15c29a9..000000000000 --- a/tests/WindowManagerStressTest/AndroidManifest.xml +++ /dev/null @@ -1,34 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<!-- - ~ Copyright (C) 2017 The Android Open Source Project - ~ - ~ Licensed under the Apache License, Version 2.0 (the "License"); - ~ you may not use this file except in compliance with the License. - ~ You may obtain a copy of the License at - ~ - ~ http://www.apache.org/licenses/LICENSE-2.0 - ~ - ~ Unless required by applicable law or agreed to in writing, software - ~ distributed under the License is distributed on an "AS IS" BASIS, - ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - ~ See the License for the specific language governing permissions and - ~ limitations under the License - --> - -<manifest xmlns:android="http://schemas.android.com/apk/res/android" - package="test.windowmanagerstresstest"> - - <application - android:allowBackup="false" - android:icon="@mipmap/ic_launcher" - android:label="@string/app_name" - android:supportsRtl="true" - android:theme="@style/AppTheme"> - <activity android:name=".MainActivity"> - <intent-filter> - <action android:name="android.intent.action.MAIN" /> - <category android:name="android.intent.category.LAUNCHER" /> - </intent-filter> - </activity> - </application> -</manifest> diff --git a/tests/WindowManagerStressTest/res/layout/activity_main.xml b/tests/WindowManagerStressTest/res/layout/activity_main.xml deleted file mode 100644 index 6cf82691155c..000000000000 --- a/tests/WindowManagerStressTest/res/layout/activity_main.xml +++ /dev/null @@ -1,38 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<!-- Copyright (C) 2016 The Android Open Source Project - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. ---> -<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" - xmlns:tools="http://schemas.android.com/tools" - android:layout_width="match_parent" - android:layout_height="match_parent" - android:orientation="vertical" - android:paddingBottom="@dimen/activity_vertical_margin" - android:paddingLeft="@dimen/activity_horizontal_margin" - android:paddingRight="@dimen/activity_horizontal_margin" - android:paddingTop="@dimen/activity_vertical_margin" - tools:context="test.amslam.MainActivity"> - - <Button - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:id="@+id/run" - android:text="@string/run" /> - - <TextView - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:id="@+id/output" /> - -</LinearLayout> diff --git a/tests/WindowManagerStressTest/res/mipmap-hdpi/ic_launcher.png b/tests/WindowManagerStressTest/res/mipmap-hdpi/ic_launcher.png Binary files differdeleted file mode 100644 index cde69bcccec6..000000000000 --- a/tests/WindowManagerStressTest/res/mipmap-hdpi/ic_launcher.png +++ /dev/null diff --git a/tests/WindowManagerStressTest/res/mipmap-mdpi/ic_launcher.png b/tests/WindowManagerStressTest/res/mipmap-mdpi/ic_launcher.png Binary files differdeleted file mode 100644 index c133a0cbd379..000000000000 --- a/tests/WindowManagerStressTest/res/mipmap-mdpi/ic_launcher.png +++ /dev/null diff --git a/tests/WindowManagerStressTest/res/mipmap-xhdpi/ic_launcher.png b/tests/WindowManagerStressTest/res/mipmap-xhdpi/ic_launcher.png Binary files differdeleted file mode 100644 index bfa42f0e7b91..000000000000 --- a/tests/WindowManagerStressTest/res/mipmap-xhdpi/ic_launcher.png +++ /dev/null diff --git a/tests/WindowManagerStressTest/res/mipmap-xxhdpi/ic_launcher.png b/tests/WindowManagerStressTest/res/mipmap-xxhdpi/ic_launcher.png Binary files differdeleted file mode 100644 index 324e72cdd748..000000000000 --- a/tests/WindowManagerStressTest/res/mipmap-xxhdpi/ic_launcher.png +++ /dev/null diff --git a/tests/WindowManagerStressTest/res/mipmap-xxxhdpi/ic_launcher.png b/tests/WindowManagerStressTest/res/mipmap-xxxhdpi/ic_launcher.png Binary files differdeleted file mode 100644 index aee44e138434..000000000000 --- a/tests/WindowManagerStressTest/res/mipmap-xxxhdpi/ic_launcher.png +++ /dev/null diff --git a/tests/WindowManagerStressTest/res/values/colors.xml b/tests/WindowManagerStressTest/res/values/colors.xml deleted file mode 100644 index 4270ca68a860..000000000000 --- a/tests/WindowManagerStressTest/res/values/colors.xml +++ /dev/null @@ -1,20 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<!-- Copyright (C) 2016 The Android Open Source Project - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. ---> -<resources> - <color name="colorPrimary">#3F51B5</color> - <color name="colorPrimaryDark">#303F9F</color> - <color name="colorAccent">#FF4081</color> -</resources> diff --git a/tests/WindowManagerStressTest/res/values/dimens.xml b/tests/WindowManagerStressTest/res/values/dimens.xml deleted file mode 100644 index ed4ccbcc700f..000000000000 --- a/tests/WindowManagerStressTest/res/values/dimens.xml +++ /dev/null @@ -1,19 +0,0 @@ -<!-- Copyright (C) 2016 The Android Open Source Project - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. ---> -<resources> - <!-- Default screen margins, per the Android Design guidelines. --> - <dimen name="activity_horizontal_margin">16dp</dimen> - <dimen name="activity_vertical_margin">16dp</dimen> -</resources> diff --git a/tests/WindowManagerStressTest/res/values/strings.xml b/tests/WindowManagerStressTest/res/values/strings.xml deleted file mode 100644 index cef05dcb6584..000000000000 --- a/tests/WindowManagerStressTest/res/values/strings.xml +++ /dev/null @@ -1,19 +0,0 @@ -<!-- - ~ Copyright (C) 2017 The Android Open Source Project - ~ - ~ Licensed under the Apache License, Version 2.0 (the "License"); - ~ you may not use this file except in compliance with the License. - ~ You may obtain a copy of the License at - ~ - ~ http://www.apache.org/licenses/LICENSE-2.0 - ~ - ~ Unless required by applicable law or agreed to in writing, software - ~ distributed under the License is distributed on an "AS IS" BASIS, - ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - ~ See the License for the specific language governing permissions and - ~ limitations under the License - --> -<resources> - <string name="app_name">WmSlam</string> - <string name="run">Run</string> -</resources> diff --git a/tests/WindowManagerStressTest/res/values/styles.xml b/tests/WindowManagerStressTest/res/values/styles.xml deleted file mode 100644 index 0983b2535878..000000000000 --- a/tests/WindowManagerStressTest/res/values/styles.xml +++ /dev/null @@ -1,23 +0,0 @@ -<!-- Copyright (C) 2016 The Android Open Source Project - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. ---> -<resources> - <!-- Base application theme. --> - <style name="AppTheme" parent="@android:style/Theme.Material.Light.DarkActionBar"> - <!-- Customize your theme here. --> - <item name="android:colorPrimary">@color/colorPrimary</item> - <item name="android:colorPrimaryDark">@color/colorPrimaryDark</item> - <item name="android:colorAccent">@color/colorAccent</item> - </style> -</resources> diff --git a/tests/WindowManagerStressTest/src/test/windowmanagerstresstest/MainActivity.java b/tests/WindowManagerStressTest/src/test/windowmanagerstresstest/MainActivity.java deleted file mode 100644 index 85646987940f..000000000000 --- a/tests/WindowManagerStressTest/src/test/windowmanagerstresstest/MainActivity.java +++ /dev/null @@ -1,155 +0,0 @@ -/* - * Copyright (C) 2017 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License - */ - -package test.windowmanagerstresstest; - -import android.app.Activity; -import android.graphics.Rect; -import android.os.Bundle; -import android.os.RemoteException; -import android.os.SystemClock; -import android.util.Log; -import android.util.MergedConfiguration; -import android.view.Display; -import android.view.DisplayCutout; -import android.view.IWindowSession; -import android.view.InsetsState; -import android.view.Surface; -import android.view.SurfaceControl; -import android.view.View; -import android.view.WindowManager; -import android.view.WindowManager.LayoutParams; -import android.view.WindowManagerGlobal; -import android.widget.TextView; - -import com.android.internal.view.BaseIWindow; - -import java.util.ArrayList; - -public class MainActivity extends Activity { - - private static final String TAG = "WmSlam"; - - private TextView mOutput; - private volatile boolean finished; - private final ArrayList<BaseIWindow> mWindows = new ArrayList<>(); - private final LayoutParams mLayoutParams = new LayoutParams(); - private final Rect mTmpRect = new Rect(); - - @Override - protected void onCreate(Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - setContentView(R.layout.activity_main); - mOutput = (TextView) findViewById(R.id.output); - - findViewById(R.id.run).setOnClickListener(view -> { - view.setEnabled(false); - mOutput.setText(""); - startBatch(); - }); - mLayoutParams.token = getActivityToken(); - } - - void startBatch() { - new Thread(() -> { - finished = false; - addWindows(); - startCpuRunnables(); - for (int i = 0; i < 5; i++) { - final long time = SystemClock.uptimeMillis(); - slamWm(); - log("Total: " + (SystemClock.uptimeMillis() - time) + " ms"); - } - removeWindows(); - finished = true; - }).start(); - } - - void startCpuRunnables() { - for (int i = 0; i < 10; i++) { - new Thread(mUseCpuRunnable).start(); - } - } - - private final Runnable mUseCpuRunnable = new Runnable() { - @Override - public void run() { - while (!finished) { - } - } - }; - - private void log(String text) { - mOutput.post(() -> mOutput.append(text + "\n")); - Log.d(TAG, text); - } - - private void slamWm() { - ArrayList<Thread> threads = new ArrayList<>(); - for (int i = 0; i < 20; i++) { - for (BaseIWindow window : mWindows) { - Thread t = new Thread(() -> { - try { - WindowManagerGlobal.getWindowSession().relayout(window, - window.mSeq, mLayoutParams, -1, -1, View.VISIBLE, 0, -1, mTmpRect, - mTmpRect, mTmpRect, mTmpRect, mTmpRect, mTmpRect, mTmpRect, - new DisplayCutout.ParcelableWrapper(), new MergedConfiguration(), - new SurfaceControl(), new InsetsState()); - } catch (RemoteException e) { - e.printStackTrace(); - } - }); - threads.add(t); - t.start(); - } - } - for (Thread t : threads) { - try { - t.join(); - } catch (InterruptedException e) { - e.printStackTrace(); - } - } - } - - void addWindows() { - for (int i = 0; i < 50; i++) { - final WindowManager.LayoutParams layoutParams = new WindowManager.LayoutParams(); - layoutParams.token = getActivityToken(); - final BaseIWindow window = new BaseIWindow(); - final IWindowSession session = WindowManagerGlobal.getWindowSession(); - final Rect tmpRect = new Rect(); - try { - final int res = session.addToDisplayWithoutInputChannel(window, window.mSeq, - layoutParams, View.VISIBLE, Display.DEFAULT_DISPLAY, tmpRect, tmpRect, - new InsetsState()); - } catch (RemoteException e) { - e.printStackTrace(); - } - mWindows.add(window); - } - } - - void removeWindows() { - for (BaseIWindow window : mWindows) { - try { - WindowManagerGlobal.getWindowSession().remove(window); - } catch (RemoteException e) { - e.printStackTrace(); - } - } - } -} |