From f02c47d86f48d927d1d535e2a79a529ad736df08 Mon Sep 17 00:00:00 2001 From: Leon Scroggins III Date: Thu, 23 Dec 2021 14:24:58 -0500 Subject: [PATCH] Only updateDisplayDecoration if not the default The default value for DISPLAY_DECORATION is false. If there's a new SurfaceControl, we only need to set the flag if it's true. This avoids applying an unnecesary transaction. It also prevents a boot failure which is independently fixed by Ib11d46439db57b90486bad07dd90f2cf0822182a. Bug: 211797674 Bug: 211835607 Bug: 212402133 Test: boots Change-Id: Iccb662f9a6312b547b3d28fa1f5c1e9ff5dce9eb --- core/java/android/view/ViewRootImpl.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/core/java/android/view/ViewRootImpl.java b/core/java/android/view/ViewRootImpl.java index 0dd90298ac9da..3c3b50e080c63 100644 --- a/core/java/android/view/ViewRootImpl.java +++ b/core/java/android/view/ViewRootImpl.java @@ -2845,7 +2845,10 @@ public final class ViewRootImpl implements ViewParent, if (mSurfaceControl.isValid()) { updateOpacity(mWindowAttributes, dragResizing, surfaceControlChanged /*forceUpdate */); - if (surfaceControlChanged) { + // No need to updateDisplayDecoration if it's a new SurfaceControl and + // mDisplayDecorationCached is false, since that's the default for a new + // SurfaceControl. + if (surfaceControlChanged && mDisplayDecorationCached) { updateDisplayDecoration(); } }