Merge "Consolidate filling of window frames and config for client" into sc-dev am: 1d55f8ecbe
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/14099052 Change-Id: Icb8a2b9881c70d3a0132bf80400647d02845206b
This commit is contained in:
@@ -2474,29 +2474,12 @@ public class WindowManagerService extends IWindowManager.Stub
|
||||
win.mResizedWhileGone = false;
|
||||
}
|
||||
|
||||
// We must always send the latest {@link MergedConfiguration}, regardless of whether we
|
||||
// have already reported it. The client might not have processed the previous value yet
|
||||
// and needs process it before handling the corresponding window frame. the variable
|
||||
// {@code mergedConfiguration} is an out parameter that will be passed back to the
|
||||
// client over IPC and checked there.
|
||||
// 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 activity restart. We instead hand back the last reported
|
||||
// {@link MergedConfiguration}.
|
||||
if (shouldRelayout && (!win.shouldCheckTokenVisibleRequested()
|
||||
|| win.mToken.isVisibleRequested())) {
|
||||
win.getMergedConfiguration(mergedConfiguration);
|
||||
} else {
|
||||
win.getLastReportedMergedConfiguration(mergedConfiguration);
|
||||
}
|
||||
|
||||
win.setLastReportedMergedConfiguration(mergedConfiguration);
|
||||
win.fillClientWindowFramesAndConfiguration(outFrames, mergedConfiguration,
|
||||
false /* useLatestConfig */, shouldRelayout);
|
||||
|
||||
// Set resize-handled here because the values are sent back to the client.
|
||||
win.onResizeHandled();
|
||||
|
||||
win.fillClientWindowFrames(outFrames);
|
||||
outInsetsState.set(win.getCompatInsetsState(), win.isClientLocal());
|
||||
if (DEBUG) {
|
||||
Slog.v(TAG_WM, "Relayout given client " + client.asBinder()
|
||||
|
||||
@@ -2916,21 +2916,6 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP
|
||||
return processConfig;
|
||||
}
|
||||
|
||||
void getMergedConfiguration(MergedConfiguration outConfiguration) {
|
||||
final Configuration globalConfig = getProcessGlobalConfiguration();
|
||||
final Configuration overrideConfig = getMergedOverrideConfiguration();
|
||||
outConfiguration.setConfiguration(globalConfig, overrideConfig);
|
||||
}
|
||||
|
||||
void setLastReportedMergedConfiguration(MergedConfiguration config) {
|
||||
mLastReportedConfiguration.setTo(config);
|
||||
mLastConfigReportedToClient = true;
|
||||
}
|
||||
|
||||
void getLastReportedMergedConfiguration(MergedConfiguration config) {
|
||||
config.setTo(mLastReportedConfiguration);
|
||||
}
|
||||
|
||||
private Configuration getLastReportedConfiguration() {
|
||||
return mLastReportedConfiguration.getMergedConfiguration();
|
||||
}
|
||||
@@ -3709,7 +3694,17 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP
|
||||
return wpc != null && wpc.registeredForDisplayAreaConfigChanges();
|
||||
}
|
||||
|
||||
void fillClientWindowFrames(ClientWindowFrames outFrames) {
|
||||
/**
|
||||
* Fills the given window frames and merged configuration for the client.
|
||||
*
|
||||
* @param outFrames The frames that will be sent to the client.
|
||||
* @param outMergedConfiguration The configuration that will be sent to the client.
|
||||
* @param useLatestConfig Whether to use the latest configuration.
|
||||
* @param relayoutVisible Whether to consider visibility to use the latest configuration.
|
||||
*/
|
||||
void fillClientWindowFramesAndConfiguration(ClientWindowFrames outFrames,
|
||||
MergedConfiguration outMergedConfiguration, boolean useLatestConfig,
|
||||
boolean relayoutVisible) {
|
||||
outFrames.frame.set(mWindowFrames.mCompatFrame);
|
||||
outFrames.displayFrame.set(mWindowFrames.mDisplayFrame);
|
||||
if (mInvGlobalScale != 1.0f && hasCompatScale()) {
|
||||
@@ -3734,6 +3729,23 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP
|
||||
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
|
||||
// activity restart. We instead hand back the last reported {@link MergedConfiguration}.
|
||||
if (useLatestConfig || (relayoutVisible && (shouldCheckTokenVisibleRequested()
|
||||
|| mToken.isVisibleRequested()))) {
|
||||
final Configuration globalConfig = getProcessGlobalConfiguration();
|
||||
final Configuration overrideConfig = getMergedOverrideConfiguration();
|
||||
outMergedConfiguration.setConfiguration(globalConfig, overrideConfig);
|
||||
if (outMergedConfiguration != mLastReportedConfiguration) {
|
||||
mLastReportedConfiguration.setTo(outMergedConfiguration);
|
||||
}
|
||||
} else {
|
||||
outMergedConfiguration.setTo(mLastReportedConfiguration);
|
||||
}
|
||||
mLastConfigReportedToClient = true;
|
||||
}
|
||||
|
||||
void reportResized() {
|
||||
@@ -3761,9 +3773,6 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP
|
||||
ProtoLog.i(WM_DEBUG_ORIENTATION, "Resizing %s WITH DRAW PENDING", this);
|
||||
}
|
||||
|
||||
getMergedConfiguration(mLastReportedConfiguration);
|
||||
mLastConfigReportedToClient = true;
|
||||
|
||||
final boolean reportOrientation = mReportOrientationChanged;
|
||||
// Always reset these states first, so if {@link IWindow#resized} fails, this
|
||||
// window won't be added to {@link WindowManagerService#mResizingWindows} and set
|
||||
@@ -3773,18 +3782,20 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP
|
||||
mDragResizingChangeReported = true;
|
||||
mWindowFrames.clearReportResizeHints();
|
||||
|
||||
final MergedConfiguration mergedConfiguration = mLastReportedConfiguration;
|
||||
fillClientWindowFramesAndConfiguration(mClientWindowFrames, mLastReportedConfiguration,
|
||||
true /* useLatestConfig */, false /* relayoutVisible */);
|
||||
final boolean reportDraw = drawPending || useBLASTSync() || !mRedrawForSyncReported;
|
||||
final boolean forceRelayout = reportOrientation || isDragResizeChanged() || !mRedrawForSyncReported;
|
||||
final int displayId = getDisplayId();
|
||||
fillClientWindowFrames(mClientWindowFrames);
|
||||
final DisplayContent displayContent = getDisplayContent();
|
||||
final boolean alwaysConsumeSystemBars =
|
||||
displayContent.getDisplayPolicy().areSystemBarsForcedShownLw(this);
|
||||
final int displayId = displayContent.getDisplayId();
|
||||
|
||||
markRedrawForSyncReported();
|
||||
|
||||
try {
|
||||
mClient.resized(mClientWindowFrames, reportDraw, mergedConfiguration, forceRelayout,
|
||||
getDisplayContent().getDisplayPolicy().areSystemBarsForcedShownLw(this),
|
||||
displayId);
|
||||
mClient.resized(mClientWindowFrames, reportDraw, mLastReportedConfiguration,
|
||||
forceRelayout, alwaysConsumeSystemBars, displayId);
|
||||
if (drawPending && reportOrientation && mOrientationChanging) {
|
||||
mOrientationChangeRedrawRequestTime = SystemClock.elapsedRealtime();
|
||||
ProtoLog.v(WM_DEBUG_ORIENTATION,
|
||||
|
||||
Reference in New Issue
Block a user