From 851046894fdc03ac647fe29ed6214db1bf2ebd84 Mon Sep 17 00:00:00 2001 From: shawnlin Date: Thu, 5 May 2022 16:29:05 +0800 Subject: [PATCH] Fixed cutout flicker in C10, P10 We should update view layout for hwc layer when orientation change like we did for the non-hwc layers. Bug: 229815386 Test: keep rotating device and see if there is cutout flicker Change-Id: I1b9a95c7132c2e805fdd4615f34fd0b8fcdfeee7 --- .../android/systemui/ScreenDecorations.java | 20 +++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/packages/SystemUI/src/com/android/systemui/ScreenDecorations.java b/packages/SystemUI/src/com/android/systemui/ScreenDecorations.java index cbce854e4a712..dd312186afee9 100644 --- a/packages/SystemUI/src/com/android/systemui/ScreenDecorations.java +++ b/packages/SystemUI/src/com/android/systemui/ScreenDecorations.java @@ -47,6 +47,7 @@ import android.hardware.graphics.common.AlphaInterpretation; import android.hardware.graphics.common.DisplayDecorationSupport; import android.os.Handler; import android.os.SystemProperties; +import android.os.Trace; import android.os.UserHandle; import android.provider.Settings.Secure; import android.util.DisplayUtils; @@ -1067,15 +1068,22 @@ public class ScreenDecorations extends CoreStartable implements Tunable , Dumpab } private void updateLayoutParams() { - if (mOverlays == null) { - return; + //ToDo: We should skip unnecessary call to update view layout. + Trace.beginSection("ScreenDecorations#updateLayoutParams"); + if (mScreenDecorHwcWindow != null) { + mWindowManager.updateViewLayout(mScreenDecorHwcWindow, getHwcWindowLayoutParams()); } - for (int i = 0; i < BOUNDS_POSITION_LENGTH; i++) { - if (mOverlays[i] == null) { - continue; + + if (mOverlays != null) { + for (int i = 0; i < BOUNDS_POSITION_LENGTH; i++) { + if (mOverlays[i] == null) { + continue; + } + mWindowManager.updateViewLayout( + mOverlays[i].getRootView(), getWindowLayoutParams(i)); } - mWindowManager.updateViewLayout(mOverlays[i].getRootView(), getWindowLayoutParams(i)); } + Trace.endSection(); } @Override