diff options
| author | Yunfan Chen <yunfanc@google.com> | 2021-02-19 17:58:45 +0900 |
|---|---|---|
| committer | Yunfan Chen <yunfanc@google.com> | 2021-03-02 16:11:22 +0900 |
| commit | 3dc12ebadcd18f94b276f9b8de076832f80f2a2a (patch) | |
| tree | c69efca647d6eaf46a6873e2019df5bc8895bb25 /core/java/android | |
| parent | 09f52aa440ab32e66dfabeb4cb40b72166930b4f (diff) | |
Introduce a flag to let app get global insets state
A new hidden flag is introduced to layout params to let system UI
components get the global insets state regardless of the z-order. That
is necessary to let components like power menu and system UI dialog.
Test: atest InsetsStateControllerTest
Bug: 178420426
Bug: 178115003
Change-Id: Ib103639ff00bf15919796788c0ba323aba0b4b4a
Diffstat (limited to 'core/java/android')
| -rw-r--r-- | core/java/android/view/WindowManager.java | 31 |
1 files changed, 25 insertions, 6 deletions
diff --git a/core/java/android/view/WindowManager.java b/core/java/android/view/WindowManager.java index 9e87c95a8a75..5dc4f01db7e3 100644 --- a/core/java/android/view/WindowManager.java +++ b/core/java/android/view/WindowManager.java @@ -2722,6 +2722,15 @@ public interface WindowManager extends ViewManager { public boolean hasManualSurfaceInsets; /** + * Whether we should use global insets state when report insets to the window. When set to + * {@code true}, all the insets will be reported to the window regardless of the z-order. + * Otherwise, only the insets above the given window will be reported. + * + * @hide + */ + public boolean receiveInsetsIgnoringZOrder; + + /** * Whether the previous surface insets should be used vs. what is currently set. When set * to {@code true}, the view root will ignore surfaces insets in this object and use what * it currently has. @@ -3610,15 +3619,16 @@ public interface WindowManager extends ViewManager { out.writeInt(preferredDisplayModeId); out.writeInt(systemUiVisibility); out.writeInt(subtreeSystemUiVisibility); - out.writeInt(hasSystemUiListeners ? 1 : 0); + out.writeBoolean(hasSystemUiListeners); out.writeInt(inputFeatures); out.writeLong(userActivityTimeout); out.writeInt(surfaceInsets.left); out.writeInt(surfaceInsets.top); out.writeInt(surfaceInsets.right); out.writeInt(surfaceInsets.bottom); - out.writeInt(hasManualSurfaceInsets ? 1 : 0); - out.writeInt(preservePreviousSurfaceInsets ? 1 : 0); + out.writeBoolean(hasManualSurfaceInsets); + out.writeBoolean(receiveInsetsIgnoringZOrder); + out.writeBoolean(preservePreviousSurfaceInsets); out.writeLong(accessibilityIdOfAnchor); TextUtils.writeToParcel(accessibilityTitle, out, parcelableFlags); out.writeInt(mColorMode); @@ -3679,15 +3689,16 @@ public interface WindowManager extends ViewManager { preferredDisplayModeId = in.readInt(); systemUiVisibility = in.readInt(); subtreeSystemUiVisibility = in.readInt(); - hasSystemUiListeners = in.readInt() != 0; + hasSystemUiListeners = in.readBoolean(); inputFeatures = in.readInt(); userActivityTimeout = in.readLong(); surfaceInsets.left = in.readInt(); surfaceInsets.top = in.readInt(); surfaceInsets.right = in.readInt(); surfaceInsets.bottom = in.readInt(); - hasManualSurfaceInsets = in.readInt() != 0; - preservePreviousSurfaceInsets = in.readInt() != 0; + hasManualSurfaceInsets = in.readBoolean(); + receiveInsetsIgnoringZOrder = in.readBoolean(); + preservePreviousSurfaceInsets = in.readBoolean(); accessibilityIdOfAnchor = in.readLong(); accessibilityTitle = TextUtils.CHAR_SEQUENCE_CREATOR.createFromParcel(in); mColorMode = in.readInt(); @@ -3916,6 +3927,11 @@ public interface WindowManager extends ViewManager { changes |= SURFACE_INSETS_CHANGED; } + if (receiveInsetsIgnoringZOrder != o.receiveInsetsIgnoringZOrder) { + receiveInsetsIgnoringZOrder = o.receiveInsetsIgnoringZOrder; + changes |= SURFACE_INSETS_CHANGED; + } + if (preservePreviousSurfaceInsets != o.preservePreviousSurfaceInsets) { preservePreviousSurfaceInsets = o.preservePreviousSurfaceInsets; changes |= SURFACE_INSETS_CHANGED; @@ -4104,6 +4120,9 @@ public interface WindowManager extends ViewManager { sb.append(" (!preservePreviousSurfaceInsets)"); } } + if (receiveInsetsIgnoringZOrder) { + sb.append(" receive insets ignoring z-order"); + } if (mColorMode != COLOR_MODE_DEFAULT) { sb.append(" colorMode=").append(ActivityInfo.colorModeToString(mColorMode)); } |
