Reset WindowMagnification when the density is changed
To prevent MirrorSurfaceView not cleared, when the denisty is changed, we should call deleteWindowMagnification and enableWindowMagnification to reset WindowMagnification instead of just removing the mirrorview. Bug: 169149030 Test: atest WindowMagnificationControllerTest Change-Id: Ie1da5f3556cf23482c562b479f483783e09ded1f
This commit is contained in:
@@ -249,8 +249,8 @@ class WindowMagnificationController implements View.OnTouchListener, SurfaceHold
|
||||
if ((configDiff & ActivityInfo.CONFIG_DENSITY) != 0) {
|
||||
updateDimensions();
|
||||
if (isWindowVisible()) {
|
||||
mWm.removeView(mMirrorView);
|
||||
createMirrorWindow();
|
||||
deleteWindowMagnification();
|
||||
enableWindowMagnification(Float.NaN, Float.NaN, Float.NaN);
|
||||
}
|
||||
} else if ((configDiff & ActivityInfo.CONFIG_ORIENTATION) != 0) {
|
||||
onRotate();
|
||||
|
||||
@@ -224,11 +224,12 @@ public class WindowMagnificationControllerTest extends SysuiTestCase {
|
||||
|
||||
|
||||
@Test
|
||||
public void onDensityChanged_enabled_updateDimensionsAndLayout() {
|
||||
public void onDensityChanged_enabled_updateDimensionsAndResetWindowMagnification() {
|
||||
mInstrumentation.runOnMainSync(() -> {
|
||||
mWindowMagnificationController.enableWindowMagnification(Float.NaN, Float.NaN,
|
||||
Float.NaN);
|
||||
Mockito.reset(mWindowManager);
|
||||
Mockito.reset(mMirrorWindowControl);
|
||||
});
|
||||
|
||||
mInstrumentation.runOnMainSync(() -> {
|
||||
@@ -237,7 +238,9 @@ public class WindowMagnificationControllerTest extends SysuiTestCase {
|
||||
|
||||
verify(mResources, atLeastOnce()).getDimensionPixelSize(anyInt());
|
||||
verify(mWindowManager).removeView(any());
|
||||
verify(mMirrorWindowControl).destroyControl();
|
||||
verify(mWindowManager).addView(any(), any());
|
||||
verify(mMirrorWindowControl).showControl();
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
Reference in New Issue
Block a user