Always return to the browsing state when the media source changes

This prevents the display of an empty playback screen when the
media apps don't recreate a playback state.

Bug: 170801919
Test: manual
Change-Id: Ia37c4909ec9143ba69f2d465f86a7708dc300554
diff --git a/src/com/android/car/media/MediaActivity.java b/src/com/android/car/media/MediaActivity.java
index 0c02e56..a2991fd 100644
--- a/src/com/android/car/media/MediaActivity.java
+++ b/src/com/android/car/media/MediaActivity.java
@@ -50,12 +50,12 @@
 import androidx.lifecycle.MutableLiveData;
 import androidx.lifecycle.ViewModelProviders;
 
-import com.android.car.apps.common.util.VectorMath;
 import com.android.car.apps.common.util.CarPackageManagerUtils;
+import com.android.car.apps.common.util.VectorMath;
 import com.android.car.apps.common.util.ViewUtils;
-import com.android.car.media.common.PlaybackErrorsHelper;
 import com.android.car.media.common.MediaItemMetadata;
 import com.android.car.media.common.MinimizedPlaybackControlBar;
+import com.android.car.media.common.PlaybackErrorsHelper;
 import com.android.car.media.common.playback.PlaybackViewModel;
 import com.android.car.media.common.source.MediaSource;
 import com.android.car.media.common.source.MediaSourceViewModel;
@@ -359,10 +359,11 @@
             if (Log.isLoggable(TAG, Log.INFO)) {
                 Log.i(TAG, "Browsing: " + mediaSource.getDisplayName());
             }
-            Mode mediaSourceMode = getInnerViewModel().getSavedMode();
-            // Changes the mode regardless of its previous value so that the views can be updated.
-            changeModeInternal(mediaSourceMode, false);
-
+            // Change the mode regardless of its previous value so that the views can be updated.
+            // The saved mode is ignored as the media apps don't always recreate a playback state
+            // that can be displayed (and some send a displayable state after sending a non
+            // displayable one...).
+            changeModeInternal(Mode.BROWSING, false);
             // Always go through the trampoline activity to keep all the dispatching logic there.
             startActivity(new Intent(Car.CAR_INTENT_ACTION_MEDIA_TEMPLATE));
         }