Loading core/java/android/view/ViewRootImpl.java +7 −6 Original line number Diff line number Diff line Loading @@ -549,8 +549,7 @@ public final class ViewRootImpl implements ViewParent, // Compute surface insets required to draw at specified Z value. // TODO: Use real shadow insets for a constant max Z. if (!attrs.hasManualSurfaceInsets) { final int surfaceInset = (int) Math.ceil(view.getZ() * 2); attrs.surfaceInsets.set(surfaceInset, surfaceInset, surfaceInset, surfaceInset); attrs.setSurfaceInsets(view, false /*manual*/, true /*preservePrevious*/); } CompatibilityInfo compatibilityInfo = mDisplayAdjustments.getCompatibilityInfo(); Loading Loading @@ -883,10 +882,12 @@ public final class ViewRootImpl implements ViewParent, } mWindowAttributes.privateFlags |= compatibleWindowFlag; if (mWindowAttributes.preservePreviousSurfaceInsets) { // Restore old surface insets. mWindowAttributes.surfaceInsets.set( oldInsetLeft, oldInsetTop, oldInsetRight, oldInsetBottom); mWindowAttributes.hasManualSurfaceInsets = oldHasManualSurfaceInsets; } applyKeepScreenOnFlag(mWindowAttributes); Loading core/java/android/view/WindowManager.java +33 −1 Original line number Diff line number Diff line Loading @@ -1481,6 +1481,16 @@ public interface WindowManager extends ViewManager { */ public boolean hasManualSurfaceInsets; /** * 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. * * @see #surfaceInsets * @hide */ public boolean preservePreviousSurfaceInsets = true; /** * The desired bitmap format. May be one of the constants in * {@link android.graphics.PixelFormat}. Default is OPAQUE. Loading Loading @@ -1771,6 +1781,17 @@ public interface WindowManager extends ViewManager { return mTitle != null ? mTitle : ""; } /** * Sets the surface insets based on the elevation (visual z position) of the input view. * @hide */ public final void setSurfaceInsets(View view, boolean manual, boolean preservePrevious) { final int surfaceInset = (int) Math.ceil(view.getZ() * 2); surfaceInsets.set(surfaceInset, surfaceInset, surfaceInset, surfaceInset); hasManualSurfaceInsets = manual; preservePreviousSurfaceInsets = preservePrevious; } /** @hide */ @SystemApi public final void setUserActivityTimeout(long timeout) { Loading Loading @@ -1822,6 +1843,7 @@ public interface WindowManager extends ViewManager { out.writeInt(surfaceInsets.right); out.writeInt(surfaceInsets.bottom); out.writeInt(hasManualSurfaceInsets ? 1 : 0); out.writeInt(preservePreviousSurfaceInsets ? 1 : 0); out.writeInt(needsMenuKey); out.writeInt(accessibilityIdOfAnchor); TextUtils.writeToParcel(accessibilityTitle, out, parcelableFlags); Loading Loading @@ -1874,6 +1896,7 @@ public interface WindowManager extends ViewManager { surfaceInsets.right = in.readInt(); surfaceInsets.bottom = in.readInt(); hasManualSurfaceInsets = in.readInt() != 0; preservePreviousSurfaceInsets = in.readInt() != 0; needsMenuKey = in.readInt(); accessibilityIdOfAnchor = in.readInt(); accessibilityTitle = TextUtils.CHAR_SEQUENCE_CREATOR.createFromParcel(in); Loading Loading @@ -2075,6 +2098,11 @@ public interface WindowManager extends ViewManager { changes |= SURFACE_INSETS_CHANGED; } if (preservePreviousSurfaceInsets != o.preservePreviousSurfaceInsets) { preservePreviousSurfaceInsets = o.preservePreviousSurfaceInsets; changes |= SURFACE_INSETS_CHANGED; } if (needsMenuKey != o.needsMenuKey) { needsMenuKey = o.needsMenuKey; changes |= NEEDS_MENU_KEY_CHANGED; Loading Loading @@ -2200,11 +2228,15 @@ public interface WindowManager extends ViewManager { sb.append(" userActivityTimeout=").append(userActivityTimeout); } if (surfaceInsets.left != 0 || surfaceInsets.top != 0 || surfaceInsets.right != 0 || surfaceInsets.bottom != 0 || hasManualSurfaceInsets) { surfaceInsets.bottom != 0 || hasManualSurfaceInsets || !preservePreviousSurfaceInsets) { sb.append(" surfaceInsets=").append(surfaceInsets); if (hasManualSurfaceInsets) { sb.append(" (manual)"); } if (!preservePreviousSurfaceInsets) { sb.append(" (!preservePreviousSurfaceInsets)"); } } if (needsMenuKey != NEEDS_MENU_UNSET) { sb.append(" needsMenuKey="); Loading core/java/android/widget/PopupWindow.java +1 −3 Original line number Diff line number Diff line Loading @@ -1290,9 +1290,7 @@ public class PopupWindow { // We may wrap that in another view, so we'll need to manually specify // the surface insets. final int surfaceInset = (int) Math.ceil(mBackgroundView.getZ() * 2); p.surfaceInsets.set(surfaceInset, surfaceInset, surfaceInset, surfaceInset); p.hasManualSurfaceInsets = true; p.setSurfaceInsets(mBackgroundView, true /*manual*/, true /*preservePrevious*/); mPopupViewInitialLayoutDirectionInherited = (mContentView.getRawLayoutDirection() == View.LAYOUT_DIRECTION_INHERIT); Loading core/java/com/android/internal/policy/PhoneWindow.java +3 −1 Original line number Diff line number Diff line Loading @@ -1403,10 +1403,12 @@ public class PhoneWindow extends Window implements MenuBuilder.Callback { @Override public final void setElevation(float elevation) { mElevation = elevation; final WindowManager.LayoutParams attrs = getAttributes(); if (mDecor != null) { mDecor.setElevation(elevation); attrs.setSurfaceInsets(mDecor, true /*manual*/, false /*preservePrevious*/); } dispatchWindowAttributesChanged(getAttributes()); dispatchWindowAttributesChanged(attrs); } @Override Loading services/core/java/com/android/server/wm/WindowState.java +3 −2 Original line number Diff line number Diff line Loading @@ -2410,8 +2410,8 @@ final class WindowState implements WindowManagerPolicy.WindowState { pw.print(prefix); pw.print("mToken="); pw.println(mToken); pw.print(prefix); pw.print("mRootToken="); pw.println(mRootToken); if (mAppToken != null) { pw.print(prefix); pw.print("mAppToken="); pw.print(mAppToken); pw.print(" isAnimatingWithSavedSurface()="); pw.print(prefix); pw.print("mAppToken="); pw.println(mAppToken); pw.print(prefix); pw.print(" isAnimatingWithSavedSurface()="); pw.print(isAnimatingWithSavedSurface()); pw.print(" mAppDied=");pw.println(mAppDied); } Loading Loading @@ -2496,6 +2496,7 @@ final class WindowState implements WindowManagerPolicy.WindowState { pw.print(" content="); mContentInsets.printShortString(pw); pw.print(" visible="); mVisibleInsets.printShortString(pw); pw.print(" stable="); mStableInsets.printShortString(pw); pw.print(" surface="); mAttrs.surfaceInsets.printShortString(pw); pw.print(" outsets="); mOutsets.printShortString(pw); pw.println(); pw.print(prefix); pw.print("Lst insets: overscan="); Loading Loading
core/java/android/view/ViewRootImpl.java +7 −6 Original line number Diff line number Diff line Loading @@ -549,8 +549,7 @@ public final class ViewRootImpl implements ViewParent, // Compute surface insets required to draw at specified Z value. // TODO: Use real shadow insets for a constant max Z. if (!attrs.hasManualSurfaceInsets) { final int surfaceInset = (int) Math.ceil(view.getZ() * 2); attrs.surfaceInsets.set(surfaceInset, surfaceInset, surfaceInset, surfaceInset); attrs.setSurfaceInsets(view, false /*manual*/, true /*preservePrevious*/); } CompatibilityInfo compatibilityInfo = mDisplayAdjustments.getCompatibilityInfo(); Loading Loading @@ -883,10 +882,12 @@ public final class ViewRootImpl implements ViewParent, } mWindowAttributes.privateFlags |= compatibleWindowFlag; if (mWindowAttributes.preservePreviousSurfaceInsets) { // Restore old surface insets. mWindowAttributes.surfaceInsets.set( oldInsetLeft, oldInsetTop, oldInsetRight, oldInsetBottom); mWindowAttributes.hasManualSurfaceInsets = oldHasManualSurfaceInsets; } applyKeepScreenOnFlag(mWindowAttributes); Loading
core/java/android/view/WindowManager.java +33 −1 Original line number Diff line number Diff line Loading @@ -1481,6 +1481,16 @@ public interface WindowManager extends ViewManager { */ public boolean hasManualSurfaceInsets; /** * 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. * * @see #surfaceInsets * @hide */ public boolean preservePreviousSurfaceInsets = true; /** * The desired bitmap format. May be one of the constants in * {@link android.graphics.PixelFormat}. Default is OPAQUE. Loading Loading @@ -1771,6 +1781,17 @@ public interface WindowManager extends ViewManager { return mTitle != null ? mTitle : ""; } /** * Sets the surface insets based on the elevation (visual z position) of the input view. * @hide */ public final void setSurfaceInsets(View view, boolean manual, boolean preservePrevious) { final int surfaceInset = (int) Math.ceil(view.getZ() * 2); surfaceInsets.set(surfaceInset, surfaceInset, surfaceInset, surfaceInset); hasManualSurfaceInsets = manual; preservePreviousSurfaceInsets = preservePrevious; } /** @hide */ @SystemApi public final void setUserActivityTimeout(long timeout) { Loading Loading @@ -1822,6 +1843,7 @@ public interface WindowManager extends ViewManager { out.writeInt(surfaceInsets.right); out.writeInt(surfaceInsets.bottom); out.writeInt(hasManualSurfaceInsets ? 1 : 0); out.writeInt(preservePreviousSurfaceInsets ? 1 : 0); out.writeInt(needsMenuKey); out.writeInt(accessibilityIdOfAnchor); TextUtils.writeToParcel(accessibilityTitle, out, parcelableFlags); Loading Loading @@ -1874,6 +1896,7 @@ public interface WindowManager extends ViewManager { surfaceInsets.right = in.readInt(); surfaceInsets.bottom = in.readInt(); hasManualSurfaceInsets = in.readInt() != 0; preservePreviousSurfaceInsets = in.readInt() != 0; needsMenuKey = in.readInt(); accessibilityIdOfAnchor = in.readInt(); accessibilityTitle = TextUtils.CHAR_SEQUENCE_CREATOR.createFromParcel(in); Loading Loading @@ -2075,6 +2098,11 @@ public interface WindowManager extends ViewManager { changes |= SURFACE_INSETS_CHANGED; } if (preservePreviousSurfaceInsets != o.preservePreviousSurfaceInsets) { preservePreviousSurfaceInsets = o.preservePreviousSurfaceInsets; changes |= SURFACE_INSETS_CHANGED; } if (needsMenuKey != o.needsMenuKey) { needsMenuKey = o.needsMenuKey; changes |= NEEDS_MENU_KEY_CHANGED; Loading Loading @@ -2200,11 +2228,15 @@ public interface WindowManager extends ViewManager { sb.append(" userActivityTimeout=").append(userActivityTimeout); } if (surfaceInsets.left != 0 || surfaceInsets.top != 0 || surfaceInsets.right != 0 || surfaceInsets.bottom != 0 || hasManualSurfaceInsets) { surfaceInsets.bottom != 0 || hasManualSurfaceInsets || !preservePreviousSurfaceInsets) { sb.append(" surfaceInsets=").append(surfaceInsets); if (hasManualSurfaceInsets) { sb.append(" (manual)"); } if (!preservePreviousSurfaceInsets) { sb.append(" (!preservePreviousSurfaceInsets)"); } } if (needsMenuKey != NEEDS_MENU_UNSET) { sb.append(" needsMenuKey="); Loading
core/java/android/widget/PopupWindow.java +1 −3 Original line number Diff line number Diff line Loading @@ -1290,9 +1290,7 @@ public class PopupWindow { // We may wrap that in another view, so we'll need to manually specify // the surface insets. final int surfaceInset = (int) Math.ceil(mBackgroundView.getZ() * 2); p.surfaceInsets.set(surfaceInset, surfaceInset, surfaceInset, surfaceInset); p.hasManualSurfaceInsets = true; p.setSurfaceInsets(mBackgroundView, true /*manual*/, true /*preservePrevious*/); mPopupViewInitialLayoutDirectionInherited = (mContentView.getRawLayoutDirection() == View.LAYOUT_DIRECTION_INHERIT); Loading
core/java/com/android/internal/policy/PhoneWindow.java +3 −1 Original line number Diff line number Diff line Loading @@ -1403,10 +1403,12 @@ public class PhoneWindow extends Window implements MenuBuilder.Callback { @Override public final void setElevation(float elevation) { mElevation = elevation; final WindowManager.LayoutParams attrs = getAttributes(); if (mDecor != null) { mDecor.setElevation(elevation); attrs.setSurfaceInsets(mDecor, true /*manual*/, false /*preservePrevious*/); } dispatchWindowAttributesChanged(getAttributes()); dispatchWindowAttributesChanged(attrs); } @Override Loading
services/core/java/com/android/server/wm/WindowState.java +3 −2 Original line number Diff line number Diff line Loading @@ -2410,8 +2410,8 @@ final class WindowState implements WindowManagerPolicy.WindowState { pw.print(prefix); pw.print("mToken="); pw.println(mToken); pw.print(prefix); pw.print("mRootToken="); pw.println(mRootToken); if (mAppToken != null) { pw.print(prefix); pw.print("mAppToken="); pw.print(mAppToken); pw.print(" isAnimatingWithSavedSurface()="); pw.print(prefix); pw.print("mAppToken="); pw.println(mAppToken); pw.print(prefix); pw.print(" isAnimatingWithSavedSurface()="); pw.print(isAnimatingWithSavedSurface()); pw.print(" mAppDied=");pw.println(mAppDied); } Loading Loading @@ -2496,6 +2496,7 @@ final class WindowState implements WindowManagerPolicy.WindowState { pw.print(" content="); mContentInsets.printShortString(pw); pw.print(" visible="); mVisibleInsets.printShortString(pw); pw.print(" stable="); mStableInsets.printShortString(pw); pw.print(" surface="); mAttrs.surfaceInsets.printShortString(pw); pw.print(" outsets="); mOutsets.printShortString(pw); pw.println(); pw.print(prefix); pw.print("Lst insets: overscan="); Loading