Loading core/java/android/view/ViewRootImpl.java +31 −41 Original line number Diff line number Diff line Loading @@ -401,10 +401,8 @@ public final class ViewRootImpl implements ViewParent, private static boolean sAlwaysAssignFocus; /** * This list must only be modified by the main thread, so a lock is only needed when changing * the list or when accessing the list from a non-main thread. * This list must only be modified by the main thread. */ @GuardedBy("mWindowCallbacks") final ArrayList<WindowCallbacks> mWindowCallbacks = new ArrayList<>(); @UnsupportedAppUsage @UiContext Loading Loading @@ -973,16 +971,12 @@ public final class ViewRootImpl implements ViewParent, } public void addWindowCallbacks(WindowCallbacks callback) { synchronized (mWindowCallbacks) { mWindowCallbacks.add(callback); } } public void removeWindowCallbacks(WindowCallbacks callback) { synchronized (mWindowCallbacks) { mWindowCallbacks.remove(callback); } } public void reportDrawFinish() { if (mWindowDrawCountDown != null) { Loading Loading @@ -1703,15 +1697,19 @@ public final class ViewRootImpl implements ViewParent, final boolean forceNextWindowRelayout = args.argi1 != 0; final int displayId = args.argi3; final int resizeMode = args.argi5; final Rect backdropFrame = frames.backdropFrame; final boolean frameChanged = !mWinFrame.equals(frames.frame); final boolean backdropFrameChanged = !mPendingBackDropFrame.equals(backdropFrame); final Rect frame = frames.frame; final Rect displayFrame = frames.displayFrame; if (mTranslator != null) { mTranslator.translateRectInScreenToAppWindow(frame); mTranslator.translateRectInScreenToAppWindow(displayFrame); } final boolean frameChanged = !mWinFrame.equals(frame); final boolean configChanged = !mLastReportedMergedConfiguration.equals(mergedConfiguration); final boolean displayChanged = mDisplay.getDisplayId() != displayId; final boolean resizeModeChanged = mResizeMode != resizeMode; if (msg == MSG_RESIZED && !frameChanged && !backdropFrameChanged && !configChanged && !displayChanged && !resizeModeChanged && !forceNextWindowRelayout) { if (msg == MSG_RESIZED && !frameChanged && !configChanged && !displayChanged && !resizeModeChanged && !forceNextWindowRelayout) { return; } Loading @@ -1727,9 +1725,17 @@ public final class ViewRootImpl implements ViewParent, onMovedToDisplay(displayId, mLastConfigurationFromResources); } setFrame(frames.frame); mTmpFrames.displayFrame.set(frames.displayFrame); mPendingBackDropFrame.set(backdropFrame); setFrame(frame); mTmpFrames.displayFrame.set(displayFrame); if (mDragResizing && mUseMTRenderer) { boolean fullscreen = frame.equals(mPendingBackDropFrame); for (int i = mWindowCallbacks.size() - 1; i >= 0; i--) { mWindowCallbacks.get(i).onWindowSizeIsChanging(mPendingBackDropFrame, fullscreen, mAttachInfo.mVisibleInsets, mAttachInfo.mStableInsets); } } mForceNextWindowRelayout = forceNextWindowRelayout; mPendingAlwaysConsumeSystemBars = args.argi2 != 0; mSyncSeqId = args.argi4; Loading Loading @@ -5619,8 +5625,6 @@ public final class ViewRootImpl implements ViewParent, mTmpFrames.frame.top = t; mTmpFrames.frame.bottom = t + h; setFrame(mTmpFrames.frame); mPendingBackDropFrame.set(mWinFrame); maybeHandleWindowMove(mWinFrame); } break; Loading Loading @@ -8118,7 +8122,6 @@ public final class ViewRootImpl implements ViewParent, getConfiguration().windowConfiguration.getBounds()); } mPendingBackDropFrame.set(mTmpFrames.backdropFrame); if (mSurfaceControl.isValid()) { if (!useBLAST()) { mSurface.copyFrom(mSurfaceControl); Loading Loading @@ -8149,6 +8152,7 @@ public final class ViewRootImpl implements ViewParent, if (mTranslator != null) { mTranslator.translateRectInScreenToAppWindow(mTmpFrames.frame); mTranslator.translateRectInScreenToAppWindow(mTmpFrames.displayFrame); mTranslator.translateInsetsStateInScreenToAppWindow(mTempInsets); mTranslator.translateSourceControlsInScreenToAppWindow(mTempControls); } Loading Loading @@ -8193,6 +8197,13 @@ public final class ViewRootImpl implements ViewParent, private void setFrame(Rect frame) { mWinFrame.set(frame); // Surface position is now inherited from parent, and BackdropFrameRenderer uses backdrop // frame to position content. Thus, we just keep the size of backdrop frame, and remove the // offset to avoid double offset from display origin. mPendingBackDropFrame.set(frame); mPendingBackDropFrame.offsetTo(0, 0); mInsetsController.onFrameChanged(mOverrideInsetsFrame != null ? mOverrideInsetsFrame : frame); } Loading Loading @@ -8584,28 +8595,7 @@ public final class ViewRootImpl implements ViewParent, private void dispatchResized(ClientWindowFrames frames, boolean reportDraw, MergedConfiguration mergedConfiguration, boolean forceLayout, boolean alwaysConsumeSystemBars, int displayId, int seqId, int resizeMode) { final Rect frame = frames.frame; final Rect backDropFrame = frames.backdropFrame; if (DEBUG_LAYOUT) Log.v(mTag, "Resizing " + this + ": frame=" + frame.toShortString() + " reportDraw=" + reportDraw + " backDropFrame=" + backDropFrame); // Tell all listeners that we are resizing the window so that the chrome can get // updated as fast as possible on a separate thread, if (mDragResizing && mUseMTRenderer) { boolean fullscreen = frame.equals(backDropFrame); synchronized (mWindowCallbacks) { for (int i = mWindowCallbacks.size() - 1; i >= 0; i--) { mWindowCallbacks.get(i).onWindowSizeIsChanging(backDropFrame, fullscreen, mAttachInfo.mVisibleInsets, mAttachInfo.mStableInsets); } } } Message msg = mHandler.obtainMessage(reportDraw ? MSG_RESIZED_REPORT : MSG_RESIZED); if (mTranslator != null) { mTranslator.translateRectInScreenToAppWindow(frame); } SomeArgs args = SomeArgs.obtain(); final boolean sameProcessCall = (Binder.getCallingPid() == android.os.Process.myPid()); args.arg1 = sameProcessCall ? new ClientWindowFrames(frames) : frames; Loading core/java/android/window/ClientWindowFrames.java +0 −7 Original line number Diff line number Diff line Loading @@ -40,9 +40,6 @@ public class ClientWindowFrames implements Parcelable { */ public final @NonNull Rect parentFrame = new Rect(); /** The background area while the window is resizing. */ public final @NonNull Rect backdropFrame = new Rect(); public boolean isParentFrameClippedByDisplayCutout; public ClientWindowFrames() { Loading @@ -52,7 +49,6 @@ public class ClientWindowFrames implements Parcelable { frame.set(other.frame); displayFrame.set(other.displayFrame); parentFrame.set(other.parentFrame); backdropFrame.set(other.backdropFrame); isParentFrameClippedByDisplayCutout = other.isParentFrameClippedByDisplayCutout; } Loading @@ -65,7 +61,6 @@ public class ClientWindowFrames implements Parcelable { frame.readFromParcel(in); displayFrame.readFromParcel(in); parentFrame.readFromParcel(in); backdropFrame.readFromParcel(in); isParentFrameClippedByDisplayCutout = in.readBoolean(); } Loading @@ -74,7 +69,6 @@ public class ClientWindowFrames implements Parcelable { frame.writeToParcel(dest, flags); displayFrame.writeToParcel(dest, flags); parentFrame.writeToParcel(dest, flags); backdropFrame.writeToParcel(dest, flags); dest.writeBoolean(isParentFrameClippedByDisplayCutout); } Loading @@ -84,7 +78,6 @@ public class ClientWindowFrames implements Parcelable { return "ClientWindowFrames{frame=" + frame.toShortString(sb) + " display=" + displayFrame.toShortString(sb) + " parentFrame=" + parentFrame.toShortString(sb) + " backdrop=" + backdropFrame.toShortString(sb) + " parentClippedByDisplayCutout=" + isParentFrameClippedByDisplayCutout + "}"; } Loading services/core/java/com/android/server/wm/WindowState.java +0 −19 Original line number Diff line number Diff line Loading @@ -3869,25 +3869,6 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP outFrames.displayFrame.scale(mInvGlobalScale); } final Rect backdropFrame = outFrames.backdropFrame; // When the task is docked, we send fullscreen sized backdropFrame as soon as resizing // start even if we haven't received the relayout window, so that the client requests // the relayout sooner. When dragging stops, backdropFrame needs to stay fullscreen // until the window to small size, otherwise the multithread renderer will shift last // one or more frame to wrong offset. So here we send fullscreen backdrop if either // isDragResizing() or isDragResizeChanged() is true. final boolean resizing = isDragResizing() || isDragResizeChanged(); if (!resizing || getWindowConfiguration().useWindowFrameForBackdrop()) { // Surface position is now inherited from parent, and BackdropFrameRenderer uses // backdrop frame to position content. Thus we just keep the size of backdrop frame, // and remove the offset to avoid double offset from display origin. backdropFrame.set(outFrames.frame); backdropFrame.offsetTo(0, 0); } else { final DisplayInfo displayInfo = getDisplayInfo(); backdropFrame.set(0, 0, displayInfo.logicalWidth, displayInfo.logicalHeight); } // Note: in the cases where the window is tied to an activity, we should not send a // configuration update when the window has requested to be hidden. Doing so can lead to // the client erroneously accepting a configuration that would have otherwise caused an Loading Loading
core/java/android/view/ViewRootImpl.java +31 −41 Original line number Diff line number Diff line Loading @@ -401,10 +401,8 @@ public final class ViewRootImpl implements ViewParent, private static boolean sAlwaysAssignFocus; /** * This list must only be modified by the main thread, so a lock is only needed when changing * the list or when accessing the list from a non-main thread. * This list must only be modified by the main thread. */ @GuardedBy("mWindowCallbacks") final ArrayList<WindowCallbacks> mWindowCallbacks = new ArrayList<>(); @UnsupportedAppUsage @UiContext Loading Loading @@ -973,16 +971,12 @@ public final class ViewRootImpl implements ViewParent, } public void addWindowCallbacks(WindowCallbacks callback) { synchronized (mWindowCallbacks) { mWindowCallbacks.add(callback); } } public void removeWindowCallbacks(WindowCallbacks callback) { synchronized (mWindowCallbacks) { mWindowCallbacks.remove(callback); } } public void reportDrawFinish() { if (mWindowDrawCountDown != null) { Loading Loading @@ -1703,15 +1697,19 @@ public final class ViewRootImpl implements ViewParent, final boolean forceNextWindowRelayout = args.argi1 != 0; final int displayId = args.argi3; final int resizeMode = args.argi5; final Rect backdropFrame = frames.backdropFrame; final boolean frameChanged = !mWinFrame.equals(frames.frame); final boolean backdropFrameChanged = !mPendingBackDropFrame.equals(backdropFrame); final Rect frame = frames.frame; final Rect displayFrame = frames.displayFrame; if (mTranslator != null) { mTranslator.translateRectInScreenToAppWindow(frame); mTranslator.translateRectInScreenToAppWindow(displayFrame); } final boolean frameChanged = !mWinFrame.equals(frame); final boolean configChanged = !mLastReportedMergedConfiguration.equals(mergedConfiguration); final boolean displayChanged = mDisplay.getDisplayId() != displayId; final boolean resizeModeChanged = mResizeMode != resizeMode; if (msg == MSG_RESIZED && !frameChanged && !backdropFrameChanged && !configChanged && !displayChanged && !resizeModeChanged && !forceNextWindowRelayout) { if (msg == MSG_RESIZED && !frameChanged && !configChanged && !displayChanged && !resizeModeChanged && !forceNextWindowRelayout) { return; } Loading @@ -1727,9 +1725,17 @@ public final class ViewRootImpl implements ViewParent, onMovedToDisplay(displayId, mLastConfigurationFromResources); } setFrame(frames.frame); mTmpFrames.displayFrame.set(frames.displayFrame); mPendingBackDropFrame.set(backdropFrame); setFrame(frame); mTmpFrames.displayFrame.set(displayFrame); if (mDragResizing && mUseMTRenderer) { boolean fullscreen = frame.equals(mPendingBackDropFrame); for (int i = mWindowCallbacks.size() - 1; i >= 0; i--) { mWindowCallbacks.get(i).onWindowSizeIsChanging(mPendingBackDropFrame, fullscreen, mAttachInfo.mVisibleInsets, mAttachInfo.mStableInsets); } } mForceNextWindowRelayout = forceNextWindowRelayout; mPendingAlwaysConsumeSystemBars = args.argi2 != 0; mSyncSeqId = args.argi4; Loading Loading @@ -5619,8 +5625,6 @@ public final class ViewRootImpl implements ViewParent, mTmpFrames.frame.top = t; mTmpFrames.frame.bottom = t + h; setFrame(mTmpFrames.frame); mPendingBackDropFrame.set(mWinFrame); maybeHandleWindowMove(mWinFrame); } break; Loading Loading @@ -8118,7 +8122,6 @@ public final class ViewRootImpl implements ViewParent, getConfiguration().windowConfiguration.getBounds()); } mPendingBackDropFrame.set(mTmpFrames.backdropFrame); if (mSurfaceControl.isValid()) { if (!useBLAST()) { mSurface.copyFrom(mSurfaceControl); Loading Loading @@ -8149,6 +8152,7 @@ public final class ViewRootImpl implements ViewParent, if (mTranslator != null) { mTranslator.translateRectInScreenToAppWindow(mTmpFrames.frame); mTranslator.translateRectInScreenToAppWindow(mTmpFrames.displayFrame); mTranslator.translateInsetsStateInScreenToAppWindow(mTempInsets); mTranslator.translateSourceControlsInScreenToAppWindow(mTempControls); } Loading Loading @@ -8193,6 +8197,13 @@ public final class ViewRootImpl implements ViewParent, private void setFrame(Rect frame) { mWinFrame.set(frame); // Surface position is now inherited from parent, and BackdropFrameRenderer uses backdrop // frame to position content. Thus, we just keep the size of backdrop frame, and remove the // offset to avoid double offset from display origin. mPendingBackDropFrame.set(frame); mPendingBackDropFrame.offsetTo(0, 0); mInsetsController.onFrameChanged(mOverrideInsetsFrame != null ? mOverrideInsetsFrame : frame); } Loading Loading @@ -8584,28 +8595,7 @@ public final class ViewRootImpl implements ViewParent, private void dispatchResized(ClientWindowFrames frames, boolean reportDraw, MergedConfiguration mergedConfiguration, boolean forceLayout, boolean alwaysConsumeSystemBars, int displayId, int seqId, int resizeMode) { final Rect frame = frames.frame; final Rect backDropFrame = frames.backdropFrame; if (DEBUG_LAYOUT) Log.v(mTag, "Resizing " + this + ": frame=" + frame.toShortString() + " reportDraw=" + reportDraw + " backDropFrame=" + backDropFrame); // Tell all listeners that we are resizing the window so that the chrome can get // updated as fast as possible on a separate thread, if (mDragResizing && mUseMTRenderer) { boolean fullscreen = frame.equals(backDropFrame); synchronized (mWindowCallbacks) { for (int i = mWindowCallbacks.size() - 1; i >= 0; i--) { mWindowCallbacks.get(i).onWindowSizeIsChanging(backDropFrame, fullscreen, mAttachInfo.mVisibleInsets, mAttachInfo.mStableInsets); } } } Message msg = mHandler.obtainMessage(reportDraw ? MSG_RESIZED_REPORT : MSG_RESIZED); if (mTranslator != null) { mTranslator.translateRectInScreenToAppWindow(frame); } SomeArgs args = SomeArgs.obtain(); final boolean sameProcessCall = (Binder.getCallingPid() == android.os.Process.myPid()); args.arg1 = sameProcessCall ? new ClientWindowFrames(frames) : frames; Loading
core/java/android/window/ClientWindowFrames.java +0 −7 Original line number Diff line number Diff line Loading @@ -40,9 +40,6 @@ public class ClientWindowFrames implements Parcelable { */ public final @NonNull Rect parentFrame = new Rect(); /** The background area while the window is resizing. */ public final @NonNull Rect backdropFrame = new Rect(); public boolean isParentFrameClippedByDisplayCutout; public ClientWindowFrames() { Loading @@ -52,7 +49,6 @@ public class ClientWindowFrames implements Parcelable { frame.set(other.frame); displayFrame.set(other.displayFrame); parentFrame.set(other.parentFrame); backdropFrame.set(other.backdropFrame); isParentFrameClippedByDisplayCutout = other.isParentFrameClippedByDisplayCutout; } Loading @@ -65,7 +61,6 @@ public class ClientWindowFrames implements Parcelable { frame.readFromParcel(in); displayFrame.readFromParcel(in); parentFrame.readFromParcel(in); backdropFrame.readFromParcel(in); isParentFrameClippedByDisplayCutout = in.readBoolean(); } Loading @@ -74,7 +69,6 @@ public class ClientWindowFrames implements Parcelable { frame.writeToParcel(dest, flags); displayFrame.writeToParcel(dest, flags); parentFrame.writeToParcel(dest, flags); backdropFrame.writeToParcel(dest, flags); dest.writeBoolean(isParentFrameClippedByDisplayCutout); } Loading @@ -84,7 +78,6 @@ public class ClientWindowFrames implements Parcelable { return "ClientWindowFrames{frame=" + frame.toShortString(sb) + " display=" + displayFrame.toShortString(sb) + " parentFrame=" + parentFrame.toShortString(sb) + " backdrop=" + backdropFrame.toShortString(sb) + " parentClippedByDisplayCutout=" + isParentFrameClippedByDisplayCutout + "}"; } Loading
services/core/java/com/android/server/wm/WindowState.java +0 −19 Original line number Diff line number Diff line Loading @@ -3869,25 +3869,6 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP outFrames.displayFrame.scale(mInvGlobalScale); } final Rect backdropFrame = outFrames.backdropFrame; // When the task is docked, we send fullscreen sized backdropFrame as soon as resizing // start even if we haven't received the relayout window, so that the client requests // the relayout sooner. When dragging stops, backdropFrame needs to stay fullscreen // until the window to small size, otherwise the multithread renderer will shift last // one or more frame to wrong offset. So here we send fullscreen backdrop if either // isDragResizing() or isDragResizeChanged() is true. final boolean resizing = isDragResizing() || isDragResizeChanged(); if (!resizing || getWindowConfiguration().useWindowFrameForBackdrop()) { // Surface position is now inherited from parent, and BackdropFrameRenderer uses // backdrop frame to position content. Thus we just keep the size of backdrop frame, // and remove the offset to avoid double offset from display origin. backdropFrame.set(outFrames.frame); backdropFrame.offsetTo(0, 0); } else { final DisplayInfo displayInfo = getDisplayInfo(); backdropFrame.set(0, 0, displayInfo.logicalWidth, displayInfo.logicalHeight); } // Note: in the cases where the window is tied to an activity, we should not send a // configuration update when the window has requested to be hidden. Doing so can lead to // the client erroneously accepting a configuration that would have otherwise caused an Loading