From 2e7ef7077014c492950e4e96cde34a88e63e8322 Mon Sep 17 00:00:00 2001 From: Alex Chau Date: Thu, 10 Apr 2025 15:48:34 +0100 Subject: [PATCH] Use AplicationContext for getWindowCornerRadius on DEFAULT_DISPLAY - ag/32861507 changed getWindowCornerRadius to use DisplayContext, which does not get updated on configuartion changes, this caused potentially regression of having wrong corner radius after configuration changes - ag/32896744 attempted to fix this with window context, get is rolled back due to perfroamcne regression - This CL is a temp fix to make DEFAULT_DISPLAY continue usign AplicationContext for getWindowCornerRadius, if the AplicationContext is associated to a display, and otherwise fallback to displayContext Bug: 408988616 Test: manual Flag: EXEMPT bug fix Change-Id: I72dbcfb7cd6cdc6783e96768b4f4b51b76d9a245 --- .../src/com/android/quickstep/RotationTouchHelper.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/quickstep/src/com/android/quickstep/RotationTouchHelper.java b/quickstep/src/com/android/quickstep/RotationTouchHelper.java index d882296946..53843bd52b 100644 --- a/quickstep/src/com/android/quickstep/RotationTouchHelper.java +++ b/quickstep/src/com/android/quickstep/RotationTouchHelper.java @@ -149,8 +149,13 @@ public class RotationTouchHelper implements DisplayInfoChangeListener { mSystemUiProxy = systemUiProxy; Resources resources = mApplicationContext.getResources(); + // TODO(b/408988616): Find a better solution for external display to have resources updated + // after configuration changes. + Context displayAssociatedContext = + mApplicationContext.getAssociatedDisplayId() == mDisplayId + ? mApplicationContext : displayContext; mOrientationTouchTransformer = new OrientationTouchTransformer(resources, mMode, - () -> QuickStepContract.getWindowCornerRadius(displayContext)); + () -> QuickStepContract.getWindowCornerRadius(displayAssociatedContext)); // Register for navigation mode and rotation changes mDisplayController.addChangeListenerForDisplay(this, mDisplayId);