summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndroid Build Coastguard Worker <android-build-coastguard-worker@google.com>2022-02-05 22:07:33 +0000
committerAndroid Build Coastguard Worker <android-build-coastguard-worker@google.com>2022-02-05 22:07:33 +0000
commit3bf98c54fa00af3788192a01399009c0b69dc17b (patch)
treee312304a4a955e1835e1faa3a8590a86524178be
parentd6b71b5c36cd024a1ed5e79c37137973c28e0719 (diff)
parent65c41fe0fe369f088ea542f32b556ceea600da77 (diff)
downloadMedia-android12-qpr3-s5-release.tar.gz
Change-Id: If70e446f5e70268250e3e646b43a773a2dcf4d94
-rw-r--r--src/com/android/car/media/MediaActivity.java4
-rw-r--r--src/com/android/car/media/MediaActivityController.java9
2 files changed, 5 insertions, 8 deletions
diff --git a/src/com/android/car/media/MediaActivity.java b/src/com/android/car/media/MediaActivity.java
index b437a1a..591285a 100644
--- a/src/com/android/car/media/MediaActivity.java
+++ b/src/com/android/car/media/MediaActivity.java
@@ -426,10 +426,6 @@ public class MediaActivity extends FragmentActivity implements MediaActivityCont
break;
case BROWSING:
if (oldMode == Mode.PLAYBACK) {
- // When switching from PLAYBACK mode to BROWSING mode, if a CarUiRecyclerView
- // shows up and it's in rotary mode, restore focus in the CarUiRecyclerView.
- mMediaActivityController.restoreFocusInCurrentNode();
-
ViewUtils.hideViewAnimated(mErrorContainer, 0);
ViewUtils.showViewAnimated(mBrowseContainer, 0);
animateOutPlaybackContainer(fadeOutDuration);
diff --git a/src/com/android/car/media/MediaActivityController.java b/src/com/android/car/media/MediaActivityController.java
index a29b40d..9882e70 100644
--- a/src/com/android/car/media/MediaActivityController.java
+++ b/src/com/android/car/media/MediaActivityController.java
@@ -406,6 +406,7 @@ public class MediaActivityController extends ViewControllerBase {
updateAppBar();
}
+ @NonNull
private BrowseViewController getControllerForItem(@NonNull MediaItemMetadata item) {
BrowseViewController controller = mBrowseViewControllersByNode.get(item);
if (controller == null) {
@@ -438,15 +439,15 @@ public class MediaActivityController extends ViewControllerBase {
}
// If the current node has a CarUiRecyclerView and it's in rotary mode, restore focus in it.
- void restoreFocusInCurrentNode() {
+ // Should remain private and definitely NOT be called from MediaActivity#changeModeInternal
+ // as the controller isn't ready to show the browse data of the new media source (it hasn't
+ // connected to it (b/217159531).
+ private void restoreFocusInCurrentNode() {
MediaItemMetadata currentNode = getCurrentMediaItem();
if (currentNode == null) {
return;
}
BrowseViewController controller = getControllerForItem(currentNode);
- if (controller == null) {
- return;
- }
CarUiRecyclerView carUiRecyclerView =
controller.getContent().findViewById(R.id.browse_list);
if (carUiRecyclerView != null && carUiRecyclerView instanceof LazyLayoutView