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
diff --git a/quickstep/src/com/android/launcher3/taskbar/TaskbarInsetsController.kt b/quickstep/src/com/android/launcher3/taskbar/TaskbarInsetsController.kt
index d6e559a..4f9b1e4 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.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 @@
     }
 
     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 @@
         } 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 @@
             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 @@
             }
         }
 
-        // 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()
     }