diff --git a/libs/WindowManager/Shell/src/com/android/wm/shell/pip/phone/PipController.java b/libs/WindowManager/Shell/src/com/android/wm/shell/pip/phone/PipController.java index f8e1435755830..9e6bd47609005 100644 --- a/libs/WindowManager/Shell/src/com/android/wm/shell/pip/phone/PipController.java +++ b/libs/WindowManager/Shell/src/com/android/wm/shell/pip/phone/PipController.java @@ -946,10 +946,15 @@ public class PipController implements PipTransitionController.PipTransitionCallb mPipBoundsState.getDisplayBounds().right, mPipBoundsState.getDisplayBounds().bottom); mPipBoundsState.addNamedUnrestrictedKeepClearArea(LAUNCHER_KEEP_CLEAR_AREA_TAG, rect); + updatePipPositionForKeepClearAreas(); } else { mPipBoundsState.removeNamedUnrestrictedKeepClearArea(LAUNCHER_KEEP_CLEAR_AREA_TAG); + // postpone moving in response to hide of Launcher in case there's another change + mMainExecutor.removeCallbacks(mMovePipInResponseToKeepClearAreasChangeCallback); + mMainExecutor.executeDelayed( + mMovePipInResponseToKeepClearAreasChangeCallback, + PIP_KEEP_CLEAR_AREAS_DELAY); } - updatePipPositionForKeepClearAreas(); } private void setLauncherAppIconSize(int iconSizePx) { diff --git a/packages/SystemUI/src/com/android/systemui/media/controls/ui/MediaControlPanel.java b/packages/SystemUI/src/com/android/systemui/media/controls/ui/MediaControlPanel.java index 8f0ac28382a48..9eda7ae2586d0 100644 --- a/packages/SystemUI/src/com/android/systemui/media/controls/ui/MediaControlPanel.java +++ b/packages/SystemUI/src/com/android/systemui/media/controls/ui/MediaControlPanel.java @@ -1235,6 +1235,8 @@ public class MediaControlPanel { if ((buttonId == R.id.actionPrev && semanticActions.getReservePrev()) || (buttonId == R.id.actionNext && semanticActions.getReserveNext())) { notVisibleValue = ConstraintSet.INVISIBLE; + mMediaViewHolder.getAction(buttonId).setFocusable(visible); + mMediaViewHolder.getAction(buttonId).setClickable(visible); } else { notVisibleValue = ConstraintSet.GONE; } diff --git a/packages/SystemUI/tests/src/com/android/systemui/media/controls/ui/MediaControlPanelTest.kt b/packages/SystemUI/tests/src/com/android/systemui/media/controls/ui/MediaControlPanelTest.kt index 1e465c7917952..68c33fb93fe6f 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/media/controls/ui/MediaControlPanelTest.kt +++ b/packages/SystemUI/tests/src/com/android/systemui/media/controls/ui/MediaControlPanelTest.kt @@ -530,6 +530,8 @@ public class MediaControlPanelTest : SysuiTestCase() { verify(collapsedSet).setVisibility(R.id.actionPlayPause, ConstraintSet.VISIBLE) assertThat(actionNext.isEnabled()).isTrue() + assertThat(actionNext.isFocusable()).isTrue() + assertThat(actionNext.isClickable()).isTrue() assertThat(actionNext.contentDescription).isEqualTo("next") verify(collapsedSet).setVisibility(R.id.actionNext, ConstraintSet.VISIBLE) @@ -576,6 +578,8 @@ public class MediaControlPanelTest : SysuiTestCase() { assertThat(actionPrev.isEnabled()).isFalse() assertThat(actionPrev.drawable).isNull() + assertThat(actionPrev.isFocusable()).isFalse() + assertThat(actionPrev.isClickable()).isFalse() verify(expandedSet).setVisibility(R.id.actionPrev, ConstraintSet.INVISIBLE) assertThat(actionNext.isEnabled()).isFalse() @@ -610,6 +614,8 @@ public class MediaControlPanelTest : SysuiTestCase() { assertThat(actionNext.isEnabled()).isFalse() assertThat(actionNext.drawable).isNull() + assertThat(actionNext.isFocusable()).isFalse() + assertThat(actionNext.isClickable()).isFalse() verify(expandedSet).setVisibility(R.id.actionNext, ConstraintSet.INVISIBLE) }