summaryrefslogtreecommitdiff
path: root/core/java/android
diff options
context:
space:
mode:
Diffstat (limited to 'core/java/android')
-rw-r--r--core/java/android/service/wallpaper/WallpaperService.java7
-rw-r--r--core/java/android/view/DisplayCutout.java16
-rw-r--r--core/java/android/view/IWindowManager.aidl2
-rw-r--r--core/java/android/view/IWindowSession.aidl6
-rw-r--r--core/java/android/view/InsetsAnimationControlImpl.java3
-rw-r--r--core/java/android/view/InsetsController.java17
-rw-r--r--core/java/android/view/InsetsState.java64
-rw-r--r--core/java/android/view/View.java3
-rw-r--r--core/java/android/view/ViewRootImpl.java38
-rw-r--r--core/java/android/view/WindowManagerImpl.java9
-rw-r--r--core/java/android/view/WindowlessWindowManager.java9
-rw-r--r--core/java/android/window/ClientWindowFrames.java12
12 files changed, 92 insertions, 94 deletions
diff --git a/core/java/android/service/wallpaper/WallpaperService.java b/core/java/android/service/wallpaper/WallpaperService.java
index 37637119c70a..507dc7a1d59a 100644
--- a/core/java/android/service/wallpaper/WallpaperService.java
+++ b/core/java/android/service/wallpaper/WallpaperService.java
@@ -881,8 +881,7 @@ public abstract class WallpaperService extends Service {
if (mSession.addToDisplay(mWindow, mLayout, View.VISIBLE,
mDisplay.getDisplayId(), mInsetsState, mWinFrames.frame,
- mWinFrames.displayCutout, inputChannel, mInsetsState,
- mTempControls) < 0) {
+ inputChannel, mInsetsState, mTempControls) < 0) {
Log.w(TAG, "Failed to add window while updating wallpaper surface.");
return;
}
@@ -924,13 +923,13 @@ public abstract class WallpaperService extends Service {
int w = mWinFrames.frame.width();
int h = mWinFrames.frame.height();
- final DisplayCutout rawCutout = mWinFrames.displayCutout.get();
+ final DisplayCutout rawCutout = mInsetsState.getDisplayCutout();
final Configuration config = getResources().getConfiguration();
final Rect visibleFrame = new Rect(mWinFrames.frame);
visibleFrame.intersect(mInsetsState.getDisplayFrame());
WindowInsets windowInsets = mInsetsState.calculateInsets(visibleFrame,
null /* ignoringVisibilityState */, config.isScreenRound(),
- false /* alwaysConsumeSystemBars */, rawCutout, mLayout.softInputMode,
+ false /* alwaysConsumeSystemBars */, mLayout.softInputMode,
mLayout.flags, SYSTEM_UI_FLAG_VISIBLE, mLayout.type,
config.windowConfiguration.getWindowingMode(), null /* typeSideMap */);
diff --git a/core/java/android/view/DisplayCutout.java b/core/java/android/view/DisplayCutout.java
index 3f2dd4d8f557..525ac534612d 100644
--- a/core/java/android/view/DisplayCutout.java
+++ b/core/java/android/view/DisplayCutout.java
@@ -196,6 +196,12 @@ public final class DisplayCutout {
return rects;
}
+ private void scale(float scale) {
+ for (int i = 0; i < BOUNDS_POSITION_LENGTH; ++i) {
+ mRects[i].scale(scale);
+ }
+ }
+
@Override
public int hashCode() {
int result = 0;
@@ -871,6 +877,16 @@ public final class DisplayCutout {
mInner = cutout;
}
+ public void scale(float scale) {
+ final Rect safeInsets = mInner.getSafeInsets();
+ safeInsets.scale(scale);
+ final Bounds bounds = new Bounds(mInner.mBounds.mRects, true);
+ bounds.scale(scale);
+ final Rect waterfallInsets = mInner.mWaterfallInsets.toRect();
+ waterfallInsets.scale(scale);
+ mInner = new DisplayCutout(safeInsets, Insets.of(waterfallInsets), bounds);
+ }
+
@Override
public int hashCode() {
return mInner.hashCode();
diff --git a/core/java/android/view/IWindowManager.aidl b/core/java/android/view/IWindowManager.aidl
index 025a977d5420..68a6de820f83 100644
--- a/core/java/android/view/IWindowManager.aidl
+++ b/core/java/android/view/IWindowManager.aidl
@@ -728,7 +728,7 @@ interface IWindowManager
* @return {@code true} if system bars are always comsumed.
*/
boolean getWindowInsets(in WindowManager.LayoutParams attrs, int displayId,
- out DisplayCutout.ParcelableWrapper outDisplayCutout, out InsetsState outInsetsState);
+ out InsetsState outInsetsState);
/**
* Called to show global actions.
diff --git a/core/java/android/view/IWindowSession.aidl b/core/java/android/view/IWindowSession.aidl
index cfdaf8ccc5fb..85498cb6f083 100644
--- a/core/java/android/view/IWindowSession.aidl
+++ b/core/java/android/view/IWindowSession.aidl
@@ -47,13 +47,11 @@ import java.util.List;
interface IWindowSession {
int addToDisplay(IWindow window, in WindowManager.LayoutParams attrs,
in int viewVisibility, in int layerStackId, in InsetsState requestedVisibility,
- out Rect outFrame, out DisplayCutout.ParcelableWrapper displayCutout,
- out InputChannel outInputChannel, out InsetsState insetsState,
+ out Rect outFrame, out InputChannel outInputChannel, out InsetsState insetsState,
out InsetsSourceControl[] activeControls);
int addToDisplayAsUser(IWindow window, in WindowManager.LayoutParams attrs,
in int viewVisibility, in int layerStackId, in int userId,
- in InsetsState requestedVisibility, out Rect outFrame,
- out DisplayCutout.ParcelableWrapper displayCutout, out InputChannel outInputChannel,
+ in InsetsState requestedVisibility, out Rect outFrame, out InputChannel outInputChannel,
out InsetsState insetsState, out InsetsSourceControl[] activeControls);
int addToDisplayWithoutInputChannel(IWindow window, in WindowManager.LayoutParams attrs,
in int viewVisibility, in int layerStackId, out InsetsState insetsState);
diff --git a/core/java/android/view/InsetsAnimationControlImpl.java b/core/java/android/view/InsetsAnimationControlImpl.java
index 75dc0c43085d..a89c540eedaf 100644
--- a/core/java/android/view/InsetsAnimationControlImpl.java
+++ b/core/java/android/view/InsetsAnimationControlImpl.java
@@ -334,8 +334,7 @@ public class InsetsAnimationControlImpl implements WindowInsetsAnimationControll
private Insets getInsetsFromState(InsetsState state, Rect frame,
@Nullable @InternalInsetsSide SparseIntArray typeSideMap) {
return state.calculateInsets(frame, null /* ignoringVisibilityState */,
- false /* isScreenRound */,
- false /* alwaysConsumeSystemBars */, null /* displayCutout */,
+ false /* isScreenRound */, false /* alwaysConsumeSystemBars */,
LayoutParams.SOFT_INPUT_ADJUST_RESIZE /* legacySoftInputMode*/,
0 /* legacyWindowFlags */, 0 /* legacySystemUiFlags */, TYPE_APPLICATION,
WINDOWING_MODE_UNDEFINED, typeSideMap).getInsets(mTypes);
diff --git a/core/java/android/view/InsetsController.java b/core/java/android/view/InsetsController.java
index 80437be1dcd4..8c7a7c302db5 100644
--- a/core/java/android/view/InsetsController.java
+++ b/core/java/android/view/InsetsController.java
@@ -522,7 +522,6 @@ public class InsetsController implements WindowInsetsController, InsetsAnimation
private int mLastLegacyWindowFlags;
private int mLastLegacySystemUiFlags;
private int mLastWindowingMode;
- private DisplayCutout mLastDisplayCutout;
private boolean mStartingAnimation;
private int mCaptionInsetsHeight = 0;
private boolean mAnimationsDisabled;
@@ -589,9 +588,8 @@ public class InsetsController implements WindowInsetsController, InsetsAnimation
WindowInsets insets = state.calculateInsets(mFrame, mState /* ignoringVisibilityState*/,
mLastInsets.isRound(), mLastInsets.shouldAlwaysConsumeSystemBars(),
- mLastDisplayCutout, mLastLegacySoftInputMode, mLastLegacyWindowFlags,
- mLastLegacySystemUiFlags, mWindowType, mLastWindowingMode,
- null /* typeSideMap */);
+ mLastLegacySoftInputMode, mLastLegacyWindowFlags, mLastLegacySystemUiFlags,
+ mWindowType, mLastWindowingMode, null /* typeSideMap */);
mHost.dispatchWindowInsetsAnimationProgress(insets, mUnmodifiableTmpRunningAnims);
if (DEBUG) {
for (WindowInsetsAnimation anim : mUnmodifiableTmpRunningAnims) {
@@ -654,6 +652,7 @@ public class InsetsController implements WindowInsetsController, InsetsAnimation
private void updateState(InsetsState newState) {
mState.setDisplayFrame(newState.getDisplayFrame());
+ mState.setDisplayCutout(newState.getDisplayCutout());
@InsetsType int disabledUserAnimationTypes = 0;
@InsetsType int[] cancelledUserAnimationTypes = {0};
for (@InternalInsetsType int type = 0; type < InsetsState.SIZE; type++) {
@@ -725,18 +724,16 @@ public class InsetsController implements WindowInsetsController, InsetsAnimation
*/
@VisibleForTesting
public WindowInsets calculateInsets(boolean isScreenRound, boolean alwaysConsumeSystemBars,
- DisplayCutout cutout, int windowType, int windowingMode,
- int legacySoftInputMode, int legacyWindowFlags, int legacySystemUiFlags) {
+ int windowType, int windowingMode, int legacySoftInputMode, int legacyWindowFlags,
+ int legacySystemUiFlags) {
mWindowType = windowType;
mLastWindowingMode = windowingMode;
mLastLegacySoftInputMode = legacySoftInputMode;
mLastLegacyWindowFlags = legacyWindowFlags;
mLastLegacySystemUiFlags = legacySystemUiFlags;
- mLastDisplayCutout = cutout;
mLastInsets = mState.calculateInsets(mFrame, null /* ignoringVisibilityState*/,
- isScreenRound, alwaysConsumeSystemBars, cutout,
- legacySoftInputMode, legacyWindowFlags, legacySystemUiFlags,
- windowType, windowingMode, null /* typeSideMap */);
+ isScreenRound, alwaysConsumeSystemBars, legacySoftInputMode, legacyWindowFlags,
+ legacySystemUiFlags, windowType, windowingMode, null /* typeSideMap */);
return mLastInsets;
}
diff --git a/core/java/android/view/InsetsState.java b/core/java/android/view/InsetsState.java
index b66dd29e02ef..bf377b0bcfd7 100644
--- a/core/java/android/view/InsetsState.java
+++ b/core/java/android/view/InsetsState.java
@@ -16,6 +16,7 @@
package android.view;
+import static android.view.InsetsStateProto.DISPLAY_CUTOUT;
import static android.view.InsetsStateProto.DISPLAY_FRAME;
import static android.view.InsetsStateProto.SOURCES;
import static android.view.View.SYSTEM_UI_FLAG_LAYOUT_STABLE;
@@ -165,6 +166,10 @@ public class InsetsState implements Parcelable {
*/
private final Rect mDisplayFrame = new Rect();
+ /** The area cut from the display. */
+ private final DisplayCutout.ParcelableWrapper mDisplayCutout =
+ new DisplayCutout.ParcelableWrapper();
+
public InsetsState() {
}
@@ -186,7 +191,7 @@ public class InsetsState implements Parcelable {
* @return The calculated insets.
*/
public WindowInsets calculateInsets(Rect frame, @Nullable InsetsState ignoringVisibilityState,
- boolean isScreenRound, boolean alwaysConsumeSystemBars, DisplayCutout cutout,
+ boolean isScreenRound, boolean alwaysConsumeSystemBars,
int legacySoftInputMode, int legacyWindowFlags, int legacySystemUiFlags,
int windowType, @WindowConfiguration.WindowingMode int windowingMode,
@Nullable @InternalInsetsSide SparseIntArray typeSideMap) {
@@ -236,10 +241,31 @@ public class InsetsState implements Parcelable {
}
return new WindowInsets(typeInsetsMap, typeMaxInsetsMap, typeVisibilityMap, isScreenRound,
- alwaysConsumeSystemBars, cutout, compatInsetsTypes,
+ alwaysConsumeSystemBars, calculateRelativeCutout(frame), compatInsetsTypes,
(legacySystemUiFlags & SYSTEM_UI_FLAG_LAYOUT_STABLE) != 0);
}
+ private DisplayCutout calculateRelativeCutout(Rect frame) {
+ final DisplayCutout raw = mDisplayCutout.get();
+ if (mDisplayFrame.equals(frame)) {
+ return raw;
+ }
+ if (frame == null) {
+ return DisplayCutout.NO_CUTOUT;
+ }
+ final int insetLeft = frame.left - mDisplayFrame.left;
+ final int insetTop = frame.top - mDisplayFrame.top;
+ final int insetRight = mDisplayFrame.right - frame.right;
+ final int insetBottom = mDisplayFrame.bottom - frame.bottom;
+ if (insetLeft >= raw.getSafeInsetLeft()
+ && insetTop >= raw.getSafeInsetTop()
+ && insetRight >= raw.getSafeInsetRight()
+ && insetBottom >= raw.getSafeInsetBottom()) {
+ return DisplayCutout.NO_CUTOUT;
+ }
+ return raw.inset(insetLeft, insetTop, insetRight, insetBottom);
+ }
+
public Rect calculateInsets(Rect frame, @InsetsType int types, boolean ignoreVisibility) {
Insets insets = Insets.NONE;
for (int type = FIRST_TYPE; type <= LAST_TYPE; type++) {
@@ -392,15 +418,6 @@ public class InsetsState implements Parcelable {
return mSources[type];
}
- public boolean hasSources() {
- for (int i = 0; i < SIZE; i++) {
- if (mSources[i] != null) {
- return true;
- }
- }
- return false;
- }
-
/**
* Returns the source visibility or the default visibility if the source doesn't exist. This is
* useful if when treating this object as a request.
@@ -422,6 +439,14 @@ public class InsetsState implements Parcelable {
return mDisplayFrame;
}
+ public void setDisplayCutout(DisplayCutout cutout) {
+ mDisplayCutout.set(cutout);
+ }
+
+ public DisplayCutout getDisplayCutout() {
+ return mDisplayCutout.get();
+ }
+
/**
* Modifies the state of this class to exclude a certain type to make it ready for dispatching
* to the client.
@@ -452,6 +477,7 @@ public class InsetsState implements Parcelable {
*/
public void scale(float scale) {
mDisplayFrame.scale(scale);
+ mDisplayCutout.scale(scale);
for (int i = 0; i < SIZE; i++) {
final InsetsSource source = mSources[i];
if (source != null) {
@@ -470,6 +496,7 @@ public class InsetsState implements Parcelable {
public void set(InsetsState other, boolean copySources) {
mDisplayFrame.set(other.mDisplayFrame);
+ mDisplayCutout.set(other.mDisplayCutout);
if (copySources) {
for (int i = 0; i < SIZE; i++) {
InsetsSource source = other.mSources[i];
@@ -592,6 +619,7 @@ public class InsetsState implements Parcelable {
source.dumpDebug(proto, SOURCES);
}
mDisplayFrame.dumpDebug(proto, DISPLAY_FRAME);
+ mDisplayCutout.get().dumpDebug(proto, DISPLAY_CUTOUT);
proto.end(token);
}
@@ -669,7 +697,8 @@ public class InsetsState implements Parcelable {
InsetsState state = (InsetsState) o;
- if (!mDisplayFrame.equals(state.mDisplayFrame)) {
+ if (!mDisplayFrame.equals(state.mDisplayFrame)
+ || !mDisplayCutout.equals(state.mDisplayCutout)) {
return false;
}
for (int i = 0; i < SIZE; i++) {
@@ -681,7 +710,7 @@ public class InsetsState implements Parcelable {
if (source == null && otherSource == null) {
continue;
}
- if (source != null && otherSource == null || source == null && otherSource != null) {
+ if (source == null || otherSource == null) {
return false;
}
if (!otherSource.equals(source, excludeInvisibleImeFrames)) {
@@ -693,7 +722,7 @@ public class InsetsState implements Parcelable {
@Override
public int hashCode() {
- return Objects.hash(mDisplayFrame, Arrays.hashCode(mSources));
+ return Objects.hash(mDisplayFrame, mDisplayCutout, Arrays.hashCode(mSources));
}
public InsetsState(Parcel in) {
@@ -707,7 +736,8 @@ public class InsetsState implements Parcelable {
@Override
public void writeToParcel(Parcel dest, int flags) {
- dest.writeParcelable(mDisplayFrame, flags);
+ mDisplayFrame.writeToParcel(dest, flags);
+ mDisplayCutout.writeToParcel(dest, flags);
dest.writeParcelableArray(mSources, 0);
}
@@ -723,7 +753,8 @@ public class InsetsState implements Parcelable {
};
public void readFromParcel(Parcel in) {
- mDisplayFrame.set(in.readParcelable(null /* loader */));
+ mDisplayFrame.set(Rect.CREATOR.createFromParcel(in));
+ mDisplayCutout.set(DisplayCutout.ParcelableWrapper.CREATOR.createFromParcel(in));
mSources = in.readParcelableArray(null, InsetsSource.class);
}
@@ -738,6 +769,7 @@ public class InsetsState implements Parcelable {
}
return "InsetsState: {"
+ "mDisplayFrame=" + mDisplayFrame
+ + ", mDisplayCutout=" + mDisplayCutout
+ ", mSources= { " + joiner
+ " }";
}
diff --git a/core/java/android/view/View.java b/core/java/android/view/View.java
index 1d1c87d06939..24b71abe5bc1 100644
--- a/core/java/android/view/View.java
+++ b/core/java/android/view/View.java
@@ -29071,9 +29071,6 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
*/
final Rect mCaptionInsets = new Rect();
- final DisplayCutout.ParcelableWrapper mDisplayCutout =
- new DisplayCutout.ParcelableWrapper(DisplayCutout.NO_CUTOUT);
-
/**
* 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
diff --git a/core/java/android/view/ViewRootImpl.java b/core/java/android/view/ViewRootImpl.java
index 52ce5e709990..51820d6afdfa 100644
--- a/core/java/android/view/ViewRootImpl.java
+++ b/core/java/android/view/ViewRootImpl.java
@@ -42,7 +42,6 @@ import static android.view.ViewRootImplProto.HEIGHT;
import static android.view.ViewRootImplProto.IS_ANIMATING;
import static android.view.ViewRootImplProto.IS_DRAWING;
import static android.view.ViewRootImplProto.LAST_WINDOW_INSETS;
-import static android.view.ViewRootImplProto.PENDING_DISPLAY_CUTOUT;
import static android.view.ViewRootImplProto.REMOVED;
import static android.view.ViewRootImplProto.SCROLL_Y;
import static android.view.ViewRootImplProto.SOFT_INPUT_MODE;
@@ -572,8 +571,6 @@ public final class ViewRootImpl implements ViewParent,
final Rect mWinFrame; // frame given by window manager.
final Rect mPendingBackDropFrame = new Rect();
- final DisplayCutout.ParcelableWrapper mPendingDisplayCutout =
- new DisplayCutout.ParcelableWrapper(DisplayCutout.NO_CUTOUT);
boolean mPendingAlwaysConsumeSystemBars;
private final InsetsState mTempInsets = new InsetsState();
private final InsetsSourceControl[] mTempControls = new InsetsSourceControl[SIZE];
@@ -1056,8 +1053,7 @@ public final class ViewRootImpl implements ViewParent,
res = mWindowSession.addToDisplayAsUser(mWindow, mWindowAttributes,
getHostVisibility(), mDisplay.getDisplayId(), userId,
mInsetsController.getRequestedVisibility(), mTmpFrames.frame,
- mAttachInfo.mDisplayCutout, inputChannel,
- mTempInsets, mTempControls);
+ inputChannel, mTempInsets, mTempControls);
if (mTranslator != null) {
mTranslator.translateRectInScreenToAppWindow(mTmpFrames.frame);
mTranslator.translateInsetsStateInScreenToAppWindow(mTempInsets);
@@ -1078,7 +1074,6 @@ public final class ViewRootImpl implements ViewParent,
}
}
- mPendingDisplayCutout.set(mAttachInfo.mDisplayCutout);
mAttachInfo.mAlwaysConsumeSystemBars =
(res & WindowManagerGlobal.ADD_FLAG_ALWAYS_CONSUME_SYSTEM_BARS) != 0;
mPendingAlwaysConsumeSystemBars = mAttachInfo.mAlwaysConsumeSystemBars;
@@ -1499,15 +1494,13 @@ public final class ViewRootImpl implements ViewParent,
final boolean forceNextWindowRelayout = args.argi1 != 0;
final int displayId = args.argi3;
final Rect backdropFrame = frames.backdropFrame;
- final DisplayCutout displayCutout = frames.displayCutout.get();
final boolean frameChanged = !mWinFrame.equals(frames.frame);
- final boolean cutoutChanged = !mPendingDisplayCutout.get().equals(displayCutout);
final boolean backdropFrameChanged = !mPendingBackDropFrame.equals(backdropFrame);
final boolean configChanged = !mLastReportedMergedConfiguration.equals(mergedConfiguration);
final boolean displayChanged = mDisplay.getDisplayId() != displayId;
- if (msg == MSG_RESIZED && !frameChanged && !cutoutChanged && !backdropFrameChanged
- && !configChanged && !displayChanged && !forceNextWindowRelayout) {
+ if (msg == MSG_RESIZED && !frameChanged && !backdropFrameChanged && !configChanged
+ && !displayChanged && !forceNextWindowRelayout) {
return;
}
@@ -1522,7 +1515,6 @@ public final class ViewRootImpl implements ViewParent,
setFrame(frames.frame);
mTmpFrames.displayFrame.set(frames.displayFrame);
- mPendingDisplayCutout.set(displayCutout);
mPendingBackDropFrame.set(backdropFrame);
mForceNextWindowRelayout = forceNextWindowRelayout;
mPendingAlwaysConsumeSystemBars = args.argi2 != 0;
@@ -1531,7 +1523,7 @@ public final class ViewRootImpl implements ViewParent,
reportNextDraw();
}
- if (mView != null && (frameChanged || cutoutChanged || configChanged)) {
+ if (mView != null && (frameChanged || configChanged)) {
forceLayout(mView);
}
requestLayout();
@@ -2331,8 +2323,7 @@ public final class ViewRootImpl implements ViewParent,
final Configuration config = mContext.getResources().getConfiguration();
mLastWindowInsets = mInsetsController.calculateInsets(
config.isScreenRound(), mAttachInfo.mAlwaysConsumeSystemBars,
- mPendingDisplayCutout.get(), mWindowAttributes.type,
- config.windowConfiguration.getWindowingMode(),
+ mWindowAttributes.type, config.windowConfiguration.getWindowingMode(),
mWindowAttributes.softInputMode, mWindowAttributes.flags,
(mWindowAttributes.systemUiVisibility
| mWindowAttributes.subtreeSystemUiVisibility));
@@ -2514,8 +2505,6 @@ public final class ViewRootImpl implements ViewParent,
// Execute enqueued actions on every traversal in case a detached view enqueued an action
getRunQueue().executeActions(mAttachInfo.mHandler);
- boolean cutoutChanged = false;
-
boolean layoutRequested = mLayoutRequested && (!mStopped || mReportNextDraw);
if (layoutRequested) {
@@ -2527,9 +2516,6 @@ public final class ViewRootImpl implements ViewParent,
mAttachInfo.mInTouchMode = !mAddedTouchMode;
ensureTouchModeLocally(mAddedTouchMode);
} else {
- if (!mPendingDisplayCutout.equals(mAttachInfo.mDisplayCutout)) {
- cutoutChanged = true;
- }
if (lp.width == ViewGroup.LayoutParams.WRAP_CONTENT
|| lp.height == ViewGroup.LayoutParams.WRAP_CONTENT) {
windowSizeMayChange = true;
@@ -2655,7 +2641,7 @@ public final class ViewRootImpl implements ViewParent,
}
}
- if (mFirst || windowShouldResize || viewVisibilityChanged || cutoutChanged || params != null
+ if (mFirst || windowShouldResize || viewVisibilityChanged || params != null
|| mForceNextWindowRelayout) {
mForceNextWindowRelayout = false;
@@ -2695,7 +2681,6 @@ public final class ViewRootImpl implements ViewParent,
relayoutResult = relayoutWindow(params, viewVisibility, insetsPending);
if (DEBUG_LAYOUT) Log.v(mTag, "relayout: frame=" + frame.toShortString()
- + " cutout=" + mPendingDisplayCutout.get().toString()
+ " surface=" + mSurface);
// If the pending {@link MergedConfiguration} handed back from
@@ -2711,7 +2696,6 @@ public final class ViewRootImpl implements ViewParent,
updatedConfiguration = true;
}
- cutoutChanged = !mPendingDisplayCutout.equals(mAttachInfo.mDisplayCutout);
surfaceSizeChanged = false;
if (!mLastSurfaceSize.equals(mSurfaceSize)) {
surfaceSizeChanged = true;
@@ -2735,14 +2719,6 @@ public final class ViewRootImpl implements ViewParent,
mSurfaceSequenceId++;
}
- if (cutoutChanged) {
- mAttachInfo.mDisplayCutout.set(mPendingDisplayCutout);
- if (DEBUG_LAYOUT) {
- Log.v(mTag, "DisplayCutout changing to: " + mAttachInfo.mDisplayCutout);
- }
- // Need to relayout with content insets.
- dispatchApplyInsets = true;
- }
if (alwaysConsumeSystemBarsChanged) {
mAttachInfo.mAlwaysConsumeSystemBars = mPendingAlwaysConsumeSystemBars;
dispatchApplyInsets = true;
@@ -7518,7 +7494,6 @@ public final class ViewRootImpl implements ViewParent,
insetsPending ? WindowManagerGlobal.RELAYOUT_INSETS_PENDING : 0, frameNumber,
mTmpFrames, mPendingMergedConfiguration, mSurfaceControl, mTempInsets,
mTempControls, mSurfaceSize);
- mPendingDisplayCutout.set(mTmpFrames.displayCutout);
mPendingBackDropFrame.set(mTmpFrames.backdropFrame);
if (mSurfaceControl.isValid()) {
if (!useBLAST()) {
@@ -7679,7 +7654,6 @@ public final class ViewRootImpl implements ViewParent,
proto.write(IS_DRAWING, mIsDrawing);
proto.write(ADDED, mAdded);
mWinFrame.dumpDebug(proto, WIN_FRAME);
- mPendingDisplayCutout.get().dumpDebug(proto, PENDING_DISPLAY_CUTOUT);
proto.write(LAST_WINDOW_INSETS, Objects.toString(mLastWindowInsets));
proto.write(SOFT_INPUT_MODE, InputMethodDebug.softInputModeToString(mSoftInputMode));
proto.write(SCROLL_Y, mScrollY);
diff --git a/core/java/android/view/WindowManagerImpl.java b/core/java/android/view/WindowManagerImpl.java
index 3384bbe4fd76..391e55a9050a 100644
--- a/core/java/android/view/WindowManagerImpl.java
+++ b/core/java/android/view/WindowManagerImpl.java
@@ -262,18 +262,15 @@ public final class WindowManagerImpl implements WindowManager {
private WindowInsets getWindowInsetsFromServer(WindowManager.LayoutParams attrs, Rect bounds) {
try {
- final DisplayCutout.ParcelableWrapper displayCutout =
- new DisplayCutout.ParcelableWrapper();
final InsetsState insetsState = new InsetsState();
final boolean alwaysConsumeSystemBars = WindowManagerGlobal.getWindowManagerService()
- .getWindowInsets(attrs, mContext.getDisplayId(), displayCutout, insetsState);
+ .getWindowInsets(attrs, mContext.getDisplayId(), insetsState);
final Configuration config = mContext.getResources().getConfiguration();
final boolean isScreenRound = config.isScreenRound();
final int windowingMode = config.windowConfiguration.getWindowingMode();
return insetsState.calculateInsets(bounds, null /* ignoringVisibilityState*/,
- isScreenRound, alwaysConsumeSystemBars, displayCutout.get(),
- SOFT_INPUT_ADJUST_NOTHING, attrs.flags, SYSTEM_UI_FLAG_VISIBLE, attrs.type,
- windowingMode, null /* typeSideMap */);
+ isScreenRound, alwaysConsumeSystemBars, SOFT_INPUT_ADJUST_NOTHING, attrs.flags,
+ SYSTEM_UI_FLAG_VISIBLE, attrs.type, windowingMode, null /* typeSideMap */);
} catch (RemoteException e) {
throw e.rethrowFromSystemServer();
}
diff --git a/core/java/android/view/WindowlessWindowManager.java b/core/java/android/view/WindowlessWindowManager.java
index 149338c09126..dd56c15f86f6 100644
--- a/core/java/android/view/WindowlessWindowManager.java
+++ b/core/java/android/view/WindowlessWindowManager.java
@@ -136,8 +136,8 @@ public class WindowlessWindowManager implements IWindowSession {
@Override
public int addToDisplay(IWindow window, WindowManager.LayoutParams attrs,
int viewVisibility, int displayId, InsetsState requestedVisibility, Rect outFrame,
- DisplayCutout.ParcelableWrapper outDisplayCutout, InputChannel outInputChannel,
- InsetsState outInsetsState, InsetsSourceControl[] outActiveControls) {
+ InputChannel outInputChannel, InsetsState outInsetsState,
+ InsetsSourceControl[] outActiveControls) {
final SurfaceControl.Builder b = new SurfaceControl.Builder(mSurfaceSession)
.setFormat(attrs.format)
.setBufferSize(getSurfaceWidth(attrs), getSurfaceHeight(attrs))
@@ -171,11 +171,10 @@ public class WindowlessWindowManager implements IWindowSession {
@Override
public int addToDisplayAsUser(IWindow window, WindowManager.LayoutParams attrs,
int viewVisibility, int displayId, int userId, InsetsState requestedVisibility,
- Rect outFrame, DisplayCutout.ParcelableWrapper outDisplayCutout,
- InputChannel outInputChannel, InsetsState outInsetsState,
+ Rect outFrame, InputChannel outInputChannel, InsetsState outInsetsState,
InsetsSourceControl[] outActiveControls) {
return addToDisplay(window, attrs, viewVisibility, displayId, requestedVisibility,
- outFrame, outDisplayCutout, outInputChannel, outInsetsState, outActiveControls);
+ outFrame, outInputChannel, outInsetsState, outActiveControls);
}
@Override
diff --git a/core/java/android/window/ClientWindowFrames.java b/core/java/android/window/ClientWindowFrames.java
index 5d7025b57f91..e22a5eb9fe7b 100644
--- a/core/java/android/window/ClientWindowFrames.java
+++ b/core/java/android/window/ClientWindowFrames.java
@@ -20,7 +20,6 @@ import android.annotation.NonNull;
import android.graphics.Rect;
import android.os.Parcel;
import android.os.Parcelable;
-import android.view.DisplayCutout;
/**
* The window frame container class used by client side for layout.
@@ -39,28 +38,22 @@ public class ClientWindowFrames implements Parcelable {
/** The background area while the window is resizing. */
public final @NonNull Rect backdropFrame;
- /** The area cut from the display. */
- public final @NonNull DisplayCutout.ParcelableWrapper displayCutout;
-
public ClientWindowFrames() {
frame = new Rect();
displayFrame = new Rect();
backdropFrame = new Rect();
- displayCutout = new DisplayCutout.ParcelableWrapper();
}
public ClientWindowFrames(ClientWindowFrames other) {
frame = new Rect(other.frame);
displayFrame = new Rect(other.displayFrame);
backdropFrame = new Rect(other.backdropFrame);
- displayCutout = new DisplayCutout.ParcelableWrapper(other.displayCutout.get());
}
private ClientWindowFrames(Parcel in) {
frame = Rect.CREATOR.createFromParcel(in);
displayFrame = Rect.CREATOR.createFromParcel(in);
backdropFrame = Rect.CREATOR.createFromParcel(in);
- displayCutout = DisplayCutout.ParcelableWrapper.CREATOR.createFromParcel(in);
}
/** Needed for AIDL out parameters. */
@@ -68,7 +61,6 @@ public class ClientWindowFrames implements Parcelable {
frame.set(Rect.CREATOR.createFromParcel(in));
displayFrame.set(Rect.CREATOR.createFromParcel(in));
backdropFrame.set(Rect.CREATOR.createFromParcel(in));
- displayCutout.set(DisplayCutout.ParcelableWrapper.CREATOR.createFromParcel(in));
}
@Override
@@ -76,7 +68,6 @@ public class ClientWindowFrames implements Parcelable {
frame.writeToParcel(dest, flags);
displayFrame.writeToParcel(dest, flags);
backdropFrame.writeToParcel(dest, flags);
- displayCutout.writeToParcel(dest, flags);
}
@Override
@@ -84,8 +75,7 @@ public class ClientWindowFrames implements Parcelable {
final StringBuilder sb = new StringBuilder(32);
return "ClientWindowFrames{frame=" + frame.toShortString(sb)
+ " display=" + displayFrame.toShortString(sb)
- + " backdrop=" + backdropFrame.toShortString(sb)
- + " cutout=" + displayCutout + "}";
+ + " backdrop=" + backdropFrame.toShortString(sb) + "}";
}
@Override