diff options
| author | 2023-01-25 12:13:37 +0000 | |
|---|---|---|
| committer | 2023-01-26 17:10:52 +0000 | |
| commit | e213443daf39e4e8f97ffe3a7fab4028ebae283a (patch) | |
| tree | 2a47edd23bcf59f4a290ba4064786a5fc76b3eb2 | |
| parent | 6dead15cd225371802dd026d0d70f0dc052d37ec (diff) | |
Fix double SCM Restart Icon
Fixes: 266567365
Test: Manual following bug detail instructions and run
`atest WMShellUnitTests:CompatUILayoutTest`
Change-Id: Ia7283e289313bc114f1046ad9447f8c4edd38bf3
2 files changed, 10 insertions, 3 deletions
diff --git a/libs/WindowManager/Shell/src/com/android/wm/shell/compatui/CompatUIWindowManager.java b/libs/WindowManager/Shell/src/com/android/wm/shell/compatui/CompatUIWindowManager.java index c14704d04e3a..fe95d04bad3c 100644 --- a/libs/WindowManager/Shell/src/com/android/wm/shell/compatui/CompatUIWindowManager.java +++ b/libs/WindowManager/Shell/src/com/android/wm/shell/compatui/CompatUIWindowManager.java @@ -215,8 +215,14 @@ class CompatUIWindowManager extends CompatUIWindowManagerAbstract { : taskStableBounds.right - taskBounds.left - mLayout.getMeasuredWidth(); final int positionY = taskStableBounds.bottom - taskBounds.top - mLayout.getMeasuredHeight(); - + // To secure a proper visualisation, we hide the layout while updating the position of + // the {@link SurfaceControl} it belongs. + final int oldVisibility = mLayout.getVisibility(); + if (oldVisibility == View.VISIBLE) { + mLayout.setVisibility(View.GONE); + } updateSurfacePosition(positionX, positionY); + mLayout.setVisibility(oldVisibility); } private void updateVisibilityOfViews() { diff --git a/libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/compatui/CompatUIWindowManagerTest.java b/libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/compatui/CompatUIWindowManagerTest.java index 324940e4113c..0c5edc3f59de 100644 --- a/libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/compatui/CompatUIWindowManagerTest.java +++ b/libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/compatui/CompatUIWindowManagerTest.java @@ -28,6 +28,7 @@ import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertTrue; import static org.mockito.ArgumentMatchers.anyBoolean; +import static org.mockito.Mockito.atLeastOnce; import static org.mockito.Mockito.clearInvocations; import static org.mockito.Mockito.doReturn; import static org.mockito.Mockito.mock; @@ -359,14 +360,14 @@ public class CompatUIWindowManagerTest extends ShellTestCase { mWindowManager.updateVisibility(/* canShow= */ false); verify(mWindowManager, never()).createLayout(anyBoolean()); - verify(mLayout).setVisibility(View.GONE); + verify(mLayout, atLeastOnce()).setVisibility(View.GONE); // Show button. doReturn(View.GONE).when(mLayout).getVisibility(); mWindowManager.updateVisibility(/* canShow= */ true); verify(mWindowManager, never()).createLayout(anyBoolean()); - verify(mLayout).setVisibility(View.VISIBLE); + verify(mLayout, atLeastOnce()).setVisibility(View.VISIBLE); } @Test |