From 43c4511b13f174770d8587ebeadd947c57d3175f Mon Sep 17 00:00:00 2001 From: Yunfan Chen Date: Tue, 16 May 2023 06:51:43 +0000 Subject: [PATCH] Migrate the insetsRoundedCornerFrame to InsetsFrameProvider The server side has moved the InsetsRoundedCornerFrame into InsetsFrameProvider as it is actually using a given type of insets frame to calculate the new rounded corner information and moving it into the corresponding provider would make it cleaner. To make sure it can be updated and accessed properly, TaskbarInsetsController is now holding the nav bar insets provider to make the update. It will be used always even if the height has been updated. Other necessary changes are made to reflect the change. Test: DisplayPolicyInsetsTests Test: m Bug: 274724339 Change-Id: Iec6804a01bafbbaed8591694490f29c97ea7e7fc --- .../taskbar/TaskbarInsetsController.kt | 26 ++++++++++++++----- 1 file changed, 19 insertions(+), 7 deletions(-) diff --git a/quickstep/src/com/android/launcher3/taskbar/TaskbarInsetsController.kt b/quickstep/src/com/android/launcher3/taskbar/TaskbarInsetsController.kt index d6e559a9b4..4f9b1e4188 100644 --- a/quickstep/src/com/android/launcher3/taskbar/TaskbarInsetsController.kt +++ b/quickstep/src/com/android/launcher3/taskbar/TaskbarInsetsController.kt @@ -21,6 +21,7 @@ import android.os.Binder import android.os.IBinder import android.view.InsetsFrameProvider import android.view.InsetsFrameProvider.SOURCE_DISPLAY +import android.view.InsetsSource.FLAG_INSETS_ROUNDED_CORNER import android.view.InsetsSource.FLAG_SUPPRESS_SCRIM import android.view.ViewTreeObserver import android.view.ViewTreeObserver.InternalInsetsInfo.TOUCHABLE_INSETS_FRAME @@ -83,11 +84,23 @@ class TaskbarInsetsController(val context: TaskbarActivityContext) : LoggableTas } fun onTaskbarWindowHeightOrInsetsChanged() { + val tappableHeight = controllers.taskbarStashController.tappableHeightToReportToApps + // We only report tappableElement height for unstashed, persistent taskbar, + // which is also when we draw the rounded corners above taskbar. + val insetsRoundedCornerFlag = + if (tappableHeight > 0) { + FLAG_INSETS_ROUNDED_CORNER + } else { + 0 + } if (context.isGestureNav) { windowLayoutParams.providedInsets = arrayOf( InsetsFrameProvider(insetsOwner, 0, navigationBars()) - .setFlags(FLAG_SUPPRESS_SCRIM, FLAG_SUPPRESS_SCRIM), + .setFlags( + FLAG_SUPPRESS_SCRIM or insetsRoundedCornerFlag, + FLAG_SUPPRESS_SCRIM or FLAG_INSETS_ROUNDED_CORNER + ), InsetsFrameProvider(insetsOwner, 0, tappableElement()), InsetsFrameProvider(insetsOwner, 0, mandatorySystemGestures()), InsetsFrameProvider(insetsOwner, INDEX_LEFT, systemGestures()) @@ -98,7 +111,11 @@ class TaskbarInsetsController(val context: TaskbarActivityContext) : LoggableTas } else { windowLayoutParams.providedInsets = arrayOf( - InsetsFrameProvider(insetsOwner, 0, navigationBars()), + InsetsFrameProvider(insetsOwner, 0, navigationBars()) + .setFlags( + insetsRoundedCornerFlag, + (FLAG_SUPPRESS_SCRIM or FLAG_INSETS_ROUNDED_CORNER) + ), InsetsFrameProvider(insetsOwner, 0, tappableElement()), InsetsFrameProvider(insetsOwner, 0, mandatorySystemGestures()) ) @@ -112,7 +129,6 @@ class TaskbarInsetsController(val context: TaskbarActivityContext) : LoggableTas windowLayoutParams.height ) val contentHeight = controllers.taskbarStashController.contentHeightToReportToApps - val tappableHeight = controllers.taskbarStashController.tappableHeightToReportToApps val res = context.resources for (provider in windowLayoutParams.providedInsets) { if (provider.type == navigationBars() || provider.type == mandatorySystemGestures()) { @@ -162,10 +178,6 @@ class TaskbarInsetsController(val context: TaskbarActivityContext) : LoggableTas } } - // We only report tappableElement height for unstashed, persistent taskbar, - // which is also when we draw the rounded corners above taskbar. - windowLayoutParams.insetsRoundedCornerFrame = tappableHeight > 0 - context.notifyUpdateLayoutParams() }