Drag and drop a new widget should place it before CTA tile

The drop target is added to the end before the CTA tile, and
on drop it swaps position with the CTA tile causing a jarring
experience.
Fix is to add the placeholder item just before the CTA tile
at the second to last position in the list.

Bug: b/320525842
Test: drag and drop a new widget to an empty GH and GH
with some widgets, and verify the placeholder item is added
before the CTA tile.
Flag: ACONFIG com.android.systemui.communal_hub STAGING

Change-Id: I68511d1d0d8eae1ae82ea5122625c4437f0c4f8c
diff --git a/packages/SystemUI/compose/features/src/com/android/systemui/communal/ui/compose/DragAndDropTargetState.kt b/packages/SystemUI/compose/features/src/com/android/systemui/communal/ui/compose/DragAndDropTargetState.kt
index 22aa837..881947e 100644
--- a/packages/SystemUI/compose/features/src/com/android/systemui/communal/ui/compose/DragAndDropTargetState.kt
+++ b/packages/SystemUI/compose/features/src/com/android/systemui/communal/ui/compose/DragAndDropTargetState.kt
@@ -161,9 +161,9 @@
     private var isOnRemoveButton = false
 
     fun onStarted() {
-        // assume item will be added to the end.
-        contentListState.list.add(placeHolder)
+        // assume item will be added to the second to last position before CTA tile.
         placeHolderIndex = contentListState.list.size - 1
+        placeHolderIndex?.let { contentListState.list.add(it, placeHolder) }
     }
 
     fun onMoved(event: DragAndDropEvent) {