Merge "Do not allow focus on invisible buttons" into udc-dev am: 123057466d

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/23215701

Change-Id: Id46dc1dfc254a2049f9c25d9280c139213fbf49c
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
Beth Thibodeau
2023-05-13 00:30:36 +00:00
committed by Automerger Merge Worker
3 changed files with 14 additions and 1 deletions

View File

@@ -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) {

View File

@@ -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;
}

View File

@@ -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)
}