From cc79f24c49cc46f1fb98352cff01572f49f6f370 Mon Sep 17 00:00:00 2001 From: Milton Wu Date: Mon, 18 Apr 2022 11:54:54 +0800 Subject: [PATCH] Redraw ScreenDecorations only if rotation changed In ScreenDecorations.onConfigurationChanged(), only redraw OverlayWindow views when rotation is changed Bug: 229549809 Test: atest ScreenDecorationsTest Change-Id: Ic596c065ac9f962de94277be858fdb2ab96bc833 --- .../src/com/android/systemui/ScreenDecorations.java | 6 +++--- .../src/com/android/systemui/ScreenDecorationsTest.java | 4 ++++ 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/packages/SystemUI/src/com/android/systemui/ScreenDecorations.java b/packages/SystemUI/src/com/android/systemui/ScreenDecorations.java index 7cc738a4e437a..1a826ec56ac6d 100644 --- a/packages/SystemUI/src/com/android/systemui/ScreenDecorations.java +++ b/packages/SystemUI/src/com/android/systemui/ScreenDecorations.java @@ -971,10 +971,10 @@ public class ScreenDecorations extends CoreStartable implements Tunable , Dumpab cutoutView.updateRotation(mRotation); } } - } - // update all provider views inside overlay - updateOverlayProviderViews(); + // update all provider views inside overlay + updateOverlayProviderViews(); + } } private boolean hasRoundedCorners() { diff --git a/packages/SystemUI/tests/src/com/android/systemui/ScreenDecorationsTest.java b/packages/SystemUI/tests/src/com/android/systemui/ScreenDecorationsTest.java index 9760c6181ab2e..d8d73db2ca8c2 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/ScreenDecorationsTest.java +++ b/packages/SystemUI/tests/src/com/android/systemui/ScreenDecorationsTest.java @@ -63,6 +63,7 @@ import android.util.RotationUtils; import android.util.Size; import android.view.Display; import android.view.DisplayCutout; +import android.view.Surface; import android.view.View; import android.view.ViewGroup; import android.view.WindowManager; @@ -974,6 +975,7 @@ public class ScreenDecorationsTest extends SysuiTestCase { getTestsDrawable(com.android.systemui.tests.R.drawable.rounded4px) /* roundedBottomDrawable */, 0 /* roundedPadding */, false /* fillCutout */, true /* privacyDot */); + doReturn(Surface.ROTATION_0).when(mDisplay).getRotation(); mScreenDecorations.start(); @@ -987,6 +989,8 @@ public class ScreenDecorationsTest extends SysuiTestCase { getTestsDrawable(com.android.systemui.tests.R.drawable.rounded5px) /* roundedBottomDrawable */, 0 /* roundedPadding */, false /* fillCutout */, true /* privacyDot */); + doReturn(Surface.ROTATION_270).when(mDisplay).getRotation(); + mScreenDecorations.onConfigurationChanged(null); assertEquals(new Size(4, 4), resDelegate.getTopRoundedSize());