Push a potential fix for hotseat aggregation

This could be caused by landscape layout not receiving inset changes

Adding logs for hotseat layout info as well

Bug: 335141365
Flag: EXEMPT bugfix
Test: N/A
Change-Id: I987f8622907a10fac5375ddddac3db2c5eba41c1
diff --git a/src/com/android/launcher3/ModelCallbacks.kt b/src/com/android/launcher3/ModelCallbacks.kt
index 7d6d154..13062b6 100644
--- a/src/com/android/launcher3/ModelCallbacks.kt
+++ b/src/com/android/launcher3/ModelCallbacks.kt
@@ -3,6 +3,7 @@
 import android.annotation.TargetApi
 import android.os.Build
 import android.os.Trace
+import android.util.Log
 import androidx.annotation.UiThread
 import com.android.launcher3.Flags.enableSmartspaceRemovalToggle
 import com.android.launcher3.LauncherConstants.TraceEvents
@@ -29,6 +30,8 @@
 import com.android.launcher3.widget.model.WidgetsListBaseEntry
 import java.util.function.Predicate
 
+private const val TAG = "ModelCallbacks"
+
 class ModelCallbacks(private var launcher: Launcher) : BgDataModel.Callbacks {
 
     var synchronouslyBoundPages = LIntSet()
@@ -66,6 +69,13 @@
         launcher.workspace.removeAllWorkspaceScreens()
         // Avoid clearing the widget update listeners for staying up-to-date with widget info
         launcher.appWidgetHolder.clearWidgetViews()
+        // TODO(b/335141365): Remove this log after the bug is fixed.
+        Log.d(
+            TAG,
+            "startBinding: " +
+                "hotseat layout was vertical: ${launcher.hotseat?.isHasVerticalHotseat}" +
+                " and is setting to ${launcher.deviceProfile.isVerticalBarLayout}"
+        )
         launcher.hotseat?.resetLayout(launcher.deviceProfile.isVerticalBarLayout)
         TraceHelper.INSTANCE.endSection()
     }
@@ -142,7 +152,10 @@
         launcher.viewCache.setCacheSize(R.layout.folder_page, 2)
         TraceHelper.INSTANCE.endSection()
         launcher.workspace.removeExtraEmptyScreen(/* stripEmptyScreens= */ true)
-        launcher.workspace.pageIndicator.setPauseScroll(/*pause=*/ false, deviceProfile.isTwoPanels)
+        launcher.workspace.pageIndicator.setPauseScroll(
+            /*pause=*/ false,
+            deviceProfile.isTwoPanels
+        )
     }
 
     /**
@@ -290,8 +303,7 @@
         val widgetsListBaseEntry: WidgetsListBaseEntry =
             launcher.popupDataProvider.allWidgets.firstOrNull { item: WidgetsListBaseEntry ->
                 item.mPkgItem.packageName == BuildConfig.APPLICATION_ID
-            }
-                ?: return
+            } ?: return
 
         val info =
             PendingAddWidgetInfo(
@@ -315,16 +327,14 @@
         )
         val firstScreenPosition = 0
         if (
-            (isFirstPagePinnedItemEnabled &&
-                !SHOULD_SHOW_FIRST_PAGE_WIDGET) &&
+            (isFirstPagePinnedItemEnabled && !SHOULD_SHOW_FIRST_PAGE_WIDGET) &&
                 orderedScreenIds.indexOf(FIRST_SCREEN_ID) != firstScreenPosition
         ) {
             orderedScreenIds.removeValue(FIRST_SCREEN_ID)
             orderedScreenIds.add(firstScreenPosition, FIRST_SCREEN_ID)
         } else if (
-            (!isFirstPagePinnedItemEnabled ||
-                    SHOULD_SHOW_FIRST_PAGE_WIDGET)
-            && orderedScreenIds.isEmpty
+            (!isFirstPagePinnedItemEnabled || SHOULD_SHOW_FIRST_PAGE_WIDGET) &&
+                orderedScreenIds.isEmpty
         ) {
             // If there are no screens, we need to have an empty screen
             launcher.workspace.addExtraEmptyScreens()
@@ -380,7 +390,7 @@
         }
         orderedScreenIds
             .filterNot { screenId ->
-                    isFirstPagePinnedItemEnabled &&
+                isFirstPagePinnedItemEnabled &&
                     !SHOULD_SHOW_FIRST_PAGE_WIDGET &&
                     screenId == WorkspaceLayoutManager.FIRST_SCREEN_ID
             }