Merge "Consolidate filling of window frames and config for client" into sc-dev
This commit is contained in:
@@ -2474,29 +2474,12 @@ public class WindowManagerService extends IWindowManager.Stub
|
|||||||
win.mResizedWhileGone = false;
|
win.mResizedWhileGone = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// We must always send the latest {@link MergedConfiguration}, regardless of whether we
|
win.fillClientWindowFramesAndConfiguration(outFrames, mergedConfiguration,
|
||||||
// have already reported it. The client might not have processed the previous value yet
|
false /* useLatestConfig */, shouldRelayout);
|
||||||
// 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);
|
|
||||||
|
|
||||||
// Set resize-handled here because the values are sent back to the client.
|
// Set resize-handled here because the values are sent back to the client.
|
||||||
win.onResizeHandled();
|
win.onResizeHandled();
|
||||||
|
|
||||||
win.fillClientWindowFrames(outFrames);
|
|
||||||
outInsetsState.set(win.getCompatInsetsState(), win.isClientLocal());
|
outInsetsState.set(win.getCompatInsetsState(), win.isClientLocal());
|
||||||
if (DEBUG) {
|
if (DEBUG) {
|
||||||
Slog.v(TAG_WM, "Relayout given client " + client.asBinder()
|
Slog.v(TAG_WM, "Relayout given client " + client.asBinder()
|
||||||
|
|||||||
@@ -2916,21 +2916,6 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP
|
|||||||
return processConfig;
|
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() {
|
private Configuration getLastReportedConfiguration() {
|
||||||
return mLastReportedConfiguration.getMergedConfiguration();
|
return mLastReportedConfiguration.getMergedConfiguration();
|
||||||
}
|
}
|
||||||
@@ -3709,7 +3694,17 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP
|
|||||||
return wpc != null && wpc.registeredForDisplayAreaConfigChanges();
|
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.frame.set(mWindowFrames.mCompatFrame);
|
||||||
outFrames.displayFrame.set(mWindowFrames.mDisplayFrame);
|
outFrames.displayFrame.set(mWindowFrames.mDisplayFrame);
|
||||||
if (mInvGlobalScale != 1.0f && hasCompatScale()) {
|
if (mInvGlobalScale != 1.0f && hasCompatScale()) {
|
||||||
@@ -3734,6 +3729,23 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP
|
|||||||
final DisplayInfo displayInfo = getDisplayInfo();
|
final DisplayInfo displayInfo = getDisplayInfo();
|
||||||
backdropFrame.set(0, 0, displayInfo.logicalWidth, displayInfo.logicalHeight);
|
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() {
|
void reportResized() {
|
||||||
@@ -3761,9 +3773,6 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP
|
|||||||
ProtoLog.i(WM_DEBUG_ORIENTATION, "Resizing %s WITH DRAW PENDING", this);
|
ProtoLog.i(WM_DEBUG_ORIENTATION, "Resizing %s WITH DRAW PENDING", this);
|
||||||
}
|
}
|
||||||
|
|
||||||
getMergedConfiguration(mLastReportedConfiguration);
|
|
||||||
mLastConfigReportedToClient = true;
|
|
||||||
|
|
||||||
final boolean reportOrientation = mReportOrientationChanged;
|
final boolean reportOrientation = mReportOrientationChanged;
|
||||||
// Always reset these states first, so if {@link IWindow#resized} fails, this
|
// Always reset these states first, so if {@link IWindow#resized} fails, this
|
||||||
// window won't be added to {@link WindowManagerService#mResizingWindows} and set
|
// window won't be added to {@link WindowManagerService#mResizingWindows} and set
|
||||||
@@ -3773,18 +3782,20 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP
|
|||||||
mDragResizingChangeReported = true;
|
mDragResizingChangeReported = true;
|
||||||
mWindowFrames.clearReportResizeHints();
|
mWindowFrames.clearReportResizeHints();
|
||||||
|
|
||||||
final MergedConfiguration mergedConfiguration = mLastReportedConfiguration;
|
fillClientWindowFramesAndConfiguration(mClientWindowFrames, mLastReportedConfiguration,
|
||||||
|
true /* useLatestConfig */, false /* relayoutVisible */);
|
||||||
final boolean reportDraw = drawPending || useBLASTSync() || !mRedrawForSyncReported;
|
final boolean reportDraw = drawPending || useBLASTSync() || !mRedrawForSyncReported;
|
||||||
final boolean forceRelayout = reportOrientation || isDragResizeChanged() || !mRedrawForSyncReported;
|
final boolean forceRelayout = reportOrientation || isDragResizeChanged() || !mRedrawForSyncReported;
|
||||||
final int displayId = getDisplayId();
|
final DisplayContent displayContent = getDisplayContent();
|
||||||
fillClientWindowFrames(mClientWindowFrames);
|
final boolean alwaysConsumeSystemBars =
|
||||||
|
displayContent.getDisplayPolicy().areSystemBarsForcedShownLw(this);
|
||||||
|
final int displayId = displayContent.getDisplayId();
|
||||||
|
|
||||||
markRedrawForSyncReported();
|
markRedrawForSyncReported();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
mClient.resized(mClientWindowFrames, reportDraw, mergedConfiguration, forceRelayout,
|
mClient.resized(mClientWindowFrames, reportDraw, mLastReportedConfiguration,
|
||||||
getDisplayContent().getDisplayPolicy().areSystemBarsForcedShownLw(this),
|
forceRelayout, alwaysConsumeSystemBars, displayId);
|
||||||
displayId);
|
|
||||||
if (drawPending && reportOrientation && mOrientationChanging) {
|
if (drawPending && reportOrientation && mOrientationChanging) {
|
||||||
mOrientationChangeRedrawRequestTime = SystemClock.elapsedRealtime();
|
mOrientationChangeRedrawRequestTime = SystemClock.elapsedRealtime();
|
||||||
ProtoLog.v(WM_DEBUG_ORIENTATION,
|
ProtoLog.v(WM_DEBUG_ORIENTATION,
|
||||||
|
|||||||
Reference in New Issue
Block a user