Merge changes I3f413f7f,Ie5fade7e into main

* changes:
  Fix hover icon when drag resizing a freeform window with a stylus.
  Clean up edge resizing debug logging.
diff --git a/core/java/android/window/flags/lse_desktop_experience.aconfig b/core/java/android/window/flags/lse_desktop_experience.aconfig
index 61fdcdd..f732929 100644
--- a/core/java/android/window/flags/lse_desktop_experience.aconfig
+++ b/core/java/android/window/flags/lse_desktop_experience.aconfig
@@ -40,8 +40,8 @@
 flag {
     name: "enable_windowing_edge_drag_resize"
     namespace: "lse_desktop_experience"
-    description: "Enables edge drag resizing for all input sources"
-    bug: "323383067"
+    description: "Enables edge drag resizing for stylus input (cursor is enabled by default)"
+    bug: "337782092"
 }
 
 flag {
@@ -162,3 +162,10 @@
     description: "Whether to enable multi-instance support in desktop windowing."
     bug: "336289597"
 }
+
+flag {
+    name: "enable_desktop_windowing_back_navigation"
+    namespace: "lse_desktop_experience"
+    description: "Whether to enable back navigation treatment in desktop windowing."
+    bug: "350421096"
+}
\ No newline at end of file
diff --git a/packages/SystemUI/res/layout/keyboard_shortcuts_search_view.xml b/packages/SystemUI/res/layout/keyboard_shortcuts_search_view.xml
index 2cfd644..45a4af9 100644
--- a/packages/SystemUI/res/layout/keyboard_shortcuts_search_view.xml
+++ b/packages/SystemUI/res/layout/keyboard_shortcuts_search_view.xml
@@ -85,7 +85,7 @@
         <LinearLayout
             android:layout_width="wrap_content"
             android:layout_height="wrap_content"
-            android:layout_gravity="center_vertical"
+            android:layout_gravity="center_vertical|start"
             android:orientation="horizontal">
             <Button
                 android:id="@+id/shortcut_system"
diff --git a/packages/SystemUI/res/values/strings.xml b/packages/SystemUI/res/values/strings.xml
index dee5528..c1e99db 100644
--- a/packages/SystemUI/res/values/strings.xml
+++ b/packages/SystemUI/res/values/strings.xml
@@ -2050,6 +2050,8 @@
     <string name="keyboard_key_page_down">Page Down</string>
     <!-- Name used to refer to the "Delete" key on the keyboard. -->
     <string name="keyboard_key_forward_del">Delete</string>
+    <!-- Name used to refer to the "Esc" or "Escape" key on the keyboard. -->
+    <string name="keyboard_key_esc">Esc</string>
     <!-- Name used to refer to the "Home" move key on the keyboard. -->
     <string name="keyboard_key_move_home">Home</string>
     <!-- Name used to refer to the "End" move key on the keyboard. -->
diff --git a/packages/SystemUI/src/com/android/systemui/display/data/repository/DisplayRepository.kt b/packages/SystemUI/src/com/android/systemui/display/data/repository/DisplayRepository.kt
index 0bcfa96..69ddb62 100644
--- a/packages/SystemUI/src/com/android/systemui/display/data/repository/DisplayRepository.kt
+++ b/packages/SystemUI/src/com/android/systemui/display/data/repository/DisplayRepository.kt
@@ -44,6 +44,7 @@
 import kotlinx.coroutines.flow.StateFlow
 import kotlinx.coroutines.flow.combine
 import kotlinx.coroutines.flow.distinctUntilChanged
+import kotlinx.coroutines.flow.filter
 import kotlinx.coroutines.flow.filterIsInstance
 import kotlinx.coroutines.flow.flowOn
 import kotlinx.coroutines.flow.map
@@ -137,6 +138,7 @@
     override val displayAdditionEvent: Flow<Display?> =
         allDisplayEvents.filterIsInstance<DisplayEvent.Added>().map { getDisplay(it.displayId) }
 
+    // TODO: b/345472038 - Delete after the flag is ramped up.
     private val oldEnabledDisplays: Flow<Set<Display>> =
         allDisplayEvents
             .map { getDisplays() }
@@ -167,6 +169,9 @@
             }
             .debugLog("enabledDisplayIds")
 
+    private val defaultDisplay by lazy {
+        getDisplay(Display.DEFAULT_DISPLAY) ?: error("Unable to get default display.")
+    }
     /**
      * Represents displays that went though the [DisplayListener.onDisplayAdded] callback.
      *
@@ -181,11 +186,7 @@
                 .stateIn(
                     bgApplicationScope,
                     started = SharingStarted.WhileSubscribed(),
-                    initialValue =
-                        setOf(
-                            getDisplay(Display.DEFAULT_DISPLAY)
-                                ?: error("Unable to get default display.")
-                        )
+                    initialValue = setOf(defaultDisplay)
                 )
         } else {
             oldEnabledDisplays
@@ -344,9 +345,10 @@
             .debugLog("pendingDisplay")
 
     override val defaultDisplayOff: Flow<Boolean> =
-        displays
-            .map { displays -> displays.firstOrNull { it.displayId == Display.DEFAULT_DISPLAY } }
-            .map { it?.state == Display.STATE_OFF }
+        displayChangeEvent
+            .filter { it == Display.DEFAULT_DISPLAY }
+            .map { defaultDisplay.state == Display.STATE_OFF }
+            .distinctUntilChanged()
 
     private fun <T> Flow<T>.debugLog(flowName: String): Flow<T> {
         return if (DEBUG) {
diff --git a/packages/SystemUI/src/com/android/systemui/keyboard/shortcut/data/repository/ShortcutHelperKeys.kt b/packages/SystemUI/src/com/android/systemui/keyboard/shortcut/data/repository/ShortcutHelperKeys.kt
index 0aced8c..cbe6fc7 100644
--- a/packages/SystemUI/src/com/android/systemui/keyboard/shortcut/data/repository/ShortcutHelperKeys.kt
+++ b/packages/SystemUI/src/com/android/systemui/keyboard/shortcut/data/repository/ShortcutHelperKeys.kt
@@ -222,7 +222,7 @@
                 { context ->
                     context.getString(R.string.keyboard_key_forward_del)
                 },
-            KEYCODE_ESCAPE to { "Esc" },
+            KEYCODE_ESCAPE to { context -> context.getString(R.string.keyboard_key_esc) },
             KEYCODE_SYSRQ to { "SysRq" },
             KEYCODE_BREAK to { "Break" },
             KEYCODE_SCROLL_LOCK to { "Scroll Lock" },
diff --git a/packages/SystemUI/src/com/android/systemui/keyguard/domain/interactor/FromAodTransitionInteractor.kt b/packages/SystemUI/src/com/android/systemui/keyguard/domain/interactor/FromAodTransitionInteractor.kt
index d41c0c5..893835a 100644
--- a/packages/SystemUI/src/com/android/systemui/keyguard/domain/interactor/FromAodTransitionInteractor.kt
+++ b/packages/SystemUI/src/com/android/systemui/keyguard/domain/interactor/FromAodTransitionInteractor.kt
@@ -199,6 +199,7 @@
      * PRIMARY_BOUNCER.
      */
     private fun listenForAodToPrimaryBouncer() {
+        // TODO(b/336576536): Check if adaptation for scene framework is needed
         if (SceneContainerFlag.isEnabled) return
         scope.launch("$TAG#listenForAodToPrimaryBouncer") {
             keyguardInteractor.primaryBouncerShowing
diff --git a/packages/SystemUI/src/com/android/systemui/keyguard/domain/interactor/FromOccludedTransitionInteractor.kt b/packages/SystemUI/src/com/android/systemui/keyguard/domain/interactor/FromOccludedTransitionInteractor.kt
index 84ca667..f3ca9df 100644
--- a/packages/SystemUI/src/com/android/systemui/keyguard/domain/interactor/FromOccludedTransitionInteractor.kt
+++ b/packages/SystemUI/src/com/android/systemui/keyguard/domain/interactor/FromOccludedTransitionInteractor.kt
@@ -71,6 +71,8 @@
     }
 
     private fun listenForOccludedToPrimaryBouncer() {
+        // TODO(b/336576536): Check if adaptation for scene framework is needed
+        if (SceneContainerFlag.isEnabled) return
         scope.launch {
             keyguardInteractor.primaryBouncerShowing
                 .filterRelevantKeyguardStateAnd { isBouncerShowing -> isBouncerShowing }
diff --git a/packages/SystemUI/src/com/android/systemui/keyguard/domain/interactor/KeyguardDismissActionInteractor.kt b/packages/SystemUI/src/com/android/systemui/keyguard/domain/interactor/KeyguardDismissActionInteractor.kt
index 1aac1c5..f4d8265 100644
--- a/packages/SystemUI/src/com/android/systemui/keyguard/domain/interactor/KeyguardDismissActionInteractor.kt
+++ b/packages/SystemUI/src/com/android/systemui/keyguard/domain/interactor/KeyguardDismissActionInteractor.kt
@@ -25,9 +25,8 @@
 import com.android.systemui.keyguard.shared.model.KeyguardState.ALTERNATE_BOUNCER
 import com.android.systemui.keyguard.shared.model.KeyguardState.GONE
 import com.android.systemui.keyguard.shared.model.KeyguardState.PRIMARY_BOUNCER
-import com.android.systemui.scene.domain.interactor.SceneInteractor
-import com.android.systemui.scene.shared.flag.SceneContainerFlag
 import com.android.systemui.scene.shared.model.Scenes
+import com.android.systemui.util.kotlin.Utils.Companion.sampleFilter
 import com.android.systemui.util.kotlin.sample
 import javax.inject.Inject
 import kotlinx.coroutines.CoroutineScope
@@ -35,6 +34,7 @@
 import kotlinx.coroutines.flow.Flow
 import kotlinx.coroutines.flow.SharingStarted
 import kotlinx.coroutines.flow.StateFlow
+import kotlinx.coroutines.flow.combine
 import kotlinx.coroutines.flow.filter
 import kotlinx.coroutines.flow.filterNot
 import kotlinx.coroutines.flow.map
@@ -51,7 +51,6 @@
     transitionInteractor: KeyguardTransitionInteractor,
     val dismissInteractor: KeyguardDismissInteractor,
     @Application private val applicationScope: CoroutineScope,
-    sceneInteractor: SceneInteractor,
 ) {
     val dismissAction: Flow<DismissAction> = repository.dismissAction
 
@@ -76,11 +75,10 @@
             )
 
     private val finishedTransitionToGone: Flow<Unit> =
-        if (SceneContainerFlag.isEnabled) {
-            sceneInteractor.transitionState.filter { it.isIdle(Scenes.Gone) }.map {}
-        } else {
-            transitionInteractor.finishedKeyguardState.filter { it == GONE }.map {}
-        }
+        transitionInteractor
+            .isFinishedIn(scene = Scenes.Gone, stateWithoutSceneContainer = GONE)
+            .filter { it }
+            .map {}
 
     val executeDismissAction: Flow<() -> KeyguardDone> =
         merge(
@@ -90,12 +88,24 @@
             .sample(dismissAction)
             .filterNot { it is DismissAction.None }
             .map { it.onDismissAction }
+
     val resetDismissAction: Flow<Unit> =
-        transitionInteractor.finishedKeyguardTransitionStep
-            .filter { it.to != ALTERNATE_BOUNCER && it.to != PRIMARY_BOUNCER && it.to != GONE }
-            .sample(dismissAction)
-            .filterNot { it is DismissAction.None }
-            .map {} // map to Unit
+        combine(
+                transitionInteractor.isFinishedIn(
+                    scene = Scenes.Gone,
+                    stateWithoutSceneContainer = GONE
+                ),
+                transitionInteractor.isFinishedIn(
+                    scene = Scenes.Bouncer,
+                    stateWithoutSceneContainer = PRIMARY_BOUNCER
+                ),
+                transitionInteractor.isFinishedIn(state = ALTERNATE_BOUNCER)
+            ) { isOnGone, isOnBouncer, isOnAltBouncer ->
+                !isOnGone && !isOnBouncer && !isOnAltBouncer
+            }
+            .filter { it }
+            .sampleFilter(dismissAction) { it !is DismissAction.None }
+            .map {}
 
     fun runDismissAnimationOnKeyguard(): Boolean {
         return willAnimateDismissActionOnLockscreen.value
diff --git a/packages/SystemUI/src/com/android/systemui/keyguard/domain/interactor/WindowManagerLockscreenVisibilityInteractor.kt b/packages/SystemUI/src/com/android/systemui/keyguard/domain/interactor/WindowManagerLockscreenVisibilityInteractor.kt
index 0985e69..e1b333d 100644
--- a/packages/SystemUI/src/com/android/systemui/keyguard/domain/interactor/WindowManagerLockscreenVisibilityInteractor.kt
+++ b/packages/SystemUI/src/com/android/systemui/keyguard/domain/interactor/WindowManagerLockscreenVisibilityInteractor.kt
@@ -82,6 +82,7 @@
     private val transitionSpecificSurfaceBehindVisibility: Flow<Boolean?> =
         transitionInteractor.startedKeyguardTransitionStep
             .flatMapLatest { startedStep ->
+                SceneContainerFlag.assertInLegacyMode()
                 when (startedStep.from) {
                     KeyguardState.LOCKSCREEN -> {
                         fromLockscreenInteractor.surfaceBehindVisibility
diff --git a/packages/SystemUI/src/com/android/systemui/keyguard/shared/model/KeyguardState.kt b/packages/SystemUI/src/com/android/systemui/keyguard/shared/model/KeyguardState.kt
index 9504352..24db3c2 100644
--- a/packages/SystemUI/src/com/android/systemui/keyguard/shared/model/KeyguardState.kt
+++ b/packages/SystemUI/src/com/android/systemui/keyguard/shared/model/KeyguardState.kt
@@ -61,6 +61,11 @@
      * The security screen prompt UI, containing PIN, Password, Pattern for the user to verify their
      * credentials.
      */
+    @Deprecated(
+        "This state won't exist anymore when scene container gets enabled. If you are " +
+            "writing prod code today, make sure to either use flag aware APIs in " +
+            "[KeyguardTransitionInteractor] or flag appropriately with [SceneContainerFlag]."
+    )
     PRIMARY_BOUNCER,
     /**
      * Device is actively displaying keyguard UI and is not in low-power mode. Device may be
@@ -72,12 +77,22 @@
      * hub UI. From this state, the user can swipe from the left edge to go back to the lock screen
      * or dream, as well as swipe down for the notifications and up for the bouncer.
      */
+    @Deprecated(
+        "This state won't exist anymore when scene container gets enabled. If you are " +
+            "writing prod code today, make sure to either use flag aware APIs in " +
+            "[KeyguardTransitionInteractor] or flag appropriately with [SceneContainerFlag]."
+    )
     GLANCEABLE_HUB,
     /**
      * Keyguard is no longer visible. In most cases the user has just authenticated and keyguard is
      * being removed, but there are other cases where the user is swiping away keyguard, such as
      * with SWIPE security method or face unlock without bypass.
      */
+    @Deprecated(
+        "This state won't exist anymore when scene container gets enabled. If you are " +
+            "writing prod code today, make sure to either use flag aware APIs in " +
+            "[KeyguardTransitionInteractor] or flag appropriately with [SceneContainerFlag]."
+    )
     GONE,
     /**
      * Only used in scene framework. This means we are currently on any scene framework scene that
diff --git a/packages/SystemUI/src/com/android/systemui/keyguard/ui/viewmodel/KeyguardRootViewModel.kt b/packages/SystemUI/src/com/android/systemui/keyguard/ui/viewmodel/KeyguardRootViewModel.kt
index 0fb29c2..7c46807 100644
--- a/packages/SystemUI/src/com/android/systemui/keyguard/ui/viewmodel/KeyguardRootViewModel.kt
+++ b/packages/SystemUI/src/com/android/systemui/keyguard/ui/viewmodel/KeyguardRootViewModel.kt
@@ -160,7 +160,7 @@
                     edgeWithoutSceneContainer = Edge.create(from = LOCKSCREEN, to = GONE),
                 ),
                 keyguardTransitionInteractor.isInTransition(
-                    edge = Edge.create(from = PRIMARY_BOUNCER, to = Scenes.Lockscreen),
+                    edge = Edge.create(from = Scenes.Bouncer, to = LOCKSCREEN),
                     edgeWithoutSceneContainer =
                         Edge.create(from = PRIMARY_BOUNCER, to = LOCKSCREEN),
                 ),
diff --git a/packages/SystemUI/src/com/android/systemui/keyguard/ui/viewmodel/PrimaryBouncerToGlanceableHubTransitionViewModel.kt b/packages/SystemUI/src/com/android/systemui/keyguard/ui/viewmodel/PrimaryBouncerToGlanceableHubTransitionViewModel.kt
index 754fb94..9ec15dc 100644
--- a/packages/SystemUI/src/com/android/systemui/keyguard/ui/viewmodel/PrimaryBouncerToGlanceableHubTransitionViewModel.kt
+++ b/packages/SystemUI/src/com/android/systemui/keyguard/ui/viewmodel/PrimaryBouncerToGlanceableHubTransitionViewModel.kt
@@ -23,7 +23,6 @@
 import com.android.systemui.keyguard.shared.model.KeyguardState.PRIMARY_BOUNCER
 import com.android.systemui.keyguard.ui.KeyguardTransitionAnimationFlow
 import com.android.systemui.keyguard.ui.transitions.DeviceEntryIconTransition
-import com.android.systemui.scene.shared.model.Scenes
 import javax.inject.Inject
 import kotlinx.coroutines.flow.Flow
 
@@ -33,10 +32,7 @@
 constructor(animationFlow: KeyguardTransitionAnimationFlow) : DeviceEntryIconTransition {
     private val transitionAnimation =
         animationFlow
-            .setup(
-                duration = TO_GLANCEABLE_HUB_DURATION,
-                edge = Edge.create(PRIMARY_BOUNCER, Scenes.Communal)
-            )
+            .setup(duration = TO_GLANCEABLE_HUB_DURATION, edge = Edge.INVALID)
             .setupWithoutSceneContainer(edge = Edge.create(PRIMARY_BOUNCER, GLANCEABLE_HUB))
 
     override val deviceEntryParentViewAlpha: Flow<Float> =
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/KeyboardShortcutListSearch.java b/packages/SystemUI/src/com/android/systemui/statusbar/KeyboardShortcutListSearch.java
index 342ec0d..5bb2936 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/KeyboardShortcutListSearch.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/KeyboardShortcutListSearch.java
@@ -274,7 +274,8 @@
                 context.getString(R.string.keyboard_key_button_template, "Mode"));
         mSpecialCharacterNames.put(
                 KeyEvent.KEYCODE_FORWARD_DEL, context.getString(R.string.keyboard_key_forward_del));
-        mSpecialCharacterNames.put(KeyEvent.KEYCODE_ESCAPE, "Esc");
+        mSpecialCharacterNames.put(
+                KeyEvent.KEYCODE_ESCAPE, context.getString(R.string.keyboard_key_esc));
         mSpecialCharacterNames.put(KeyEvent.KEYCODE_SYSRQ, "SysRq");
         mSpecialCharacterNames.put(KeyEvent.KEYCODE_BREAK, "Break");
         mSpecialCharacterNames.put(KeyEvent.KEYCODE_SCROLL_LOCK, "Scroll Lock");
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/KeyboardShortcuts.java b/packages/SystemUI/src/com/android/systemui/statusbar/KeyboardShortcuts.java
index 6ee13c3..a49ca38 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/KeyboardShortcuts.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/KeyboardShortcuts.java
@@ -259,7 +259,8 @@
                 context.getString(R.string.keyboard_key_button_template, "Mode"));
         mSpecialCharacterNames.put(
                 KeyEvent.KEYCODE_FORWARD_DEL, context.getString(R.string.keyboard_key_forward_del));
-        mSpecialCharacterNames.put(KeyEvent.KEYCODE_ESCAPE, "Esc");
+        mSpecialCharacterNames.put(
+                KeyEvent.KEYCODE_ESCAPE, context.getString(R.string.keyboard_key_esc));
         mSpecialCharacterNames.put(KeyEvent.KEYCODE_SYSRQ, "SysRq");
         mSpecialCharacterNames.put(KeyEvent.KEYCODE_BREAK, "Break");
         mSpecialCharacterNames.put(KeyEvent.KEYCODE_SCROLL_LOCK, "Scroll Lock");
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/ExpandableNotificationRow.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/ExpandableNotificationRow.java
index 9e943ee..582d847 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/ExpandableNotificationRow.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/ExpandableNotificationRow.java
@@ -371,12 +371,6 @@
                 setUserExpanded(nowExpanded);
             }
 
-            if (ExpandHeadsUpOnInlineReply.isEnabled() && mExpandable) {
-                // it is triggered by the user.
-                // So, mHasUserChangedExpansion should be marked true.
-                mHasUserChangedExpansion = true;
-            }
-
             notifyHeightChanged(/* needsAnimation= */ true);
             mOnExpandClickListener.onExpandClicked(mEntry, v, nowExpanded);
             if (shouldLogExpandClickMetric) {
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/ScrimController.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/ScrimController.java
index e4edfa4..069c624 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/ScrimController.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/ScrimController.java
@@ -474,6 +474,7 @@
 
         // PRIMARY_BOUNCER->GONE
         collectFlow(behindScrim, mKeyguardTransitionInteractor.transition(
+                Edge.Companion.getINVALID(),
                 Edge.Companion.create(PRIMARY_BOUNCER, GONE)),
                 mBouncerToGoneTransition, mMainDispatcher);
         collectFlow(behindScrim, mPrimaryBouncerToGoneTransitionViewModel.getScrimAlpha(),
diff --git a/packages/SystemUI/tests/src/com/android/systemui/display/data/repository/DisplayRepositoryTest.kt b/packages/SystemUI/tests/src/com/android/systemui/display/data/repository/DisplayRepositoryTest.kt
index f34058b..20cb1e1 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/display/data/repository/DisplayRepositoryTest.kt
+++ b/packages/SystemUI/tests/src/com/android/systemui/display/data/repository/DisplayRepositoryTest.kt
@@ -59,12 +59,14 @@
 
     private val testHandler = FakeHandler(Looper.getMainLooper())
     private val testScope = TestScope(UnconfinedTestDispatcher())
+    private val defaultDisplay =
+        display(type = TYPE_INTERNAL, id = DEFAULT_DISPLAY, state = Display.STATE_ON)
 
     private lateinit var displayRepository: DisplayRepositoryImpl
 
     @Before
     fun setup() {
-        setDisplays(DEFAULT_DISPLAY)
+        setDisplays(listOf(defaultDisplay))
         setAllDisplaysIncludingDisabled(DEFAULT_DISPLAY)
         displayRepository =
             DisplayRepositoryImpl(
@@ -434,19 +436,12 @@
     fun defaultDisplayOff_changes() =
         testScope.runTest {
             val defaultDisplayOff by latestDefaultDisplayOffFlowValue()
-            setDisplays(
-                listOf(
-                    display(type = TYPE_INTERNAL, id = DEFAULT_DISPLAY, state = Display.STATE_OFF)
-                )
-            )
+
+            whenever(defaultDisplay.state).thenReturn(Display.STATE_OFF)
             displayListener.value.onDisplayChanged(DEFAULT_DISPLAY)
             assertThat(defaultDisplayOff).isTrue()
 
-            setDisplays(
-                listOf(
-                    display(type = TYPE_INTERNAL, id = DEFAULT_DISPLAY, state = Display.STATE_ON)
-                )
-            )
+            whenever(defaultDisplay.state).thenReturn(Display.STATE_ON)
             displayListener.value.onDisplayChanged(DEFAULT_DISPLAY)
             assertThat(defaultDisplayOff).isFalse()
         }
@@ -545,7 +540,10 @@
     }
 
     private fun setAllDisplaysIncludingDisabled(vararg ids: Int) {
-        val displays = ids.map { display(type = TYPE_EXTERNAL, id = it) }.toTypedArray()
+        val displays =
+            (ids.toSet() - DEFAULT_DISPLAY) // Default display always added.
+                .map { display(type = TYPE_EXTERNAL, id = it) }
+                .toTypedArray() + defaultDisplay
         whenever(
                 displayManager.getDisplays(
                     eq(DisplayManager.DISPLAY_CATEGORY_ALL_INCLUDING_DISABLED)
diff --git a/packages/SystemUI/tests/src/com/android/systemui/keyguard/domain/interactor/KeyguardDismissActionInteractorTest.kt b/packages/SystemUI/tests/src/com/android/systemui/keyguard/domain/interactor/KeyguardDismissActionInteractorTest.kt
index 974e3bb..8bc0a60 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/keyguard/domain/interactor/KeyguardDismissActionInteractorTest.kt
+++ b/packages/SystemUI/tests/src/com/android/systemui/keyguard/domain/interactor/KeyguardDismissActionInteractorTest.kt
@@ -31,7 +31,6 @@
 import com.android.systemui.kosmos.testScope
 import com.android.systemui.scene.data.repository.Idle
 import com.android.systemui.scene.data.repository.setSceneTransition
-import com.android.systemui.scene.domain.interactor.sceneInteractor
 import com.android.systemui.scene.shared.model.Scenes
 import com.android.systemui.testKosmos
 import com.google.common.truth.Truth.assertThat
@@ -75,7 +74,6 @@
                 transitionInteractor = kosmos.keyguardTransitionInteractor,
                 dismissInteractor = dismissInteractorWithDependencies.interactor,
                 applicationScope = testScope.backgroundScope,
-                sceneInteractor = kosmos.sceneInteractor,
             )
     }
 
diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/row/ExpandableNotificationRowTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/row/ExpandableNotificationRowTest.java
index e8349b0..ed7383c 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/row/ExpandableNotificationRowTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/row/ExpandableNotificationRowTest.java
@@ -1003,21 +1003,6 @@
         // THEN
         assertThat(row.isExpanded()).isFalse();
     }
-
-    @Test
-    @EnableFlags(ExpandHeadsUpOnInlineReply.FLAG_NAME)
-    public void hasUserChangedExpansion_expandPinned_returnTrue() throws Exception {
-        // GIVEN
-        final ExpandableNotificationRow row = mNotificationTestHelper.createRow();
-        row.setPinned(true);
-
-        // WHEN
-        row.expandNotification();
-
-        // THEN
-        assertThat(row.hasUserChangedExpansion()).isTrue();
-    }
-
     @Test
     public void onDisappearAnimationFinished_shouldSetFalse_headsUpAnimatingAway()
             throws Exception {
diff --git a/packages/SystemUI/tests/utils/src/com/android/systemui/keyguard/domain/interactor/KeyguardDismissActionInteractorKosmos.kt b/packages/SystemUI/tests/utils/src/com/android/systemui/keyguard/domain/interactor/KeyguardDismissActionInteractorKosmos.kt
index 03e5a90..2c6d44f 100644
--- a/packages/SystemUI/tests/utils/src/com/android/systemui/keyguard/domain/interactor/KeyguardDismissActionInteractorKosmos.kt
+++ b/packages/SystemUI/tests/utils/src/com/android/systemui/keyguard/domain/interactor/KeyguardDismissActionInteractorKosmos.kt
@@ -19,7 +19,6 @@
 import com.android.systemui.keyguard.data.repository.keyguardRepository
 import com.android.systemui.kosmos.Kosmos
 import com.android.systemui.kosmos.testScope
-import com.android.systemui.scene.domain.interactor.sceneInteractor
 import kotlinx.coroutines.ExperimentalCoroutinesApi
 
 @ExperimentalCoroutinesApi
@@ -30,6 +29,5 @@
             transitionInteractor = keyguardTransitionInteractor,
             dismissInteractor = keyguardDismissInteractor,
             applicationScope = testScope.backgroundScope,
-            sceneInteractor = sceneInteractor,
         )
     }
diff --git a/services/core/java/com/android/server/am/ActivityManagerService.java b/services/core/java/com/android/server/am/ActivityManagerService.java
index 614a097..25fb729 100644
--- a/services/core/java/com/android/server/am/ActivityManagerService.java
+++ b/services/core/java/com/android/server/am/ActivityManagerService.java
@@ -18368,55 +18368,43 @@
 
         boolean closeFd = true;
         try {
-            Objects.requireNonNull(fd);
-
-            record ProcessToDump(String processName, IApplicationThread thread) { }
-
-            PrintWriter pw = new FastPrintWriter(new FileOutputStream(fd.getFileDescriptor()));
-            pw.println("Binder transaction traces for all processes.\n");
-            final ArrayList<ProcessToDump> processes = new ArrayList<>();
             synchronized (mProcLock) {
-                // Since dumping binder transactions is a long-running operation, we can't do it
-                // with mProcLock held. Do the initial verification here, and save the processes
-                // to dump later outside the lock.
-                final ArrayList<ProcessRecord> unverifiedProcesses =
-                        new ArrayList<>(mProcessList.getLruProcessesLOSP());
-                for (int i = 0, size = unverifiedProcesses.size(); i < size; i++) {
-                    ProcessRecord process = unverifiedProcesses.get(i);
-                    final IApplicationThread thread = process.getThread();
-                    if (!processSanityChecksLPr(process, thread)) {
-                        continue;
-                    }
-                    processes.add(new ProcessToDump(process.processName, process.getThread()));
+                if (fd == null) {
+                    throw new IllegalArgumentException("null fd");
                 }
                 mBinderTransactionTrackingEnabled = false;
-            }
-            for (int i = 0, size = processes.size(); i < size; i++) {
-                final String processName = processes.get(i).processName();
-                final IApplicationThread thread = processes.get(i).thread();
 
-                pw.println("Traces for process: " + processName);
-                pw.flush();
-                try {
-                    TransferPipe tp = new TransferPipe();
-                    try {
-                        thread.stopBinderTrackingAndDump(tp.getWriteFd());
-                        tp.go(fd.getFileDescriptor());
-                    } finally {
-                        tp.kill();
+                PrintWriter pw = new FastPrintWriter(new FileOutputStream(fd.getFileDescriptor()));
+                pw.println("Binder transaction traces for all processes.\n");
+                mProcessList.forEachLruProcessesLOSP(true, process -> {
+                    final IApplicationThread thread = process.getThread();
+                    if (!processSanityChecksLPr(process, thread)) {
+                        return;
                     }
-                } catch (IOException e) {
-                    pw.println("Failure while dumping IPC traces from " + processName +
-                            ".  Exception: " + e);
+
+                    pw.println("Traces for process: " + process.processName);
                     pw.flush();
-                } catch (RemoteException e) {
-                    pw.println("Got a RemoteException while dumping IPC traces from " +
-                            processName + ".  Exception: " + e);
-                    pw.flush();
-                }
+                    try {
+                        TransferPipe tp = new TransferPipe();
+                        try {
+                            thread.stopBinderTrackingAndDump(tp.getWriteFd());
+                            tp.go(fd.getFileDescriptor());
+                        } finally {
+                            tp.kill();
+                        }
+                    } catch (IOException e) {
+                        pw.println("Failure while dumping IPC traces from " + process +
+                                ".  Exception: " + e);
+                        pw.flush();
+                    } catch (RemoteException e) {
+                        pw.println("Got a RemoteException while dumping IPC traces from " +
+                                process + ".  Exception: " + e);
+                        pw.flush();
+                    }
+                });
+                closeFd = false;
+                return true;
             }
-            closeFd = false;
-            return true;
         } finally {
             if (fd != null && closeFd) {
                 try {
diff --git a/services/core/jni/com_android_server_companion_virtual_InputController.cpp b/services/core/jni/com_android_server_companion_virtual_InputController.cpp
index a32b0f1..9ec5ae5 100644
--- a/services/core/jni/com_android_server_companion_virtual_InputController.cpp
+++ b/services/core/jni/com_android_server_companion_virtual_InputController.cpp
@@ -125,6 +125,9 @@
         case DeviceType::ROTARY_ENCODER:
             ioctl(fd, UI_SET_EVBIT, EV_REL);
             ioctl(fd, UI_SET_RELBIT, REL_WHEEL);
+            if (vd_flags::high_resolution_scroll()) {
+                ioctl(fd, UI_SET_RELBIT, REL_WHEEL_HI_RES);
+            }
             break;
         default:
             ALOGE("Invalid input device type %d", static_cast<int32_t>(deviceType));
diff --git a/services/tests/InputMethodSystemServerTests/src/com/android/inputmethodservice/InputMethodServiceTest.java b/services/tests/InputMethodSystemServerTests/src/com/android/inputmethodservice/InputMethodServiceTest.java
index 2029b71..8f630af 100644
--- a/services/tests/InputMethodSystemServerTests/src/com/android/inputmethodservice/InputMethodServiceTest.java
+++ b/services/tests/InputMethodSystemServerTests/src/com/android/inputmethodservice/InputMethodServiceTest.java
@@ -99,6 +99,12 @@
                     InputMethodServiceWrapper.getInputMethodServiceWrapperForTesting();
             assertThat(mInputMethodService).isNotNull();
 
+            // The activity gets focus.
+            assertThat(mActivity.hasWindowFocus()).isTrue();
+            assertThat(mInputMethodService.getCurrentInputEditorInfo()).isNotNull();
+            assertThat(mInputMethodService.getCurrentInputEditorInfo().packageName)
+                    .isEqualTo(mTargetPackageName);
+
             // The editor won't bring up keyboard by default.
             assertThat(mInputMethodService.getCurrentInputStarted()).isTrue();
             assertThat(mInputMethodService.getCurrentInputViewStarted()).isFalse();
diff --git a/services/tests/InputMethodSystemServerTests/test-apps/SimpleTestIme/src/com/android/apps/inputmethod/simpleime/ims/InputMethodServiceWrapper.java b/services/tests/InputMethodSystemServerTests/test-apps/SimpleTestIme/src/com/android/apps/inputmethod/simpleime/ims/InputMethodServiceWrapper.java
index b706a65..67212b6 100644
--- a/services/tests/InputMethodSystemServerTests/test-apps/SimpleTestIme/src/com/android/apps/inputmethod/simpleime/ims/InputMethodServiceWrapper.java
+++ b/services/tests/InputMethodSystemServerTests/test-apps/SimpleTestIme/src/com/android/apps/inputmethod/simpleime/ims/InputMethodServiceWrapper.java
@@ -53,13 +53,14 @@
 
     @Override
     public void onStartInput(EditorInfo info, boolean restarting) {
-        Log.i(TAG, "onStartInput() editor=" + info + ", restarting=" + restarting);
+        Log.i(TAG, "onStartInput() editor=" + dumpEditorInfo(info) + ", restarting=" + restarting);
         super.onStartInput(info, restarting);
     }
 
     @Override
     public void onStartInputView(EditorInfo info, boolean restarting) {
-        Log.i(TAG, "onStartInputView() editor=" + info + ", restarting=" + restarting);
+        Log.i(TAG, "onStartInputView() editor=" + dumpEditorInfo(info)
+                + ", restarting=" + restarting);
         super.onStartInputView(info, restarting);
         mInputViewStarted = true;
         if (mCountDownLatchForTesting != null) {
@@ -99,4 +100,14 @@
             mCountDownLatchForTesting.countDown();
         }
     }
+
+    private String dumpEditorInfo(EditorInfo info) {
+        var sb = new StringBuilder();
+        sb.append("EditorInfo{packageName=").append(info.packageName);
+        sb.append(" fieldId=").append(info.fieldId);
+        sb.append(" hintText=").append(info.hintText);
+        sb.append(" privateImeOptions=").append(info.privateImeOptions);
+        sb.append("}");
+        return sb.toString();
+    }
 }