Update the last frames in relayout window

The frames are computed in relayout and the client also uses
it as the last state. It is unnecessary to request redraw by
a false alarm frame changes.

Fix: 144585233
Test: atest DisplaySizeTest
Test: 1. Launch an activity that doesn't handle density change.
      2. Change density by shell command "wm density $value".
      3. Check there won't be a black screen.

Change-Id: Ia9dbda66506ef11e5cbe811f635031756803742b
This commit is contained in:
Riddle Hsu
2019-11-29 18:08:26 +08:00
parent 4480cf5a3a
commit 2652da82e9
2 changed files with 10 additions and 4 deletions

View File

@@ -2351,8 +2351,9 @@ public class WindowManagerService extends IWindowManager.Stub
win.setLastReportedMergedConfiguration(mergedConfiguration);
// Update the last inset values here because the values are sent back to the client.
// The last inset values represent the last client state.
// Update the last frames and inset values here because the values are sent back to the
// client. The last values represent the last client state.
win.updateLastFrames();
win.updateLastInsetValues();
win.getCompatFrame(outFrame);

View File

@@ -1308,8 +1308,7 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP
// We update mLastFrame always rather than in the conditional with the last inset
// variables, because mFrameSizeChanged only tracks the width and height changing.
mWindowFrames.mLastFrame.set(mWindowFrames.mFrame);
mWindowFrames.mLastRelFrame.set(mWindowFrames.mRelFrame);
updateLastFrames();
if (didFrameInsetsChange
|| winAnimator.mSurfaceResized
@@ -4817,6 +4816,12 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP
return mEmbeddedDisplayContents.remove(dc);
}
/** Updates the last frames and relative frames to the current ones. */
void updateLastFrames() {
mWindowFrames.mLastFrame.set(mWindowFrames.mFrame);
mWindowFrames.mLastRelFrame.set(mWindowFrames.mRelFrame);
}
/**
* Updates the last inset values to the current ones.
*/