Rename MediaOutputController

No functional changes. Rename MediaOutputController since it is expanded
to also support audio input routing.

Change-Id: I1351707bab48a0491830bff971b46cd1fd8f5478
Bug: b/355684672, b/357122624
Test: atest AudioSwitchControllerTest, MediaOutputAdapterTest,
MediaOutputBaseDialogTest, MediaOutputBroadcastDIalogTest,
MediaOutputDialogTest
Flag: com.android.media.flags.enable_audio_input_device_routing_and_volume_control
diff --git a/packages/SystemUI/Android.bp b/packages/SystemUI/Android.bp
index be4e9a1..36e3853 100644
--- a/packages/SystemUI/Android.bp
+++ b/packages/SystemUI/Android.bp
@@ -452,7 +452,7 @@
         "tests/src/**/systemui/clipboardoverlay/ClipboardListenerTest.java",
         "tests/src/**/systemui/doze/DozeScreenStateTest.java",
         "tests/src/**/systemui/keyguard/WorkLockActivityControllerTest.java",
-        "tests/src/**/systemui/media/dialog/MediaOutputControllerTest.java",
+        "tests/src/**/systemui/media/dialog/MediaSwitchingControllerTest.java",
         "tests/src/**/systemui/navigationbar/views/NavigationBarTest.java",
         "tests/src/**/systemui/power/PowerNotificationWarningsTest.java",
         "tests/src/**/systemui/power/PowerUITest.java",
diff --git a/packages/SystemUI/src/com/android/systemui/media/dialog/MediaOutputAdapter.java b/packages/SystemUI/src/com/android/systemui/media/dialog/MediaOutputAdapter.java
index ff9495d..2961d05 100644
--- a/packages/SystemUI/src/com/android/systemui/media/dialog/MediaOutputAdapter.java
+++ b/packages/SystemUI/src/com/android/systemui/media/dialog/MediaOutputAdapter.java
@@ -57,7 +57,7 @@
     private static final float DEVICE_CONNECTED_ALPHA = 1f;
     protected List<MediaItem> mMediaItemList = new CopyOnWriteArrayList<>();
 
-    public MediaOutputAdapter(MediaOutputController controller) {
+    public MediaOutputAdapter(MediaSwitchingController controller) {
         super(controller);
         setHasStableIds(true);
     }
@@ -531,8 +531,10 @@
     @RequiresApi(34)
     private static class Api34Impl {
         @DoNotInline
-        static View.OnClickListener getClickListenerBasedOnSelectionBehavior(MediaDevice device,
-                MediaOutputController controller, View.OnClickListener defaultTransferListener) {
+        static View.OnClickListener getClickListenerBasedOnSelectionBehavior(
+                MediaDevice device,
+                MediaSwitchingController controller,
+                View.OnClickListener defaultTransferListener) {
             switch (device.getSelectionBehavior()) {
                 case SELECTION_BEHAVIOR_NONE:
                     return null;
diff --git a/packages/SystemUI/src/com/android/systemui/media/dialog/MediaOutputBaseAdapter.java b/packages/SystemUI/src/com/android/systemui/media/dialog/MediaOutputBaseAdapter.java
index 5958b0a..63a7e01 100644
--- a/packages/SystemUI/src/com/android/systemui/media/dialog/MediaOutputBaseAdapter.java
+++ b/packages/SystemUI/src/com/android/systemui/media/dialog/MediaOutputBaseAdapter.java
@@ -63,7 +63,7 @@
     static final int CUSTOMIZED_ITEM_GROUP = 2;
     static final int CUSTOMIZED_ITEM_DYNAMIC_GROUP = 3;
 
-    protected final MediaOutputController mController;
+    protected final MediaSwitchingController mController;
 
     private static final int UNMUTE_DEFAULT_VOLUME = 2;
 
@@ -73,7 +73,7 @@
     int mCurrentActivePosition;
     private boolean mIsInitVolumeFirstTime;
 
-    public MediaOutputBaseAdapter(MediaOutputController controller) {
+    public MediaOutputBaseAdapter(MediaSwitchingController controller) {
         mController = controller;
         mIsDragging = false;
         mCurrentActivePosition = -1;
@@ -127,7 +127,7 @@
         return mCurrentActivePosition;
     }
 
-    public MediaOutputController getController() {
+    public MediaSwitchingController getController() {
         return mController;
     }
 
diff --git a/packages/SystemUI/src/com/android/systemui/media/dialog/MediaOutputBaseDialog.java b/packages/SystemUI/src/com/android/systemui/media/dialog/MediaOutputBaseDialog.java
index 6cc4dcb..6bc995f3 100644
--- a/packages/SystemUI/src/com/android/systemui/media/dialog/MediaOutputBaseDialog.java
+++ b/packages/SystemUI/src/com/android/systemui/media/dialog/MediaOutputBaseDialog.java
@@ -65,11 +65,9 @@
 import java.util.concurrent.Executor;
 import java.util.concurrent.Executors;
 
-/**
- * Base dialog for media output UI
- */
-public abstract class MediaOutputBaseDialog extends SystemUIDialog implements
-        MediaOutputController.Callback, Window.Callback {
+/** Base dialog for media output UI */
+public abstract class MediaOutputBaseDialog extends SystemUIDialog
+        implements MediaSwitchingController.Callback, Window.Callback {
 
     private static final String TAG = "MediaOutputDialog";
     private static final String EMPTY_TITLE = " ";
@@ -82,7 +80,7 @@
     private final RecyclerView.LayoutManager mLayoutManager;
 
     final Context mContext;
-    final MediaOutputController mMediaOutputController;
+    final MediaSwitchingController mMediaSwitchingController;
     final BroadcastSender mBroadcastSender;
 
     /**
@@ -212,22 +210,22 @@
         @Override
         public void onLayoutCompleted(RecyclerView.State state) {
             super.onLayoutCompleted(state);
-            mMediaOutputController.setRefreshing(false);
-            mMediaOutputController.refreshDataSetIfNeeded();
+            mMediaSwitchingController.setRefreshing(false);
+            mMediaSwitchingController.refreshDataSetIfNeeded();
         }
     }
 
     public MediaOutputBaseDialog(
             Context context,
             BroadcastSender broadcastSender,
-            MediaOutputController mediaOutputController,
+            MediaSwitchingController mediaSwitchingController,
             boolean includePlaybackAndAppMetadata) {
         super(context, R.style.Theme_SystemUI_Dialog_Media);
 
         // Save the context that is wrapped with our theme.
         mContext = getContext();
         mBroadcastSender = broadcastSender;
-        mMediaOutputController = mediaOutputController;
+        mMediaSwitchingController = mediaSwitchingController;
         mLayoutManager = new LayoutManagerWrapper(mContext);
         mListMaxHeight = context.getResources().getDimensionPixelSize(
                 R.dimen.media_output_dialog_list_max_height);
@@ -279,9 +277,9 @@
         // Init bottom buttons
         mDoneButton.setOnClickListener(v -> dismiss());
         mStopButton.setOnClickListener(v -> onStopButtonClick());
-        mAppButton.setOnClickListener(mMediaOutputController::tryToLaunchMediaApplication);
+        mAppButton.setOnClickListener(mMediaSwitchingController::tryToLaunchMediaApplication);
         mMediaMetadataSectionLayout.setOnClickListener(
-                mMediaOutputController::tryToLaunchMediaApplication);
+                mMediaSwitchingController::tryToLaunchMediaApplication);
 
         mDismissing = false;
     }
@@ -298,10 +296,10 @@
 
     @Override
     public void start() {
-        mMediaOutputController.start(this);
+        mMediaSwitchingController.start(this);
         if (isBroadcastSupported() && !mIsLeBroadcastCallbackRegistered) {
-            mMediaOutputController.registerLeBroadcastServiceCallback(mExecutor,
-                    mBroadcastCallback);
+            mMediaSwitchingController.registerLeBroadcastServiceCallback(
+                    mExecutor, mBroadcastCallback);
             mIsLeBroadcastCallbackRegistered = true;
         }
     }
@@ -311,11 +309,11 @@
         // unregister broadcast callback should only depend on profile and registered flag
         // rather than remote device or broadcast state
         // otherwise it might have risks of leaking registered callback handle
-        if (mMediaOutputController.isBroadcastSupported() && mIsLeBroadcastCallbackRegistered) {
-            mMediaOutputController.unregisterLeBroadcastServiceCallback(mBroadcastCallback);
+        if (mMediaSwitchingController.isBroadcastSupported() && mIsLeBroadcastCallbackRegistered) {
+            mMediaSwitchingController.unregisterLeBroadcastServiceCallback(mBroadcastCallback);
             mIsLeBroadcastCallbackRegistered = false;
         }
-        mMediaOutputController.stop();
+        mMediaSwitchingController.stop();
     }
 
     @VisibleForTesting
@@ -326,18 +324,17 @@
     void refresh(boolean deviceSetChanged) {
         // TODO(287191450): remove binder calls in this method from the UI thread.
         // If the dialog is going away or is already refreshing, do nothing.
-        if (mDismissing || mMediaOutputController.isRefreshing()) {
+        if (mDismissing || mMediaSwitchingController.isRefreshing()) {
             return;
         }
-        mMediaOutputController.setRefreshing(true);
+        mMediaSwitchingController.setRefreshing(true);
         // Update header icon
         final int iconRes = getHeaderIconRes();
         final IconCompat headerIcon = getHeaderIcon();
         final IconCompat appSourceIcon = getAppSourceIcon();
         boolean colorSetUpdated = false;
         mCastAppLayout.setVisibility(
-                mMediaOutputController.shouldShowLaunchSection()
-                        ? View.VISIBLE : View.GONE);
+                mMediaSwitchingController.shouldShowLaunchSection() ? View.VISIBLE : View.GONE);
         if (iconRes != 0) {
             mHeaderIcon.setVisibility(View.VISIBLE);
             mHeaderIcon.setImageResource(iconRes);
@@ -371,10 +368,10 @@
             mAppResourceIcon.setVisibility(View.GONE);
         } else if (appSourceIcon != null) {
             Icon appIcon = appSourceIcon.toIcon(mContext);
-            mAppResourceIcon.setColorFilter(mMediaOutputController.getColorItemContent());
+            mAppResourceIcon.setColorFilter(mMediaSwitchingController.getColorItemContent());
             mAppResourceIcon.setImageIcon(appIcon);
         } else {
-            Drawable appIconDrawable = mMediaOutputController.getAppSourceIconFromPackage();
+            Drawable appIconDrawable = mMediaSwitchingController.getAppSourceIconFromPackage();
             if (appIconDrawable != null) {
                 mAppResourceIcon.setImageDrawable(appIconDrawable);
             } else {
@@ -387,7 +384,7 @@
                     R.dimen.media_output_dialog_header_icon_padding);
             mHeaderIcon.setLayoutParams(new LinearLayout.LayoutParams(size + padding, size));
         }
-        mAppButton.setText(mMediaOutputController.getAppSourceName());
+        mAppButton.setText(mMediaSwitchingController.getAppSourceName());
 
         if (!mIncludePlaybackAndAppMetadata) {
             mHeaderTitle.setVisibility(View.GONE);
@@ -424,23 +421,26 @@
                 mAdapter.updateItems();
             }
         } else {
-            mMediaOutputController.setRefreshing(false);
-            mMediaOutputController.refreshDataSetIfNeeded();
+            mMediaSwitchingController.setRefreshing(false);
+            mMediaSwitchingController.refreshDataSetIfNeeded();
         }
     }
 
     private void updateButtonBackgroundColorFilter() {
-        ColorFilter buttonColorFilter = new PorterDuffColorFilter(
-                mMediaOutputController.getColorButtonBackground(),
-                PorterDuff.Mode.SRC_IN);
+        ColorFilter buttonColorFilter =
+                new PorterDuffColorFilter(
+                        mMediaSwitchingController.getColorButtonBackground(),
+                        PorterDuff.Mode.SRC_IN);
         mDoneButton.getBackground().setColorFilter(buttonColorFilter);
         mStopButton.getBackground().setColorFilter(buttonColorFilter);
-        mDoneButton.setTextColor(mMediaOutputController.getColorPositiveButtonText());
+        mDoneButton.setTextColor(mMediaSwitchingController.getColorPositiveButtonText());
     }
 
     private void updateDialogBackgroundColor() {
-        getDialogView().getBackground().setTint(mMediaOutputController.getColorDialogBackground());
-        mDeviceListLayout.setBackgroundColor(mMediaOutputController.getColorDialogBackground());
+        getDialogView()
+                .getBackground()
+                .setTint(mMediaSwitchingController.getColorDialogBackground());
+        mDeviceListLayout.setBackgroundColor(mMediaSwitchingController.getColorDialogBackground());
     }
 
     private Drawable resizeDrawable(Drawable drawable, int size) {
@@ -499,7 +499,7 @@
     protected void startLeBroadcast() {
         mStopButton.setText(R.string.media_output_broadcast_starting);
         mStopButton.setEnabled(false);
-        if (!mMediaOutputController.startBluetoothLeBroadcast()) {
+        if (!mMediaSwitchingController.startBluetoothLeBroadcast()) {
             // If the system can't execute "broadcast start", then UI shows the error.
             handleLeBroadcastStartFailed();
         }
@@ -512,9 +512,10 @@
                 && sharedPref.getBoolean(PREF_IS_LE_BROADCAST_FIRST_LAUNCH, true)) {
             Log.d(TAG, "PREF_IS_LE_BROADCAST_FIRST_LAUNCH: true");
 
-            mMediaOutputController.launchLeBroadcastNotifyDialog(mDialogView,
+            mMediaSwitchingController.launchLeBroadcastNotifyDialog(
+                    mDialogView,
                     mBroadcastSender,
-                    MediaOutputController.BroadcastNotifyDialog.ACTION_FIRST_LAUNCH,
+                    MediaSwitchingController.BroadcastNotifyDialog.ACTION_FIRST_LAUNCH,
                     (d, w) -> {
                         startLeBroadcast();
                     });
@@ -527,14 +528,13 @@
     }
 
     protected void startLeBroadcastDialog() {
-        mMediaOutputController.launchMediaOutputBroadcastDialog(mDialogView,
-                mBroadcastSender);
+        mMediaSwitchingController.launchMediaOutputBroadcastDialog(mDialogView, mBroadcastSender);
         refresh();
     }
 
     protected void stopLeBroadcast() {
         mStopButton.setEnabled(false);
-        if (!mMediaOutputController.stopBluetoothLeBroadcast()) {
+        if (!mMediaSwitchingController.stopBluetoothLeBroadcast()) {
             // If the system can't execute "broadcast stop", then UI does refresh.
             mMainThreadHandler.post(() -> refresh());
         }
@@ -559,7 +559,7 @@
     }
 
     public void onStopButtonClick() {
-        mMediaOutputController.releaseSession();
+        mMediaSwitchingController.releaseSession();
         dismiss();
     }
 
diff --git a/packages/SystemUI/src/com/android/systemui/media/dialog/MediaOutputBroadcastDialog.java b/packages/SystemUI/src/com/android/systemui/media/dialog/MediaOutputBroadcastDialog.java
index 1e31755..9b5b872a 100644
--- a/packages/SystemUI/src/com/android/systemui/media/dialog/MediaOutputBroadcastDialog.java
+++ b/packages/SystemUI/src/com/android/systemui/media/dialog/MediaOutputBroadcastDialog.java
@@ -235,14 +235,17 @@
                 }
             };
 
-    MediaOutputBroadcastDialog(Context context, boolean aboveStatusbar,
-            BroadcastSender broadcastSender, MediaOutputController mediaOutputController) {
+    MediaOutputBroadcastDialog(
+            Context context,
+            boolean aboveStatusbar,
+            BroadcastSender broadcastSender,
+            MediaSwitchingController mediaSwitchingController) {
         super(
                 context,
                 broadcastSender,
-                mediaOutputController, /* includePlaybackAndAppMetadata */
+                mediaSwitchingController, /* includePlaybackAndAppMetadata */
                 true);
-        mAdapter = new MediaOutputAdapter(mMediaOutputController);
+        mAdapter = new MediaOutputAdapter(mMediaSwitchingController);
         // TODO(b/226710953): Move the part to MediaOutputBaseDialog for every class
         //  that extends MediaOutputBaseDialog
         if (!aboveStatusbar) {
@@ -262,8 +265,8 @@
         super.start();
         if (!mIsLeBroadcastAssistantCallbackRegistered) {
             mIsLeBroadcastAssistantCallbackRegistered = true;
-            mMediaOutputController.registerLeBroadcastAssistantServiceCallback(mExecutor,
-                    mBroadcastAssistantCallback);
+            mMediaSwitchingController.registerLeBroadcastAssistantServiceCallback(
+                    mExecutor, mBroadcastAssistantCallback);
         }
         /* Add local source broadcast to connected capable devices that may be possible receivers
          * of stream.
@@ -276,7 +279,7 @@
         super.stop();
         if (mIsLeBroadcastAssistantCallbackRegistered) {
             mIsLeBroadcastAssistantCallbackRegistered = false;
-            mMediaOutputController.unregisterLeBroadcastAssistantServiceCallback(
+            mMediaSwitchingController.unregisterLeBroadcastAssistantServiceCallback(
                     mBroadcastAssistantCallback);
         }
     }
@@ -288,7 +291,7 @@
 
     @Override
     IconCompat getHeaderIcon() {
-        return mMediaOutputController.getHeaderIcon();
+        return mMediaSwitchingController.getHeaderIcon();
     }
 
     @Override
@@ -299,17 +302,17 @@
 
     @Override
     CharSequence getHeaderText() {
-        return mMediaOutputController.getHeaderTitle();
+        return mMediaSwitchingController.getHeaderTitle();
     }
 
     @Override
     CharSequence getHeaderSubtitle() {
-        return mMediaOutputController.getHeaderSubTitle();
+        return mMediaSwitchingController.getHeaderSubTitle();
     }
 
     @Override
     IconCompat getAppSourceIcon() {
-        return mMediaOutputController.getNotificationSmallIcon();
+        return mMediaSwitchingController.getNotificationSmallIcon();
     }
 
     @Override
@@ -319,16 +322,16 @@
 
     @Override
     public void onStopButtonClick() {
-        mMediaOutputController.stopBluetoothLeBroadcast();
+        mMediaSwitchingController.stopBluetoothLeBroadcast();
         dismiss();
     }
 
     private String getBroadcastMetadataInfo(int metadata) {
         switch (metadata) {
             case METADATA_BROADCAST_NAME:
-                return mMediaOutputController.getBroadcastName();
+                return mMediaSwitchingController.getBroadcastName();
             case METADATA_BROADCAST_CODE:
-                return mMediaOutputController.getBroadcastCode();
+                return mMediaSwitchingController.getBroadcastCode();
             default:
                 return "";
         }
@@ -342,13 +345,15 @@
         mBroadcastQrCodeView = getDialogView().requireViewById(R.id.qrcode_view);
 
         mBroadcastNotify = getDialogView().requireViewById(R.id.broadcast_info);
-        mBroadcastNotify.setOnClickListener(v -> {
-            mMediaOutputController.launchLeBroadcastNotifyDialog(
-                    /* view= */ null,
-                    /* broadcastSender= */ null,
-                    MediaOutputController.BroadcastNotifyDialog.ACTION_BROADCAST_INFO_ICON,
-                    /* onClickListener= */ null);
-        });
+        mBroadcastNotify.setOnClickListener(
+                v -> {
+                    mMediaSwitchingController.launchLeBroadcastNotifyDialog(
+                            /* mediaOutputDialog= */ null,
+                            /* broadcastSender= */ null,
+                            MediaSwitchingController.BroadcastNotifyDialog
+                                    .ACTION_BROADCAST_INFO_ICON,
+                            /* listener= */ null);
+                });
         mBroadcastName = getDialogView().requireViewById(R.id.broadcast_name_summary);
         mBroadcastNameEdit = getDialogView().requireViewById(R.id.broadcast_name_edit);
         mBroadcastNameEdit.setOnClickListener(v -> {
@@ -409,16 +414,16 @@
             return;
         }
 
-        for (BluetoothDevice sink : mMediaOutputController.getConnectedBroadcastSinkDevices()) {
+        for (BluetoothDevice sink : mMediaSwitchingController.getConnectedBroadcastSinkDevices()) {
             Log.d(TAG, "The broadcastMetadata broadcastId: " + broadcastMetadata.getBroadcastId()
                     + ", the device: " + sink.getAnonymizedAddress());
 
-            if (mMediaOutputController.isThereAnyBroadcastSourceIntoSinkDevice(sink)) {
+            if (mMediaSwitchingController.isThereAnyBroadcastSourceIntoSinkDevice(sink)) {
                 Log.d(TAG, "The sink device has the broadcast source now.");
                 return;
             }
-            if (!mMediaOutputController.addSourceIntoSinkDeviceWithBluetoothLeAssistant(sink,
-                    broadcastMetadata, /*isGroupOp=*/ false)) {
+            if (!mMediaSwitchingController.addSourceIntoSinkDeviceWithBluetoothLeAssistant(
+                    sink, broadcastMetadata, /* isGroupOp= */ false)) {
                 Log.e(TAG, "Error: Source add failed");
             }
         }
@@ -457,11 +462,11 @@
     }
 
     private String getLocalBroadcastMetadataQrCodeString() {
-        return mMediaOutputController.getLocalBroadcastMetadataQrCodeString();
+        return mMediaSwitchingController.getLocalBroadcastMetadataQrCodeString();
     }
 
     private BluetoothLeBroadcastMetadata getBroadcastMetadata() {
-        return mMediaOutputController.getBroadcastMetadata();
+        return mMediaSwitchingController.getBroadcastMetadata();
     }
 
     @VisibleForTesting
@@ -476,8 +481,8 @@
              * stopped then used the new Broadcast code to start the Broadcast.
              */
             mIsStopbyUpdateBroadcastCode = true;
-            mMediaOutputController.setBroadcastCode(updatedString);
-            if (!mMediaOutputController.stopBluetoothLeBroadcast()) {
+            mMediaSwitchingController.setBroadcastCode(updatedString);
+            if (!mMediaSwitchingController.stopBluetoothLeBroadcast()) {
                 handleLeBroadcastStopFailed();
                 return;
             }
@@ -485,8 +490,8 @@
             /* If the user wants to update the Broadcast Name, we don't need to stop the Broadcast
              * session. Only use the new Broadcast name to update the broadcast session.
              */
-            mMediaOutputController.setBroadcastName(updatedString);
-            if (!mMediaOutputController.updateBluetoothLeBroadcast()) {
+            mMediaSwitchingController.setBroadcastName(updatedString);
+            if (!mMediaSwitchingController.updateBluetoothLeBroadcast()) {
                 handleLeBroadcastUpdateFailed();
             }
         }
@@ -496,12 +501,13 @@
     public boolean isBroadcastSupported() {
         if (!legacyLeAudioSharing()) return false;
         boolean isBluetoothLeDevice = false;
-        if (mMediaOutputController.getCurrentConnectedMediaDevice() != null) {
-            isBluetoothLeDevice = mMediaOutputController.isBluetoothLeDevice(
-                    mMediaOutputController.getCurrentConnectedMediaDevice());
+        if (mMediaSwitchingController.getCurrentConnectedMediaDevice() != null) {
+            isBluetoothLeDevice =
+                    mMediaSwitchingController.isBluetoothLeDevice(
+                            mMediaSwitchingController.getCurrentConnectedMediaDevice());
         }
 
-        return mMediaOutputController.isBroadcastSupported() && isBluetoothLeDevice;
+        return mMediaSwitchingController.isBroadcastSupported() && isBluetoothLeDevice;
     }
 
     @Override
@@ -515,7 +521,7 @@
 
     @Override
     public void handleLeBroadcastStartFailed() {
-        mMediaOutputController.setBroadcastCode(mCurrentBroadcastCode);
+        mMediaSwitchingController.setBroadcastCode(mCurrentBroadcastCode);
         mRetryCount++;
 
         handleUpdateFailedUi();
@@ -538,8 +544,8 @@
 
     @Override
     public void handleLeBroadcastUpdateFailed() {
-        //Change the value in shared preferences back to it original value
-        mMediaOutputController.setBroadcastName(mCurrentBroadcastName);
+        // Change the value in shared preferences back to it original value
+        mMediaSwitchingController.setBroadcastName(mCurrentBroadcastName);
         mRetryCount++;
 
         handleUpdateFailedUi();
@@ -550,7 +556,7 @@
         if (mIsStopbyUpdateBroadcastCode) {
             mIsStopbyUpdateBroadcastCode = false;
             mRetryCount = 0;
-            if (!mMediaOutputController.startBluetoothLeBroadcast()) {
+            if (!mMediaSwitchingController.startBluetoothLeBroadcast()) {
                 handleLeBroadcastStartFailed();
                 return;
             }
@@ -561,8 +567,8 @@
 
     @Override
     public void handleLeBroadcastStopFailed() {
-        //Change the value in shared preferences back to it original value
-        mMediaOutputController.setBroadcastCode(mCurrentBroadcastCode);
+        // Change the value in shared preferences back to it original value
+        mMediaSwitchingController.setBroadcastCode(mCurrentBroadcastCode);
         mRetryCount++;
 
         handleUpdateFailedUi();
diff --git a/packages/SystemUI/src/com/android/systemui/media/dialog/MediaOutputBroadcastDialogManager.kt b/packages/SystemUI/src/com/android/systemui/media/dialog/MediaOutputBroadcastDialogManager.kt
index 6ef9ea3..2e7e66f 100644
--- a/packages/SystemUI/src/com/android/systemui/media/dialog/MediaOutputBroadcastDialogManager.kt
+++ b/packages/SystemUI/src/com/android/systemui/media/dialog/MediaOutputBroadcastDialogManager.kt
@@ -29,7 +29,7 @@
     private val context: Context,
     private val broadcastSender: BroadcastSender,
     private val dialogTransitionAnimator: DialogTransitionAnimator,
-    private val mediaOutputControllerFactory: MediaOutputController.Factory
+    private val mediaSwitchingControllerFactory: MediaSwitchingController.Factory
 ) {
     var mediaOutputBroadcastDialog: MediaOutputBroadcastDialog? = null
 
@@ -41,7 +41,7 @@
         // TODO: b/321969740 - Populate the userHandle parameter. The user handle is necessary to
         //  disambiguate the same package running on different users.
         val controller =
-            mediaOutputControllerFactory.create(
+            mediaSwitchingControllerFactory.create(
                 packageName,
                 /* userHandle= */ null,
                 /* token */ null,
diff --git a/packages/SystemUI/src/com/android/systemui/media/dialog/MediaOutputDialog.java b/packages/SystemUI/src/com/android/systemui/media/dialog/MediaOutputDialog.java
index eb6a320..c9af7b3 100644
--- a/packages/SystemUI/src/com/android/systemui/media/dialog/MediaOutputDialog.java
+++ b/packages/SystemUI/src/com/android/systemui/media/dialog/MediaOutputDialog.java
@@ -46,14 +46,14 @@
             Context context,
             boolean aboveStatusbar,
             BroadcastSender broadcastSender,
-            MediaOutputController mediaOutputController,
+            MediaSwitchingController mediaSwitchingController,
             DialogTransitionAnimator dialogTransitionAnimator,
             UiEventLogger uiEventLogger,
             boolean includePlaybackAndAppMetadata) {
-        super(context, broadcastSender, mediaOutputController, includePlaybackAndAppMetadata);
+        super(context, broadcastSender, mediaSwitchingController, includePlaybackAndAppMetadata);
         mDialogTransitionAnimator = dialogTransitionAnimator;
         mUiEventLogger = uiEventLogger;
-        mAdapter = new MediaOutputAdapter(mMediaOutputController);
+        mAdapter = new MediaOutputAdapter(mMediaSwitchingController);
         if (!aboveStatusbar) {
             getWindow().setType(WindowManager.LayoutParams.TYPE_APPLICATION_OVERLAY);
         }
@@ -72,7 +72,7 @@
 
     @Override
     IconCompat getHeaderIcon() {
-        return mMediaOutputController.getHeaderIcon();
+        return mMediaSwitchingController.getHeaderIcon();
     }
 
     @Override
@@ -83,27 +83,29 @@
 
     @Override
     CharSequence getHeaderText() {
-        return mMediaOutputController.getHeaderTitle();
+        return mMediaSwitchingController.getHeaderTitle();
     }
 
     @Override
     CharSequence getHeaderSubtitle() {
-        return mMediaOutputController.getHeaderSubTitle();
+        return mMediaSwitchingController.getHeaderSubTitle();
     }
 
     @Override
     IconCompat getAppSourceIcon() {
-        return mMediaOutputController.getNotificationSmallIcon();
+        return mMediaSwitchingController.getNotificationSmallIcon();
     }
 
     @Override
     int getStopButtonVisibility() {
         boolean isActiveRemoteDevice = false;
-        if (mMediaOutputController.getCurrentConnectedMediaDevice() != null) {
-            isActiveRemoteDevice = mMediaOutputController.isActiveRemoteDevice(
-                    mMediaOutputController.getCurrentConnectedMediaDevice());
+        if (mMediaSwitchingController.getCurrentConnectedMediaDevice() != null) {
+            isActiveRemoteDevice =
+                    mMediaSwitchingController.isActiveRemoteDevice(
+                            mMediaSwitchingController.getCurrentConnectedMediaDevice());
         }
-        boolean showBroadcastButton = isBroadcastSupported() && mMediaOutputController.isPlaying();
+        boolean showBroadcastButton =
+                isBroadcastSupported() && mMediaSwitchingController.isPlaying();
 
         return (isActiveRemoteDevice || showBroadcastButton) ? View.VISIBLE : View.GONE;
     }
@@ -115,13 +117,14 @@
         boolean isBroadcastEnabled = false;
         if (FeatureFlagUtils.isEnabled(mContext,
                 FeatureFlagUtils.SETTINGS_NEED_CONNECTED_BLE_DEVICE_FOR_BROADCAST)) {
-            if (mMediaOutputController.getCurrentConnectedMediaDevice() != null) {
-                isBluetoothLeDevice = mMediaOutputController.isBluetoothLeDevice(
-                    mMediaOutputController.getCurrentConnectedMediaDevice());
+            if (mMediaSwitchingController.getCurrentConnectedMediaDevice() != null) {
+                isBluetoothLeDevice =
+                        mMediaSwitchingController.isBluetoothLeDevice(
+                                mMediaSwitchingController.getCurrentConnectedMediaDevice());
                 // if broadcast is active, broadcast should be considered as supported
                 // there could be a valid case that broadcast is ongoing
                 // without active LEA device connected
-                isBroadcastEnabled = mMediaOutputController.isBluetoothLeBroadcastEnabled();
+                isBroadcastEnabled = mMediaSwitchingController.isBluetoothLeBroadcastEnabled();
             }
         } else {
             // To decouple LE Audio Broadcast and Unicast, it always displays the button when there
@@ -129,15 +132,16 @@
             isBluetoothLeDevice = true;
         }
 
-        return mMediaOutputController.isBroadcastSupported()
+        return mMediaSwitchingController.isBroadcastSupported()
                 && (isBluetoothLeDevice || isBroadcastEnabled);
     }
 
     @Override
     public CharSequence getStopButtonText() {
         int resId = R.string.media_output_dialog_button_stop_casting;
-        if (isBroadcastSupported() && mMediaOutputController.isPlaying()
-                && !mMediaOutputController.isBluetoothLeBroadcastEnabled()) {
+        if (isBroadcastSupported()
+                && mMediaSwitchingController.isPlaying()
+                && !mMediaSwitchingController.isBluetoothLeBroadcastEnabled()) {
             resId = R.string.media_output_broadcast;
         }
         return mContext.getText(resId);
@@ -145,8 +149,8 @@
 
     @Override
     public void onStopButtonClick() {
-        if (isBroadcastSupported() && mMediaOutputController.isPlaying()) {
-            if (!mMediaOutputController.isBluetoothLeBroadcastEnabled()) {
+        if (isBroadcastSupported() && mMediaSwitchingController.isPlaying()) {
+            if (!mMediaSwitchingController.isBluetoothLeBroadcastEnabled()) {
                 if (startLeBroadcastDialogForFirstTime()) {
                     return;
                 }
@@ -155,7 +159,7 @@
                 stopLeBroadcast();
             }
         } else {
-            mMediaOutputController.releaseSession();
+            mMediaSwitchingController.releaseSession();
             mDialogTransitionAnimator.disableAllCurrentDialogsExitAnimations();
             dismiss();
         }
@@ -163,8 +167,9 @@
 
     @Override
     public int getBroadcastIconVisibility() {
-        return (isBroadcastSupported() && mMediaOutputController.isBluetoothLeBroadcastEnabled())
-                ? View.VISIBLE : View.GONE;
+        return (isBroadcastSupported() && mMediaSwitchingController.isBluetoothLeBroadcastEnabled())
+                ? View.VISIBLE
+                : View.GONE;
     }
 
     @Override
diff --git a/packages/SystemUI/src/com/android/systemui/media/dialog/MediaOutputDialogManager.kt b/packages/SystemUI/src/com/android/systemui/media/dialog/MediaOutputDialogManager.kt
index 47e0691..4e9451a 100644
--- a/packages/SystemUI/src/com/android/systemui/media/dialog/MediaOutputDialogManager.kt
+++ b/packages/SystemUI/src/com/android/systemui/media/dialog/MediaOutputDialogManager.kt
@@ -35,7 +35,7 @@
     private val broadcastSender: BroadcastSender,
     private val uiEventLogger: UiEventLogger,
     private val dialogTransitionAnimator: DialogTransitionAnimator,
-    private val mediaOutputControllerFactory: MediaOutputController.Factory,
+    private val mediaSwitchingControllerFactory: MediaSwitchingController.Factory,
 ) {
     companion object {
         const val INTERACTION_JANK_TAG = "media_output"
@@ -118,7 +118,7 @@
         // Dismiss the previous dialog, if any.
         mediaOutputDialog?.dismiss()
 
-        val controller = mediaOutputControllerFactory.create(packageName, userHandle, token)
+        val controller = mediaSwitchingControllerFactory.create(packageName, userHandle, token)
 
         val mediaOutputDialog =
             MediaOutputDialog(
diff --git a/packages/SystemUI/src/com/android/systemui/media/dialog/MediaOutputController.java b/packages/SystemUI/src/com/android/systemui/media/dialog/MediaSwitchingController.java
similarity index 98%
rename from packages/SystemUI/src/com/android/systemui/media/dialog/MediaOutputController.java
rename to packages/SystemUI/src/com/android/systemui/media/dialog/MediaSwitchingController.java
index 875e505..72582a9 100644
--- a/packages/SystemUI/src/com/android/systemui/media/dialog/MediaOutputController.java
+++ b/packages/SystemUI/src/com/android/systemui/media/dialog/MediaSwitchingController.java
@@ -116,12 +116,13 @@
 import java.util.stream.Collectors;
 
 /**
- * Controller for media output dialog
+ * Controller for a dialog that allows users to switch media output and input devices, control
+ * volume, connect to new devices, etc.
  */
-public class MediaOutputController implements LocalMediaManager.DeviceCallback,
-        INearbyMediaDevicesUpdateCallback {
+public class MediaSwitchingController
+        implements LocalMediaManager.DeviceCallback, INearbyMediaDevicesUpdateCallback {
 
-    private static final String TAG = "MediaOutputController";
+    private static final String TAG = "MediaSwitchingController";
     private static final boolean DEBUG = Log.isLoggable(TAG, Log.DEBUG);
     private static final String PAGE_CONNECTED_DEVICES_KEY =
             "top_level_connected_devices";
@@ -182,7 +183,7 @@
     }
 
     @AssistedInject
-    public MediaOutputController(
+    public MediaSwitchingController(
             Context context,
             @Assisted String packageName,
             @Assisted @Nullable UserHandle userHandle,
@@ -245,8 +246,8 @@
 
     @AssistedFactory
     public interface Factory {
-        /** Construct a MediaOutputController */
-        MediaOutputController create(
+        /** Construct a MediaSwitchingController */
+        MediaSwitchingController create(
                 String packageName, UserHandle userHandle, MediaSession.Token token);
     }
 
@@ -986,8 +987,8 @@
     }
 
     void launchMediaOutputBroadcastDialog(View mediaOutputDialog, BroadcastSender broadcastSender) {
-        MediaOutputController controller =
-                new MediaOutputController(
+        MediaSwitchingController controller =
+                new MediaSwitchingController(
                         mContext,
                         mPackageName,
                         mUserHandle,
diff --git a/packages/SystemUI/tests/src/com/android/systemui/media/dialog/MediaOutputAdapterTest.java b/packages/SystemUI/tests/src/com/android/systemui/media/dialog/MediaOutputAdapterTest.java
index 411ff91..8731853 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/media/dialog/MediaOutputAdapterTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/media/dialog/MediaOutputAdapterTest.java
@@ -77,7 +77,8 @@
     private static final int TEST_CURRENT_VOLUME = 10;
 
     // Mock
-    private MediaOutputController mMediaOutputController = mock(MediaOutputController.class);
+    private MediaSwitchingController mMediaSwitchingController =
+            mock(MediaSwitchingController.class);
     private MediaOutputDialog mMediaOutputDialog = mock(MediaOutputDialog.class);
     private MediaDevice mMediaDevice1 = mock(MediaDevice.class);
     private MediaDevice mMediaDevice2 = mock(MediaDevice.class);
@@ -95,13 +96,13 @@
 
     @Before
     public void setUp() {
-        when(mMediaOutputController.getMediaItemList()).thenReturn(mMediaItems);
-        when(mMediaOutputController.hasAdjustVolumeUserRestriction()).thenReturn(false);
-        when(mMediaOutputController.isAnyDeviceTransferring()).thenReturn(false);
-        when(mMediaOutputController.getDeviceIconCompat(mMediaDevice1)).thenReturn(mIconCompat);
-        when(mMediaOutputController.getDeviceIconCompat(mMediaDevice2)).thenReturn(mIconCompat);
-        when(mMediaOutputController.getCurrentConnectedMediaDevice()).thenReturn(mMediaDevice1);
-        when(mMediaOutputController.isActiveRemoteDevice(mMediaDevice1)).thenReturn(true);
+        when(mMediaSwitchingController.getMediaItemList()).thenReturn(mMediaItems);
+        when(mMediaSwitchingController.hasAdjustVolumeUserRestriction()).thenReturn(false);
+        when(mMediaSwitchingController.isAnyDeviceTransferring()).thenReturn(false);
+        when(mMediaSwitchingController.getDeviceIconCompat(mMediaDevice1)).thenReturn(mIconCompat);
+        when(mMediaSwitchingController.getDeviceIconCompat(mMediaDevice2)).thenReturn(mIconCompat);
+        when(mMediaSwitchingController.getCurrentConnectedMediaDevice()).thenReturn(mMediaDevice1);
+        when(mMediaSwitchingController.isActiveRemoteDevice(mMediaDevice1)).thenReturn(true);
         when(mIconCompat.toIcon(mContext)).thenReturn(mIcon);
         when(mMediaDevice1.getName()).thenReturn(TEST_DEVICE_NAME_1);
         when(mMediaDevice1.getId()).thenReturn(TEST_DEVICE_ID_1);
@@ -116,7 +117,7 @@
         mMediaItems.add(MediaItem.createDeviceMediaItem(mMediaDevice1));
         mMediaItems.add(MediaItem.createDeviceMediaItem(mMediaDevice2));
 
-        mMediaOutputAdapter = new MediaOutputAdapter(mMediaOutputController);
+        mMediaOutputAdapter = new MediaOutputAdapter(mMediaSwitchingController);
         mMediaOutputAdapter.updateItems();
         mViewHolder = (MediaOutputAdapter.MediaDeviceViewHolder) mMediaOutputAdapter
                 .onCreateViewHolder(new LinearLayout(mContext), 0);
@@ -142,7 +143,7 @@
 
     @Test
     public void onBindViewHolder_bindPairNew_verifyView() {
-        mMediaOutputAdapter = new MediaOutputAdapter(mMediaOutputController);
+        mMediaOutputAdapter = new MediaOutputAdapter(mMediaSwitchingController);
         mMediaOutputAdapter.updateItems();
         mViewHolder = (MediaOutputAdapter.MediaDeviceViewHolder) mMediaOutputAdapter
                 .onCreateViewHolder(new LinearLayout(mContext), 0);
@@ -161,11 +162,13 @@
 
     @Test
     public void onBindViewHolder_bindGroup_withSessionName_verifyView() {
-        when(mMediaOutputController.getSelectedMediaDevice()).thenReturn(
-                mMediaItems.stream().map((item) -> item.getMediaDevice().get()).collect(
-                        Collectors.toList()));
-        when(mMediaOutputController.getSessionName()).thenReturn(TEST_SESSION_NAME);
-        mMediaOutputAdapter = new MediaOutputAdapter(mMediaOutputController);
+        when(mMediaSwitchingController.getSelectedMediaDevice())
+                .thenReturn(
+                        mMediaItems.stream()
+                                .map((item) -> item.getMediaDevice().get())
+                                .collect(Collectors.toList()));
+        when(mMediaSwitchingController.getSessionName()).thenReturn(TEST_SESSION_NAME);
+        mMediaOutputAdapter = new MediaOutputAdapter(mMediaSwitchingController);
         mMediaOutputAdapter.updateItems();
         mViewHolder = (MediaOutputAdapter.MediaDeviceViewHolder) mMediaOutputAdapter
                 .onCreateViewHolder(new LinearLayout(mContext), 0);
@@ -181,11 +184,13 @@
 
     @Test
     public void onBindViewHolder_bindGroup_noSessionName_verifyView() {
-        when(mMediaOutputController.getSelectedMediaDevice()).thenReturn(
-                mMediaItems.stream().map((item) -> item.getMediaDevice().get()).collect(
-                        Collectors.toList()));
-        when(mMediaOutputController.getSessionName()).thenReturn(null);
-        mMediaOutputAdapter = new MediaOutputAdapter(mMediaOutputController);
+        when(mMediaSwitchingController.getSelectedMediaDevice())
+                .thenReturn(
+                        mMediaItems.stream()
+                                .map((item) -> item.getMediaDevice().get())
+                                .collect(Collectors.toList()));
+        when(mMediaSwitchingController.getSessionName()).thenReturn(null);
+        mMediaOutputAdapter = new MediaOutputAdapter(mMediaSwitchingController);
         mMediaOutputAdapter.updateItems();
         mViewHolder = (MediaOutputAdapter.MediaDeviceViewHolder) mMediaOutputAdapter
                 .onCreateViewHolder(new LinearLayout(mContext), 0);
@@ -214,7 +219,7 @@
 
     @Test
     public void onBindViewHolder_bindNonRemoteConnectedDevice_verifyView() {
-        when(mMediaOutputController.isActiveRemoteDevice(mMediaDevice1)).thenReturn(false);
+        when(mMediaSwitchingController.isActiveRemoteDevice(mMediaDevice1)).thenReturn(false);
         mViewHolder = (MediaOutputAdapter.MediaDeviceViewHolder) mMediaOutputAdapter
                 .onCreateViewHolder(new LinearLayout(mContext), 0);
         mMediaOutputAdapter.onBindViewHolder(mViewHolder, 0);
@@ -230,9 +235,9 @@
 
     @Test
     public void onBindViewHolder_bindConnectedRemoteDevice_verifyView() {
-        when(mMediaOutputController.getSelectableMediaDevice()).thenReturn(
-                ImmutableList.of(mMediaDevice2));
-        when(mMediaOutputController.isCurrentConnectedDeviceRemote()).thenReturn(true);
+        when(mMediaSwitchingController.getSelectableMediaDevice())
+                .thenReturn(ImmutableList.of(mMediaDevice2));
+        when(mMediaSwitchingController.isCurrentConnectedDeviceRemote()).thenReturn(true);
         mViewHolder = (MediaOutputAdapter.MediaDeviceViewHolder) mMediaOutputAdapter
                 .onCreateViewHolder(new LinearLayout(mContext), 0);
         mMediaOutputAdapter.onBindViewHolder(mViewHolder, 0);
@@ -249,9 +254,9 @@
 
     @Test
     public void onBindViewHolder_bindConnectedRemoteDevice_verifyContentDescriptionNotNull() {
-        when(mMediaOutputController.getSelectableMediaDevice()).thenReturn(
-                ImmutableList.of(mMediaDevice2));
-        when(mMediaOutputController.isCurrentConnectedDeviceRemote()).thenReturn(true);
+        when(mMediaSwitchingController.getSelectableMediaDevice())
+                .thenReturn(ImmutableList.of(mMediaDevice2));
+        when(mMediaSwitchingController.isCurrentConnectedDeviceRemote()).thenReturn(true);
         mViewHolder = (MediaOutputAdapter.MediaDeviceViewHolder) mMediaOutputAdapter
                 .onCreateViewHolder(new LinearLayout(mContext), 0);
         mMediaOutputAdapter.onBindViewHolder(mViewHolder, 0);
@@ -263,9 +268,8 @@
 
     @Test
     public void onBindViewHolder_bindSingleConnectedRemoteDevice_verifyView() {
-        when(mMediaOutputController.getSelectableMediaDevice()).thenReturn(
-                ImmutableList.of());
-        when(mMediaOutputController.isCurrentConnectedDeviceRemote()).thenReturn(true);
+        when(mMediaSwitchingController.getSelectableMediaDevice()).thenReturn(ImmutableList.of());
+        when(mMediaSwitchingController.isCurrentConnectedDeviceRemote()).thenReturn(true);
         mViewHolder = (MediaOutputAdapter.MediaDeviceViewHolder) mMediaOutputAdapter
                 .onCreateViewHolder(new LinearLayout(mContext), 0);
         mMediaOutputAdapter.onBindViewHolder(mViewHolder, 0);
@@ -283,9 +287,8 @@
     @Test
     public void onBindViewHolder_bindConnectedRemoteDeviceWithOnGoingSession_verifyView() {
         when(mMediaDevice1.hasOngoingSession()).thenReturn(true);
-        when(mMediaOutputController.getSelectableMediaDevice()).thenReturn(
-                ImmutableList.of());
-        when(mMediaOutputController.isCurrentConnectedDeviceRemote()).thenReturn(true);
+        when(mMediaSwitchingController.getSelectableMediaDevice()).thenReturn(ImmutableList.of());
+        when(mMediaSwitchingController.isCurrentConnectedDeviceRemote()).thenReturn(true);
         mViewHolder = (MediaOutputAdapter.MediaDeviceViewHolder) mMediaOutputAdapter
                 .onCreateViewHolder(new LinearLayout(mContext), 0);
         mMediaOutputAdapter.onBindViewHolder(mViewHolder, 0);
@@ -305,9 +308,8 @@
     public void onBindViewHolder_bindConnectedRemoteDeviceWithHostOnGoingSession_verifyView() {
         when(mMediaDevice1.hasOngoingSession()).thenReturn(true);
         when(mMediaDevice1.isHostForOngoingSession()).thenReturn(true);
-        when(mMediaOutputController.getSelectableMediaDevice()).thenReturn(
-                ImmutableList.of());
-        when(mMediaOutputController.isCurrentConnectedDeviceRemote()).thenReturn(true);
+        when(mMediaSwitchingController.getSelectableMediaDevice()).thenReturn(ImmutableList.of());
+        when(mMediaSwitchingController.isCurrentConnectedDeviceRemote()).thenReturn(true);
         mViewHolder = (MediaOutputAdapter.MediaDeviceViewHolder) mMediaOutputAdapter
                 .onCreateViewHolder(new LinearLayout(mContext), 0);
         mMediaOutputAdapter.onBindViewHolder(mViewHolder, 0);
@@ -326,8 +328,8 @@
 
     @Test
     public void onBindViewHolder_bindConnectedDeviceWithMutingExpectedDeviceExist_verifyView() {
-        when(mMediaOutputController.hasMutingExpectedDevice()).thenReturn(true);
-        when(mMediaOutputController.isCurrentConnectedDeviceRemote()).thenReturn(false);
+        when(mMediaSwitchingController.hasMutingExpectedDevice()).thenReturn(true);
+        when(mMediaSwitchingController.isCurrentConnectedDeviceRemote()).thenReturn(false);
         mMediaOutputAdapter.onBindViewHolder(mViewHolder, 0);
 
         assertThat(mViewHolder.mTwoLineLayout.getVisibility()).isEqualTo(View.GONE);
@@ -340,8 +342,8 @@
     @Test
     public void onBindViewHolder_isMutingExpectedDevice_verifyView() {
         when(mMediaDevice1.isMutingExpectedDevice()).thenReturn(true);
-        when(mMediaOutputController.isCurrentConnectedDeviceRemote()).thenReturn(false);
-        when(mMediaOutputController.isActiveRemoteDevice(mMediaDevice1)).thenReturn(false);
+        when(mMediaSwitchingController.isCurrentConnectedDeviceRemote()).thenReturn(false);
+        when(mMediaSwitchingController.isActiveRemoteDevice(mMediaDevice1)).thenReturn(false);
         mViewHolder = (MediaOutputAdapter.MediaDeviceViewHolder) mMediaOutputAdapter
                 .onCreateViewHolder(new LinearLayout(mContext), 0);
         mMediaOutputAdapter.onBindViewHolder(mViewHolder, 0);
@@ -378,14 +380,14 @@
 
         mOnSeekBarChangeListenerCaptor.getValue().onStopTrackingTouch(mViewHolder.mSeekBar);
         assertThat(mViewHolder.mSeekBar.getVisibility()).isEqualTo(View.VISIBLE);
-        verify(mMediaOutputController).logInteractionAdjustVolume(mMediaDevice1);
+        verify(mMediaSwitchingController).logInteractionAdjustVolume(mMediaDevice1);
     }
 
     @Test
     public void onBindViewHolder_bindSelectableDevice_verifyView() {
         List<MediaDevice> selectableDevices = new ArrayList<>();
         selectableDevices.add(mMediaDevice2);
-        when(mMediaOutputController.getSelectableMediaDevice()).thenReturn(selectableDevices);
+        when(mMediaSwitchingController.getSelectableMediaDevice()).thenReturn(selectableDevices);
         mMediaOutputAdapter.onBindViewHolder(mViewHolder, 1);
 
         assertThat(mViewHolder.mTwoLineLayout.getVisibility()).isEqualTo(View.GONE);
@@ -440,7 +442,7 @@
 
     @Test
     public void subStatusSupported_onBindViewHolder_bindHostDeviceWithOngoingSession_verifyView() {
-        when(mMediaOutputController.isVolumeControlEnabled(mMediaDevice1)).thenReturn(true);
+        when(mMediaSwitchingController.isVolumeControlEnabled(mMediaDevice1)).thenReturn(true);
         when(mMediaDevice1.isHostForOngoingSession()).thenReturn(true);
         when(mMediaDevice1.hasSubtext()).thenReturn(true);
         when(mMediaDevice1.getSubtext()).thenReturn(SUBTEXT_CUSTOM);
@@ -540,7 +542,7 @@
 
     @Test
     public void onBindViewHolder_inTransferring_bindTransferringDevice_verifyView() {
-        when(mMediaOutputController.isAnyDeviceTransferring()).thenReturn(true);
+        when(mMediaSwitchingController.isAnyDeviceTransferring()).thenReturn(true);
         when(mMediaDevice1.getState()).thenReturn(
                 LocalMediaManager.MediaDeviceState.STATE_CONNECTING);
         mMediaOutputAdapter.onBindViewHolder(mViewHolder, 0);
@@ -556,7 +558,7 @@
 
     @Test
     public void onBindViewHolder_bindGroupingDevice_verifyView() {
-        when(mMediaOutputController.isAnyDeviceTransferring()).thenReturn(false);
+        when(mMediaSwitchingController.isAnyDeviceTransferring()).thenReturn(false);
         when(mMediaDevice1.getState()).thenReturn(
                 LocalMediaManager.MediaDeviceState.STATE_GROUPING);
         mMediaOutputAdapter.onBindViewHolder(mViewHolder, 0);
@@ -572,7 +574,7 @@
 
     @Test
     public void onBindViewHolder_inTransferring_bindNonTransferringDevice_verifyView() {
-        when(mMediaOutputController.isAnyDeviceTransferring()).thenReturn(true);
+        when(mMediaSwitchingController.isAnyDeviceTransferring()).thenReturn(true);
         when(mMediaDevice2.getState()).thenReturn(
                 LocalMediaManager.MediaDeviceState.STATE_CONNECTING);
         mMediaOutputAdapter.onBindViewHolder(mViewHolder, 0);
@@ -586,7 +588,7 @@
 
     @Test
     public void onItemClick_clickPairNew_verifyLaunchBluetoothPairing() {
-        mMediaOutputAdapter = new MediaOutputAdapter(mMediaOutputController);
+        mMediaOutputAdapter = new MediaOutputAdapter(mMediaSwitchingController);
         mMediaOutputAdapter.updateItems();
         mViewHolder = (MediaOutputAdapter.MediaDeviceViewHolder) mMediaOutputAdapter
                 .onCreateViewHolder(new LinearLayout(mContext), 0);
@@ -595,16 +597,16 @@
         mMediaOutputAdapter.onBindViewHolder(mViewHolder, 2);
         mViewHolder.mContainerLayout.performClick();
 
-        verify(mMediaOutputController).launchBluetoothPairing(mViewHolder.mContainerLayout);
+        verify(mMediaSwitchingController).launchBluetoothPairing(mViewHolder.mContainerLayout);
     }
 
     @Test
     public void onItemClick_clickDevice_verifyConnectDevice() {
-        when(mMediaOutputController.isCurrentOutputDeviceHasSessionOngoing()).thenReturn(false);
+        when(mMediaSwitchingController.isCurrentOutputDeviceHasSessionOngoing()).thenReturn(false);
         assertThat(mMediaDevice2.getState()).isEqualTo(
                 LocalMediaManager.MediaDeviceState.STATE_DISCONNECTED);
         when(mMediaDevice2.getSelectionBehavior()).thenReturn(SELECTION_BEHAVIOR_TRANSFER);
-        mMediaOutputAdapter = new MediaOutputAdapter(mMediaOutputController);
+        mMediaOutputAdapter = new MediaOutputAdapter(mMediaSwitchingController);
         mMediaOutputAdapter.updateItems();
         mViewHolder = (MediaOutputAdapter.MediaDeviceViewHolder) mMediaOutputAdapter
                 .onCreateViewHolder(new LinearLayout(mContext), 0);
@@ -613,16 +615,16 @@
         mMediaOutputAdapter.onBindViewHolder(mViewHolder, 1);
         mViewHolder.mContainerLayout.performClick();
 
-        verify(mMediaOutputController).connectDevice(mMediaDevice2);
+        verify(mMediaSwitchingController).connectDevice(mMediaDevice2);
     }
 
     @Test
     public void onItemClick_clickDeviceWithSessionOngoing_verifyShowsDialog() {
-        when(mMediaOutputController.isCurrentOutputDeviceHasSessionOngoing()).thenReturn(true);
+        when(mMediaSwitchingController.isCurrentOutputDeviceHasSessionOngoing()).thenReturn(true);
         assertThat(mMediaDevice2.getState()).isEqualTo(
                 LocalMediaManager.MediaDeviceState.STATE_DISCONNECTED);
         when(mMediaDevice2.getSelectionBehavior()).thenReturn(SELECTION_BEHAVIOR_TRANSFER);
-        mMediaOutputAdapter = new MediaOutputAdapter(mMediaOutputController);
+        mMediaOutputAdapter = new MediaOutputAdapter(mMediaSwitchingController);
         mMediaOutputAdapter.updateItems();
         mViewHolder = (MediaOutputAdapter.MediaDeviceViewHolder) mMediaOutputAdapter
                 .onCreateViewHolder(new LinearLayout(mContext), 0);
@@ -633,66 +635,68 @@
         mMediaOutputAdapter.onBindViewHolder(spyMediaDeviceViewHolder, 1);
         spyMediaDeviceViewHolder.mContainerLayout.performClick();
 
-        verify(mMediaOutputController, never()).connectDevice(mMediaDevice2);
+        verify(mMediaSwitchingController, never()).connectDevice(mMediaDevice2);
         verify(spyMediaDeviceViewHolder).showCustomEndSessionDialog(mMediaDevice2);
     }
 
     @Test
     public void onItemClick_clicksWithMutingExpectedDeviceExist_cancelsMuteAwaitConnection() {
-        when(mMediaOutputController.isAnyDeviceTransferring()).thenReturn(false);
-        when(mMediaOutputController.hasMutingExpectedDevice()).thenReturn(true);
-        when(mMediaOutputController.isCurrentConnectedDeviceRemote()).thenReturn(false);
+        when(mMediaSwitchingController.isAnyDeviceTransferring()).thenReturn(false);
+        when(mMediaSwitchingController.hasMutingExpectedDevice()).thenReturn(true);
+        when(mMediaSwitchingController.isCurrentConnectedDeviceRemote()).thenReturn(false);
         when(mMediaDevice1.isMutingExpectedDevice()).thenReturn(false);
         mMediaOutputAdapter.onBindViewHolder(mViewHolder, 0);
 
         mViewHolder.mContainerLayout.performClick();
 
-        verify(mMediaOutputController).cancelMuteAwaitConnection();
+        verify(mMediaSwitchingController).cancelMuteAwaitConnection();
     }
 
     @Test
     public void onGroupActionTriggered_clicksEndAreaOfSelectableDevice_triggerGrouping() {
         List<MediaDevice> selectableDevices = new ArrayList<>();
         selectableDevices.add(mMediaDevice2);
-        when(mMediaOutputController.getSelectableMediaDevice()).thenReturn(selectableDevices);
+        when(mMediaSwitchingController.getSelectableMediaDevice()).thenReturn(selectableDevices);
         mViewHolder = (MediaOutputAdapter.MediaDeviceViewHolder) mMediaOutputAdapter
                 .onCreateViewHolder(new LinearLayout(mContext), 0);
         mMediaOutputAdapter.onBindViewHolder(mViewHolder, 1);
 
         mViewHolder.mEndTouchArea.performClick();
 
-        verify(mMediaOutputController).addDeviceToPlayMedia(mMediaDevice2);
+        verify(mMediaSwitchingController).addDeviceToPlayMedia(mMediaDevice2);
     }
 
     @Test
     public void onGroupActionTriggered_clickSelectedRemoteDevice_triggerUngrouping() {
-        when(mMediaOutputController.getSelectableMediaDevice()).thenReturn(
-                ImmutableList.of(mMediaDevice2));
-        when(mMediaOutputController.getDeselectableMediaDevice()).thenReturn(
-                ImmutableList.of(mMediaDevice1));
-        when(mMediaOutputController.isCurrentConnectedDeviceRemote()).thenReturn(true);
+        when(mMediaSwitchingController.getSelectableMediaDevice())
+                .thenReturn(ImmutableList.of(mMediaDevice2));
+        when(mMediaSwitchingController.getDeselectableMediaDevice())
+                .thenReturn(ImmutableList.of(mMediaDevice1));
+        when(mMediaSwitchingController.isCurrentConnectedDeviceRemote()).thenReturn(true);
         mViewHolder = (MediaOutputAdapter.MediaDeviceViewHolder) mMediaOutputAdapter
                 .onCreateViewHolder(new LinearLayout(mContext), 0);
         mMediaOutputAdapter.onBindViewHolder(mViewHolder, 0);
 
         mViewHolder.mEndTouchArea.performClick();
 
-        verify(mMediaOutputController).removeDeviceFromPlayMedia(mMediaDevice1);
+        verify(mMediaSwitchingController).removeDeviceFromPlayMedia(mMediaDevice1);
     }
 
     @Test
     public void onItemClick_onGroupActionTriggered_verifySeekbarDisabled() {
-        when(mMediaOutputController.getSelectedMediaDevice()).thenReturn(
-                mMediaItems.stream().map((item) -> item.getMediaDevice().get()).collect(
-                        Collectors.toList()));
-        mMediaOutputAdapter = new MediaOutputAdapter(mMediaOutputController);
+        when(mMediaSwitchingController.getSelectedMediaDevice())
+                .thenReturn(
+                        mMediaItems.stream()
+                                .map((item) -> item.getMediaDevice().get())
+                                .collect(Collectors.toList()));
+        mMediaOutputAdapter = new MediaOutputAdapter(mMediaSwitchingController);
         mMediaOutputAdapter.updateItems();
         mViewHolder = (MediaOutputAdapter.MediaDeviceViewHolder) mMediaOutputAdapter
                 .onCreateViewHolder(new LinearLayout(mContext), 0);
         List<MediaDevice> selectableDevices = new ArrayList<>();
         selectableDevices.add(mMediaDevice1);
-        when(mMediaOutputController.getSelectableMediaDevice()).thenReturn(selectableDevices);
-        when(mMediaOutputController.hasAdjustVolumeUserRestriction()).thenReturn(true);
+        when(mMediaSwitchingController.getSelectableMediaDevice()).thenReturn(selectableDevices);
+        when(mMediaSwitchingController.hasAdjustVolumeUserRestriction()).thenReturn(true);
         mMediaOutputAdapter.onBindViewHolder(mViewHolder, 0);
 
         mViewHolder.mContainerLayout.performClick();
@@ -702,11 +706,11 @@
 
     @Test
     public void onBindViewHolder_volumeControlChangeToEnabled_enableSeekbarAgain() {
-        when(mMediaOutputController.isVolumeControlEnabled(mMediaDevice1)).thenReturn(false);
+        when(mMediaSwitchingController.isVolumeControlEnabled(mMediaDevice1)).thenReturn(false);
         mMediaOutputAdapter.onBindViewHolder(mViewHolder, 0);
         assertThat(mViewHolder.mSeekBar.isEnabled()).isFalse();
 
-        when(mMediaOutputController.isVolumeControlEnabled(mMediaDevice1)).thenReturn(true);
+        when(mMediaSwitchingController.isVolumeControlEnabled(mMediaDevice1)).thenReturn(true);
         mMediaOutputAdapter.onBindViewHolder(mViewHolder, 0);
 
         assertThat(mViewHolder.mSeekBar.isEnabled()).isTrue();
@@ -719,7 +723,7 @@
 
         mMediaOutputAdapter.updateColorScheme(wallpaperColors, true);
 
-        verify(mMediaOutputController).setCurrentColorScheme(wallpaperColors, true);
+        verify(mMediaSwitchingController).setCurrentColorScheme(wallpaperColors, true);
     }
 
     @Test
@@ -727,7 +731,7 @@
         mMediaOutputAdapter.updateItems();
         List<MediaItem> updatedList = new ArrayList<>();
         updatedList.add(MediaItem.createPairNewDeviceMediaItem());
-        when(mMediaOutputController.getMediaItemList()).thenReturn(updatedList);
+        when(mMediaSwitchingController.getMediaItemList()).thenReturn(updatedList);
         assertThat(mMediaOutputAdapter.getItemCount()).isEqualTo(mMediaItems.size());
 
         mMediaOutputAdapter.updateItems();
diff --git a/packages/SystemUI/tests/src/com/android/systemui/media/dialog/MediaOutputBaseDialogTest.java b/packages/SystemUI/tests/src/com/android/systemui/media/dialog/MediaOutputBaseDialogTest.java
index c8cc6b5..47371df 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/media/dialog/MediaOutputBaseDialogTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/media/dialog/MediaOutputBaseDialogTest.java
@@ -104,7 +104,7 @@
 
     private List<MediaController> mMediaControllers = new ArrayList<>();
     private MediaOutputBaseDialogImpl mMediaOutputBaseDialogImpl;
-    private MediaOutputController mMediaOutputController;
+    private MediaSwitchingController mMediaSwitchingController;
     private int mHeaderIconRes;
     private IconCompat mIconCompat;
     private CharSequence mHeaderTitle;
@@ -132,8 +132,8 @@
                 VolumePanelGlobalStateInteractorKosmosKt.getVolumePanelGlobalStateInteractor(
                         mKosmos);
 
-        mMediaOutputController =
-                new MediaOutputController(
+        mMediaSwitchingController =
+                new MediaSwitchingController(
                         mContext,
                         TEST_PACKAGE,
                         mContext.getUser(),
@@ -153,12 +153,13 @@
 
         // Using a fake package will cause routing operations to fail, so we intercept
         // scanning-related operations.
-        mMediaOutputController.mLocalMediaManager = mock(LocalMediaManager.class);
-        doNothing().when(mMediaOutputController.mLocalMediaManager).startScan();
-        doNothing().when(mMediaOutputController.mLocalMediaManager).stopScan();
+        mMediaSwitchingController.mLocalMediaManager = mock(LocalMediaManager.class);
+        doNothing().when(mMediaSwitchingController.mLocalMediaManager).startScan();
+        doNothing().when(mMediaSwitchingController.mLocalMediaManager).stopScan();
 
-        mMediaOutputBaseDialogImpl = new MediaOutputBaseDialogImpl(mContext, mBroadcastSender,
-                mMediaOutputController);
+        mMediaOutputBaseDialogImpl =
+                new MediaOutputBaseDialogImpl(
+                        mContext, mBroadcastSender, mMediaSwitchingController);
         mMediaOutputBaseDialogImpl.onCreate(new Bundle());
     }
 
@@ -176,7 +177,7 @@
     public void refresh_withIconCompat_iconIsVisible() {
         mIconCompat = IconCompat.createWithBitmap(
                 Bitmap.createBitmap(1, 1, Bitmap.Config.ARGB_8888));
-        when(mMediaOutputBaseAdapter.getController()).thenReturn(mMediaOutputController);
+        when(mMediaOutputBaseAdapter.getController()).thenReturn(mMediaSwitchingController);
 
         mMediaOutputBaseDialogImpl.refresh();
         final ImageView view = mMediaOutputBaseDialogImpl.mDialogView.requireViewById(
@@ -263,7 +264,7 @@
         when(mMediaOutputBaseAdapter.isDragging()).thenReturn(true);
         mMediaOutputBaseDialogImpl.refresh();
 
-        assertThat(mMediaOutputController.isRefreshing()).isFalse();
+        assertThat(mMediaSwitchingController.isRefreshing()).isFalse();
     }
 
     @Test
@@ -335,12 +336,14 @@
 
     class MediaOutputBaseDialogImpl extends MediaOutputBaseDialog {
 
-        MediaOutputBaseDialogImpl(Context context, BroadcastSender broadcastSender,
-                MediaOutputController mediaOutputController) {
+        MediaOutputBaseDialogImpl(
+                Context context,
+                BroadcastSender broadcastSender,
+                MediaSwitchingController mediaSwitchingController) {
             super(
                     context,
                     broadcastSender,
-                    mediaOutputController, /* includePlaybackAndAppMetadata */
+                    mediaSwitchingController, /* includePlaybackAndAppMetadata */
                     true);
 
             mAdapter = mMediaOutputBaseAdapter;
diff --git a/packages/SystemUI/tests/src/com/android/systemui/media/dialog/MediaOutputBroadcastDialogTest.java b/packages/SystemUI/tests/src/com/android/systemui/media/dialog/MediaOutputBroadcastDialogTest.java
index 189a561..f0902e3 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/media/dialog/MediaOutputBroadcastDialogTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/media/dialog/MediaOutputBroadcastDialogTest.java
@@ -119,7 +119,7 @@
     private UserTracker mUserTracker = mock(UserTracker.class);
 
     private MediaOutputBroadcastDialog mMediaOutputBroadcastDialog;
-    private MediaOutputController mMediaOutputController;
+    private MediaSwitchingController mMediaSwitchingController;
 
     @Before
     public void setUp() {
@@ -133,8 +133,8 @@
                 VolumePanelGlobalStateInteractorKosmosKt.getVolumePanelGlobalStateInteractor(
                         mKosmos);
 
-        mMediaOutputController =
-                new MediaOutputController(
+        mMediaSwitchingController =
+                new MediaSwitchingController(
                         mContext,
                         TEST_PACKAGE,
                         mContext.getUser(),
@@ -151,9 +151,10 @@
                         mFlags,
                         volumePanelGlobalStateInteractor,
                         mUserTracker);
-        mMediaOutputController.mLocalMediaManager = mLocalMediaManager;
-        mMediaOutputBroadcastDialog = new MediaOutputBroadcastDialog(mContext, false,
-                mBroadcastSender, mMediaOutputController);
+        mMediaSwitchingController.mLocalMediaManager = mLocalMediaManager;
+        mMediaOutputBroadcastDialog =
+                new MediaOutputBroadcastDialog(
+                        mContext, false, mBroadcastSender, mMediaSwitchingController);
         mMediaOutputBroadcastDialog.show();
     }
 
diff --git a/packages/SystemUI/tests/src/com/android/systemui/media/dialog/MediaOutputDialogTest.java b/packages/SystemUI/tests/src/com/android/systemui/media/dialog/MediaOutputDialogTest.java
index 90c2930..d3ecb3d 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/media/dialog/MediaOutputDialogTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/media/dialog/MediaOutputDialogTest.java
@@ -119,7 +119,7 @@
 
     private List<MediaController> mMediaControllers = new ArrayList<>();
     private MediaOutputDialog mMediaOutputDialog;
-    private MediaOutputController mMediaOutputController;
+    private MediaSwitchingController mMediaSwitchingController;
     private final List<String> mFeatures = new ArrayList<>();
 
     @Override
@@ -146,8 +146,8 @@
                 VolumePanelGlobalStateInteractorKosmosKt.getVolumePanelGlobalStateInteractor(
                         mKosmos);
 
-        mMediaOutputController =
-                new MediaOutputController(
+        mMediaSwitchingController =
+                new MediaSwitchingController(
                         mContext,
                         TEST_PACKAGE,
                         mContext.getUser(),
@@ -164,8 +164,8 @@
                         mFlags,
                         volumePanelGlobalStateInteractor,
                         mUserTracker);
-        mMediaOutputController.mLocalMediaManager = mLocalMediaManager;
-        mMediaOutputDialog = makeTestDialog(mMediaOutputController);
+        mMediaSwitchingController.mLocalMediaManager = mLocalMediaManager;
+        mMediaOutputDialog = makeTestDialog(mMediaSwitchingController);
         mMediaOutputDialog.show();
 
         when(mLocalMediaManager.getCurrentConnectedDevice()).thenReturn(mMediaDevice);
@@ -388,12 +388,15 @@
     public void getStopButtonText_notSupportsBroadcast_returnsDefaultText() {
         String stopText = mContext.getText(
                 R.string.media_output_dialog_button_stop_casting).toString();
-        MediaOutputController mockMediaOutputController = mock(MediaOutputController.class);
-        when(mockMediaOutputController.isBroadcastSupported()).thenReturn(false);
+        MediaSwitchingController mockMediaSwitchingController =
+                mock(MediaSwitchingController.class);
+        when(mockMediaSwitchingController.isBroadcastSupported()).thenReturn(false);
 
-        withTestDialog(mockMediaOutputController, testDialog -> {
-            assertThat(testDialog.getStopButtonText().toString()).isEqualTo(stopText);
-        });
+        withTestDialog(
+                mockMediaSwitchingController,
+                testDialog -> {
+                    assertThat(testDialog.getStopButtonText().toString()).isEqualTo(stopText);
+                });
     }
 
     @Test
@@ -401,28 +404,35 @@
     public void getStopButtonText_supportsBroadcast_returnsBroadcastText() {
         String stopText = mContext.getText(R.string.media_output_broadcast).toString();
         MediaDevice mMediaDevice = mock(MediaDevice.class);
-        MediaOutputController mockMediaOutputController = mock(MediaOutputController.class);
-        when(mockMediaOutputController.isBroadcastSupported()).thenReturn(true);
-        when(mockMediaOutputController.getCurrentConnectedMediaDevice()).thenReturn(mMediaDevice);
-        when(mockMediaOutputController.isBluetoothLeDevice(any())).thenReturn(true);
-        when(mockMediaOutputController.isPlaying()).thenReturn(true);
-        when(mockMediaOutputController.isBluetoothLeBroadcastEnabled()).thenReturn(false);
-        withTestDialog(mockMediaOutputController, testDialog -> {
-            assertThat(testDialog.getStopButtonText().toString()).isEqualTo(stopText);
-        });
+        MediaSwitchingController mockMediaSwitchingController =
+                mock(MediaSwitchingController.class);
+        when(mockMediaSwitchingController.isBroadcastSupported()).thenReturn(true);
+        when(mockMediaSwitchingController.getCurrentConnectedMediaDevice())
+                .thenReturn(mMediaDevice);
+        when(mockMediaSwitchingController.isBluetoothLeDevice(any())).thenReturn(true);
+        when(mockMediaSwitchingController.isPlaying()).thenReturn(true);
+        when(mockMediaSwitchingController.isBluetoothLeBroadcastEnabled()).thenReturn(false);
+        withTestDialog(
+                mockMediaSwitchingController,
+                testDialog -> {
+                    assertThat(testDialog.getStopButtonText().toString()).isEqualTo(stopText);
+                });
     }
 
     @Test
     public void onStopButtonClick_notPlaying_releaseSession() {
-        MediaOutputController mockMediaOutputController = mock(MediaOutputController.class);
-        when(mockMediaOutputController.isBroadcastSupported()).thenReturn(false);
-        when(mockMediaOutputController.getCurrentConnectedMediaDevice()).thenReturn(null);
-        when(mockMediaOutputController.isPlaying()).thenReturn(false);
-        withTestDialog(mockMediaOutputController, testDialog -> {
-            testDialog.onStopButtonClick();
-        });
+        MediaSwitchingController mockMediaSwitchingController =
+                mock(MediaSwitchingController.class);
+        when(mockMediaSwitchingController.isBroadcastSupported()).thenReturn(false);
+        when(mockMediaSwitchingController.getCurrentConnectedMediaDevice()).thenReturn(null);
+        when(mockMediaSwitchingController.isPlaying()).thenReturn(false);
+        withTestDialog(
+                mockMediaSwitchingController,
+                testDialog -> {
+                    testDialog.onStopButtonClick();
+                });
 
-        verify(mockMediaOutputController).releaseSession();
+        verify(mockMediaSwitchingController).releaseSession();
         verify(mDialogTransitionAnimator).disableAllCurrentDialogsExitAnimations();
     }
 
@@ -430,14 +440,14 @@
     // Check the visibility metric logging by creating a new MediaOutput dialog,
     // and verify if the calling times increases.
     public void onCreate_ShouldLogVisibility() {
-        withTestDialog(mMediaOutputController, testDialog -> {});
+        withTestDialog(mMediaSwitchingController, testDialog -> {});
 
         verify(mUiEventLogger, times(2))
                 .log(MediaOutputDialog.MediaOutputEvent.MEDIA_OUTPUT_DIALOG_SHOW);
     }
 
     @NonNull
-    private MediaOutputDialog makeTestDialog(MediaOutputController controller) {
+    private MediaOutputDialog makeTestDialog(MediaSwitchingController controller) {
         return new MediaOutputDialog(
                 mContext,
                 false,
@@ -448,7 +458,8 @@
                 true);
     }
 
-    private void withTestDialog(MediaOutputController controller, Consumer<MediaOutputDialog> c) {
+    private void withTestDialog(
+            MediaSwitchingController controller, Consumer<MediaOutputDialog> c) {
         MediaOutputDialog testDialog = makeTestDialog(controller);
         testDialog.show();
         c.accept(testDialog);
diff --git a/packages/SystemUI/tests/src/com/android/systemui/media/dialog/MediaOutputControllerTest.java b/packages/SystemUI/tests/src/com/android/systemui/media/dialog/MediaSwitchingControllerTest.java
similarity index 78%
rename from packages/SystemUI/tests/src/com/android/systemui/media/dialog/MediaOutputControllerTest.java
rename to packages/SystemUI/tests/src/com/android/systemui/media/dialog/MediaSwitchingControllerTest.java
index 714fad9..4a54a90 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/media/dialog/MediaOutputControllerTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/media/dialog/MediaSwitchingControllerTest.java
@@ -101,7 +101,7 @@
 @SmallTest
 @RunWith(AndroidJUnit4.class)
 @TestableLooper.RunWithLooper(setAsMainLooper = true)
-public class MediaOutputControllerTest extends SysuiTestCase {
+public class MediaSwitchingControllerTest extends SysuiTestCase {
     private static final String TEST_DEVICE_1_ID = "test_device_1_id";
     private static final String TEST_DEVICE_2_ID = "test_device_2_id";
     private static final String TEST_DEVICE_3_ID = "test_device_3_id";
@@ -126,8 +126,7 @@
     private CachedBluetoothDeviceManager mCachedBluetoothDeviceManager;
     @Mock
     private LocalBluetoothManager mLocalBluetoothManager;
-    @Mock
-    private MediaOutputController.Callback mCb;
+    @Mock private MediaSwitchingController.Callback mCb;
     @Mock
     private MediaDevice mMediaDevice1;
     @Mock
@@ -166,7 +165,8 @@
 
     private FeatureFlags mFlags = mock(FeatureFlags.class);
     private View mDialogLaunchView = mock(View.class);
-    private MediaOutputController.Callback mCallback = mock(MediaOutputController.Callback.class);
+    private MediaSwitchingController.Callback mCallback =
+            mock(MediaSwitchingController.Callback.class);
 
     final Notification mNotification = mock(Notification.class);
     private final VolumePanelGlobalStateInteractor mVolumePanelGlobalStateInteractor =
@@ -175,7 +175,7 @@
 
     private Context mSpyContext;
     private String mPackageName = null;
-    private MediaOutputController mMediaOutputController;
+    private MediaSwitchingController mMediaSwitchingController;
     private LocalMediaManager mLocalMediaManager;
     private List<MediaController> mMediaControllers = new ArrayList<>();
     private List<MediaDevice> mMediaDevices = new ArrayList<>();
@@ -203,9 +203,8 @@
         when(mLocalBluetoothManager.getCachedDeviceManager()).thenReturn(
                 mCachedBluetoothDeviceManager);
 
-
-        mMediaOutputController =
-                new MediaOutputController(
+        mMediaSwitchingController =
+                new MediaSwitchingController(
                         mSpyContext,
                         mPackageName,
                         mContext.getUser(),
@@ -222,9 +221,9 @@
                         mFlags,
                         mVolumePanelGlobalStateInteractor,
                         mUserTracker);
-        mLocalMediaManager = spy(mMediaOutputController.mLocalMediaManager);
+        mLocalMediaManager = spy(mMediaSwitchingController.mLocalMediaManager);
         when(mLocalMediaManager.isPreferenceRouteListingExist()).thenReturn(false);
-        mMediaOutputController.mLocalMediaManager = mLocalMediaManager;
+        mMediaSwitchingController.mLocalMediaManager = mLocalMediaManager;
         MediaDescription.Builder builder = new MediaDescription.Builder();
         builder.setTitle(TEST_SONG);
         builder.setSubtitle(TEST_ARTIST);
@@ -264,26 +263,26 @@
 
     @Test
     public void start_verifyLocalMediaManagerInit() {
-        mMediaOutputController.start(mCb);
+        mMediaSwitchingController.start(mCb);
 
-        verify(mLocalMediaManager).registerCallback(mMediaOutputController);
+        verify(mLocalMediaManager).registerCallback(mMediaSwitchingController);
         verify(mLocalMediaManager).startScan();
     }
 
     @Test
     public void stop_verifyLocalMediaManagerDeinit() {
-        mMediaOutputController.start(mCb);
+        mMediaSwitchingController.start(mCb);
         reset(mLocalMediaManager);
 
-        mMediaOutputController.stop();
+        mMediaSwitchingController.stop();
 
-        verify(mLocalMediaManager).unregisterCallback(mMediaOutputController);
+        verify(mLocalMediaManager).unregisterCallback(mMediaSwitchingController);
         verify(mLocalMediaManager).stopScan();
     }
 
     @Test
     public void start_notificationNotFound_mediaControllerInitFromSession() {
-        mMediaOutputController.start(mCb);
+        mMediaSwitchingController.start(mCb);
 
         verify(mSessionMediaController).registerCallback(any());
     }
@@ -291,7 +290,7 @@
     @Test
     public void start_MediaNotificationFound_mediaControllerNotInitFromSession() {
         when(mNotification.isMediaNotification()).thenReturn(true);
-        mMediaOutputController.start(mCb);
+        mMediaSwitchingController.start(mCb);
 
         verify(mSessionMediaController, never()).registerCallback(any());
         verifyZeroInteractions(mMediaSessionManager);
@@ -299,8 +298,8 @@
 
     @Test
     public void start_withoutPackageName_verifyMediaControllerInit() {
-        mMediaOutputController =
-                new MediaOutputController(
+        mMediaSwitchingController =
+                new MediaSwitchingController(
                         mSpyContext,
                         null,
                         mContext.getUser(),
@@ -318,32 +317,32 @@
                         mVolumePanelGlobalStateInteractor,
                         mUserTracker);
 
-        mMediaOutputController.start(mCb);
+        mMediaSwitchingController.start(mCb);
 
         verify(mSessionMediaController, never()).registerCallback(any());
     }
 
     @Test
     public void start_nearbyMediaDevicesManagerNotNull_registersNearbyDevicesCallback() {
-        mMediaOutputController.start(mCb);
+        mMediaSwitchingController.start(mCb);
 
         verify(mNearbyMediaDevicesManager).registerNearbyDevicesCallback(any());
     }
 
     @Test
     public void stop_withPackageName_verifyMediaControllerDeinit() {
-        mMediaOutputController.start(mCb);
+        mMediaSwitchingController.start(mCb);
         reset(mSessionMediaController);
 
-        mMediaOutputController.stop();
+        mMediaSwitchingController.stop();
 
         verify(mSessionMediaController).unregisterCallback(any());
     }
 
     @Test
     public void stop_withoutPackageName_verifyMediaControllerDeinit() {
-        mMediaOutputController =
-                new MediaOutputController(
+        mMediaSwitchingController =
+                new MediaSwitchingController(
                         mSpyContext,
                         null,
                         mSpyContext.getUser(),
@@ -361,26 +360,26 @@
                         mVolumePanelGlobalStateInteractor,
                         mUserTracker);
 
-        mMediaOutputController.start(mCb);
+        mMediaSwitchingController.start(mCb);
 
-        mMediaOutputController.stop();
+        mMediaSwitchingController.stop();
 
         verify(mSessionMediaController, never()).unregisterCallback(any());
     }
 
     @Test
     public void stop_nearbyMediaDevicesManagerNotNull_unregistersNearbyDevicesCallback() {
-        mMediaOutputController.start(mCb);
+        mMediaSwitchingController.start(mCb);
         reset(mSessionMediaController);
 
-        mMediaOutputController.stop();
+        mMediaSwitchingController.stop();
 
         verify(mNearbyMediaDevicesManager).unregisterNearbyDevicesCallback(any());
     }
 
     @Test
     public void tryToLaunchMediaApplication_nullIntent_skip() {
-        mMediaOutputController.tryToLaunchMediaApplication(mDialogLaunchView);
+        mMediaSwitchingController.tryToLaunchMediaApplication(mDialogLaunchView);
 
         verify(mCb, never()).dismissDialog();
     }
@@ -391,9 +390,9 @@
                 .thenReturn(mController);
         Intent intent = new Intent(mPackageName);
         doReturn(intent).when(mPackageManager).getLaunchIntentForPackage(mPackageName);
-        mMediaOutputController.start(mCallback);
+        mMediaSwitchingController.start(mCallback);
 
-        mMediaOutputController.tryToLaunchMediaApplication(mDialogLaunchView);
+        mMediaSwitchingController.tryToLaunchMediaApplication(mDialogLaunchView);
 
         verify(mStarter).startActivity(any(Intent.class), anyBoolean(),
                 Mockito.eq(mController));
@@ -403,11 +402,12 @@
     public void tryToLaunchInAppRoutingIntent_componentNameNotNull_startActivity() {
         when(mDialogTransitionAnimator.createActivityTransitionController(any(View.class)))
                 .thenReturn(mController);
-        mMediaOutputController.start(mCallback);
+        mMediaSwitchingController.start(mCallback);
         when(mLocalMediaManager.getLinkedItemComponentName()).thenReturn(
                 new ComponentName(mPackageName, ""));
 
-        mMediaOutputController.tryToLaunchInAppRoutingIntent(TEST_DEVICE_1_ID, mDialogLaunchView);
+        mMediaSwitchingController.tryToLaunchInAppRoutingIntent(
+                TEST_DEVICE_1_ID, mDialogLaunchView);
 
         verify(mStarter).startActivity(any(Intent.class), anyBoolean(),
                 Mockito.eq(mController));
@@ -415,9 +415,9 @@
 
     @Test
     public void onDevicesUpdated_unregistersNearbyDevicesCallback() throws RemoteException {
-        mMediaOutputController.start(mCb);
+        mMediaSwitchingController.start(mCb);
 
-        mMediaOutputController.onDevicesUpdated(ImmutableList.of());
+        mMediaSwitchingController.onDevicesUpdated(ImmutableList.of());
 
         verify(mNearbyMediaDevicesManager).unregisterNearbyDevicesCallback(any());
     }
@@ -425,11 +425,11 @@
     @Test
     public void onDeviceListUpdate_withNearbyDevices_updatesRangeInformation()
             throws RemoteException {
-        mMediaOutputController.start(mCb);
+        mMediaSwitchingController.start(mCb);
         reset(mCb);
 
-        mMediaOutputController.onDevicesUpdated(mNearbyDevices);
-        mMediaOutputController.onDeviceListUpdate(mMediaDevices);
+        mMediaSwitchingController.onDevicesUpdated(mNearbyDevices);
+        mMediaSwitchingController.onDeviceListUpdate(mMediaDevices);
 
         verify(mMediaDevice1).setRangeZone(NearbyDevice.RANGE_FAR);
         verify(mMediaDevice2).setRangeZone(NearbyDevice.RANGE_CLOSE);
@@ -438,11 +438,11 @@
     @Test
     public void onDeviceListUpdate_withNearbyDevices_rankByRangeInformation()
             throws RemoteException {
-        mMediaOutputController.start(mCb);
+        mMediaSwitchingController.start(mCb);
         reset(mCb);
 
-        mMediaOutputController.onDevicesUpdated(mNearbyDevices);
-        mMediaOutputController.onDeviceListUpdate(mMediaDevices);
+        mMediaSwitchingController.onDevicesUpdated(mNearbyDevices);
+        mMediaSwitchingController.onDeviceListUpdate(mMediaDevices);
 
         assertThat(mMediaDevices.get(0).getId()).isEqualTo(TEST_DEVICE_1_ID);
     }
@@ -451,11 +451,11 @@
     public void routeProcessSupport_onDeviceListUpdate_preferenceExist_NotUpdatesRangeInformation()
             throws RemoteException {
         when(mLocalMediaManager.isPreferenceRouteListingExist()).thenReturn(true);
-        mMediaOutputController.start(mCb);
+        mMediaSwitchingController.start(mCb);
         reset(mCb);
 
-        mMediaOutputController.onDevicesUpdated(mNearbyDevices);
-        mMediaOutputController.onDeviceListUpdate(mMediaDevices);
+        mMediaSwitchingController.onDevicesUpdated(mNearbyDevices);
+        mMediaSwitchingController.onDeviceListUpdate(mMediaDevices);
 
         verify(mMediaDevice1, never()).setRangeZone(anyInt());
         verify(mMediaDevice2, never()).setRangeZone(anyInt());
@@ -463,7 +463,8 @@
 
     @Test
     public void onDeviceListUpdate_verifyDeviceListCallback() {
-        // This test relies on mMediaOutputController.start being called while the selected device
+        // This test relies on mMediaSwitchingController.start being called while the selected
+        // device
         // list has exactly one item, and that item's id is:
         // - Different from both ids in mMediaDevices.
         // - Different from the id of the route published by the device under test (usually the
@@ -475,12 +476,12 @@
                 .when(mLocalMediaManager)
                 .getSelectedMediaDevice();
 
-        mMediaOutputController.start(mCb);
+        mMediaSwitchingController.start(mCb);
         reset(mCb);
 
-        mMediaOutputController.onDeviceListUpdate(mMediaDevices);
+        mMediaSwitchingController.onDeviceListUpdate(mMediaDevices);
         final List<MediaDevice> devices = new ArrayList<>();
-        for (MediaItem item : mMediaOutputController.getMediaItemList()) {
+        for (MediaItem item : mMediaSwitchingController.getMediaItemList()) {
             if (item.getMediaDevice().isPresent()) {
                 devices.add(item.getMediaDevice().get());
             }
@@ -488,14 +489,15 @@
 
         assertThat(devices.containsAll(mMediaDevices)).isTrue();
         assertThat(devices.size()).isEqualTo(mMediaDevices.size());
-        assertThat(mMediaOutputController.getMediaItemList().size()).isEqualTo(
-                mMediaDevices.size() + 2);
+        assertThat(mMediaSwitchingController.getMediaItemList().size())
+                .isEqualTo(mMediaDevices.size() + 2);
         verify(mCb).onDeviceListChanged();
     }
 
     @Test
     public void advanced_onDeviceListUpdateWithConnectedDeviceRemote_verifyItemSize() {
-        // This test relies on mMediaOutputController.start being called while the selected device
+        // This test relies on mMediaSwitchingController.start being called while the selected
+        // device
         // list has exactly one item, and that item's id is:
         // - Different from both ids in mMediaDevices.
         // - Different from the id of the route published by the device under test (usually the
@@ -510,12 +512,12 @@
         when(mMediaDevice1.getFeatures()).thenReturn(
                 ImmutableList.of(MediaRoute2Info.FEATURE_REMOTE_PLAYBACK));
         when(mLocalMediaManager.getCurrentConnectedDevice()).thenReturn(mMediaDevice1);
-        mMediaOutputController.start(mCb);
+        mMediaSwitchingController.start(mCb);
         reset(mCb);
 
-        mMediaOutputController.onDeviceListUpdate(mMediaDevices);
+        mMediaSwitchingController.onDeviceListUpdate(mMediaDevices);
         final List<MediaDevice> devices = new ArrayList<>();
-        for (MediaItem item : mMediaOutputController.getMediaItemList()) {
+        for (MediaItem item : mMediaSwitchingController.getMediaItemList()) {
             if (item.getMediaDevice().isPresent()) {
                 devices.add(item.getMediaDevice().get());
             }
@@ -523,8 +525,8 @@
 
         assertThat(devices.containsAll(mMediaDevices)).isTrue();
         assertThat(devices.size()).isEqualTo(mMediaDevices.size());
-        assertThat(mMediaOutputController.getMediaItemList().size()).isEqualTo(
-                mMediaDevices.size() + 1);
+        assertThat(mMediaSwitchingController.getMediaItemList().size())
+                .isEqualTo(mMediaDevices.size() + 1);
         verify(mCb).onDeviceListChanged();
     }
 
@@ -533,13 +535,13 @@
         when(mMediaDevice1.isSuggestedDevice()).thenReturn(true);
         when(mMediaDevice2.isSuggestedDevice()).thenReturn(false);
 
-        mMediaOutputController.start(mCb);
+        mMediaSwitchingController.start(mCb);
         reset(mCb);
-        mMediaOutputController.getMediaItemList().clear();
-        mMediaOutputController.onDeviceListUpdate(mMediaDevices);
+        mMediaSwitchingController.getMediaItemList().clear();
+        mMediaSwitchingController.onDeviceListUpdate(mMediaDevices);
         final List<MediaDevice> devices = new ArrayList<>();
         int dividerSize = 0;
-        for (MediaItem item : mMediaOutputController.getMediaItemList()) {
+        for (MediaItem item : mMediaSwitchingController.getMediaItemList()) {
             if (item.getMediaDevice().isPresent()) {
                 devices.add(item.getMediaDevice().get());
             }
@@ -556,33 +558,33 @@
 
     @Test
     public void onDeviceListUpdate_isRefreshing_updatesNeedRefreshToTrue() {
-        mMediaOutputController.start(mCb);
+        mMediaSwitchingController.start(mCb);
         reset(mCb);
-        mMediaOutputController.mIsRefreshing = true;
+        mMediaSwitchingController.mIsRefreshing = true;
 
-        mMediaOutputController.onDeviceListUpdate(mMediaDevices);
+        mMediaSwitchingController.onDeviceListUpdate(mMediaDevices);
 
-        assertThat(mMediaOutputController.mNeedRefresh).isTrue();
+        assertThat(mMediaSwitchingController.mNeedRefresh).isTrue();
     }
 
     @Test
     public void advanced_onDeviceListUpdate_isRefreshing_updatesNeedRefreshToTrue() {
-        mMediaOutputController.start(mCb);
+        mMediaSwitchingController.start(mCb);
         reset(mCb);
-        mMediaOutputController.mIsRefreshing = true;
+        mMediaSwitchingController.mIsRefreshing = true;
 
-        mMediaOutputController.onDeviceListUpdate(mMediaDevices);
+        mMediaSwitchingController.onDeviceListUpdate(mMediaDevices);
 
-        assertThat(mMediaOutputController.mNeedRefresh).isTrue();
+        assertThat(mMediaSwitchingController.mNeedRefresh).isTrue();
     }
 
     @Test
     public void cancelMuteAwaitConnection_cancelsWithMediaManager() {
         when(mAudioManager.getMutingExpectedDevice()).thenReturn(mock(AudioDeviceAttributes.class));
-        mMediaOutputController.start(mCb);
+        mMediaSwitchingController.start(mCb);
         reset(mCb);
 
-        mMediaOutputController.cancelMuteAwaitConnection();
+        mMediaSwitchingController.cancelMuteAwaitConnection();
 
         verify(mAudioManager).cancelMuteAwaitConnection(any());
     }
@@ -590,17 +592,17 @@
     @Test
     public void cancelMuteAwaitConnection_audioManagerIsNull_noAction() {
         when(mAudioManager.getMutingExpectedDevice()).thenReturn(null);
-        mMediaOutputController.start(mCb);
+        mMediaSwitchingController.start(mCb);
         reset(mCb);
-        mMediaOutputController.cancelMuteAwaitConnection();
+        mMediaSwitchingController.cancelMuteAwaitConnection();
 
         verify(mAudioManager, never()).cancelMuteAwaitConnection(any());
     }
 
     @Test
     public void getAppSourceName_packageNameIsNull_returnsNull() {
-        MediaOutputController testMediaOutputController =
-                new MediaOutputController(
+        MediaSwitchingController testMediaSwitchingController =
+                new MediaSwitchingController(
                         mSpyContext,
                         "",
                         mSpyContext.getUser(),
@@ -617,25 +619,25 @@
                         mFlags,
                         mVolumePanelGlobalStateInteractor,
                         mUserTracker);
-        testMediaOutputController.start(mCb);
+        testMediaSwitchingController.start(mCb);
         reset(mCb);
 
-        testMediaOutputController.getAppSourceName();
+        testMediaSwitchingController.getAppSourceName();
 
-        assertThat(testMediaOutputController.getAppSourceName()).isNull();
+        assertThat(testMediaSwitchingController.getAppSourceName()).isNull();
     }
 
     @Test
     public void isActiveItem_deviceNotConnected_returnsFalse() {
         when(mLocalMediaManager.getCurrentConnectedDevice()).thenReturn(mMediaDevice2);
 
-        assertThat(mMediaOutputController.isActiveItem(mMediaDevice1)).isFalse();
+        assertThat(mMediaSwitchingController.isActiveItem(mMediaDevice1)).isFalse();
     }
 
     @Test
     public void getNotificationSmallIcon_packageNameIsNull_returnsNull() {
-        MediaOutputController testMediaOutputController =
-                new MediaOutputController(
+        MediaSwitchingController testMediaSwitchingController =
+                new MediaSwitchingController(
                         mSpyContext,
                         "",
                         mSpyContext.getUser(),
@@ -652,23 +654,23 @@
                         mFlags,
                         mVolumePanelGlobalStateInteractor,
                         mUserTracker);
-        testMediaOutputController.start(mCb);
+        testMediaSwitchingController.start(mCb);
         reset(mCb);
 
-        testMediaOutputController.getAppSourceName();
+        testMediaSwitchingController.getAppSourceName();
 
-        assertThat(testMediaOutputController.getNotificationSmallIcon()).isNull();
+        assertThat(testMediaSwitchingController.getNotificationSmallIcon()).isNull();
     }
 
     @Test
     public void refreshDataSetIfNeeded_needRefreshIsTrue_setsToFalse() {
-        mMediaOutputController.start(mCb);
+        mMediaSwitchingController.start(mCb);
         reset(mCb);
-        mMediaOutputController.mNeedRefresh = true;
+        mMediaSwitchingController.mNeedRefresh = true;
 
-        mMediaOutputController.refreshDataSetIfNeeded();
+        mMediaSwitchingController.refreshDataSetIfNeeded();
 
-        assertThat(mMediaOutputController.mNeedRefresh).isFalse();
+        assertThat(mMediaSwitchingController.mNeedRefresh).isFalse();
     }
 
     @Test
@@ -677,13 +679,13 @@
                 ImmutableList.of(MediaRoute2Info.FEATURE_REMOTE_PLAYBACK));
         when(mLocalMediaManager.getCurrentConnectedDevice()).thenReturn(mMediaDevice1);
 
-        assertThat(mMediaOutputController.isCurrentConnectedDeviceRemote()).isTrue();
+        assertThat(mMediaSwitchingController.isCurrentConnectedDeviceRemote()).isTrue();
     }
 
     @Test
     public void addDeviceToPlayMedia_callsLocalMediaManager() {
-        MediaOutputController testMediaOutputController =
-                new MediaOutputController(
+        MediaSwitchingController testMediaSwitchingController =
+                new MediaSwitchingController(
                         mSpyContext,
                         null,
                         mSpyContext.getUser(),
@@ -702,16 +704,16 @@
                         mUserTracker);
 
         LocalMediaManager mockLocalMediaManager = mock(LocalMediaManager.class);
-        testMediaOutputController.mLocalMediaManager = mockLocalMediaManager;
+        testMediaSwitchingController.mLocalMediaManager = mockLocalMediaManager;
 
-        testMediaOutputController.addDeviceToPlayMedia(mMediaDevice2);
+        testMediaSwitchingController.addDeviceToPlayMedia(mMediaDevice2);
         verify(mockLocalMediaManager).addDeviceToPlayMedia(mMediaDevice2);
     }
 
     @Test
     public void removeDeviceFromPlayMedia_callsLocalMediaManager() {
-        MediaOutputController testMediaOutputController =
-                new MediaOutputController(
+        MediaSwitchingController testMediaSwitchingController =
+                new MediaSwitchingController(
                         mSpyContext,
                         null,
                         mSpyContext.getUser(),
@@ -730,15 +732,15 @@
                         mUserTracker);
 
         LocalMediaManager mockLocalMediaManager = mock(LocalMediaManager.class);
-        testMediaOutputController.mLocalMediaManager = mockLocalMediaManager;
+        testMediaSwitchingController.mLocalMediaManager = mockLocalMediaManager;
 
-        testMediaOutputController.removeDeviceFromPlayMedia(mMediaDevice2);
+        testMediaSwitchingController.removeDeviceFromPlayMedia(mMediaDevice2);
         verify(mockLocalMediaManager).removeDeviceFromPlayMedia(mMediaDevice2);
     }
 
     @Test
     public void getDeselectableMediaDevice_triggersFromLocalMediaManager() {
-        mMediaOutputController.getDeselectableMediaDevice();
+        mMediaSwitchingController.getDeselectableMediaDevice();
 
         verify(mLocalMediaManager).getDeselectableMediaDevice();
     }
@@ -746,108 +748,108 @@
     @Test
     public void adjustSessionVolume_adjustWithoutId_triggersFromLocalMediaManager() {
         int testVolume = 10;
-        mMediaOutputController.adjustSessionVolume(testVolume);
+        mMediaSwitchingController.adjustSessionVolume(testVolume);
 
         verify(mLocalMediaManager).adjustSessionVolume(testVolume);
     }
 
     @Test
     public void logInteractionAdjustVolume_triggersFromMetricLogger() {
-        MediaOutputMetricLogger spyMediaOutputMetricLogger = spy(
-                mMediaOutputController.mMetricLogger);
-        mMediaOutputController.mMetricLogger = spyMediaOutputMetricLogger;
+        MediaOutputMetricLogger spyMediaOutputMetricLogger =
+                spy(mMediaSwitchingController.mMetricLogger);
+        mMediaSwitchingController.mMetricLogger = spyMediaOutputMetricLogger;
 
-        mMediaOutputController.logInteractionAdjustVolume(mMediaDevice1);
+        mMediaSwitchingController.logInteractionAdjustVolume(mMediaDevice1);
 
         verify(spyMediaOutputMetricLogger).logInteractionAdjustVolume(mMediaDevice1);
     }
 
     @Test
     public void getSessionVolumeMax_triggersFromLocalMediaManager() {
-        mMediaOutputController.getSessionVolumeMax();
+        mMediaSwitchingController.getSessionVolumeMax();
 
         verify(mLocalMediaManager).getSessionVolumeMax();
     }
 
     @Test
     public void getSessionVolume_triggersFromLocalMediaManager() {
-        mMediaOutputController.getSessionVolume();
+        mMediaSwitchingController.getSessionVolume();
 
         verify(mLocalMediaManager).getSessionVolume();
     }
 
     @Test
     public void getSessionName_triggersFromLocalMediaManager() {
-        mMediaOutputController.getSessionName();
+        mMediaSwitchingController.getSessionName();
 
         verify(mLocalMediaManager).getSessionName();
     }
 
     @Test
     public void releaseSession_triggersFromLocalMediaManager() {
-        mMediaOutputController.releaseSession();
+        mMediaSwitchingController.releaseSession();
 
         verify(mLocalMediaManager).releaseSession();
     }
 
     @Test
     public void isAnyDeviceTransferring_noDevicesStateIsConnecting_returnsFalse() {
-        mMediaOutputController.start(mCb);
+        mMediaSwitchingController.start(mCb);
         reset(mCb);
 
-        mMediaOutputController.onDeviceListUpdate(mMediaDevices);
+        mMediaSwitchingController.onDeviceListUpdate(mMediaDevices);
 
-        assertThat(mMediaOutputController.isAnyDeviceTransferring()).isFalse();
+        assertThat(mMediaSwitchingController.isAnyDeviceTransferring()).isFalse();
     }
 
     @Test
     public void isAnyDeviceTransferring_deviceStateIsConnecting_returnsTrue() {
         when(mMediaDevice1.getState()).thenReturn(
                 LocalMediaManager.MediaDeviceState.STATE_CONNECTING);
-        mMediaOutputController.start(mCb);
+        mMediaSwitchingController.start(mCb);
         reset(mCb);
 
-        mMediaOutputController.onDeviceListUpdate(mMediaDevices);
+        mMediaSwitchingController.onDeviceListUpdate(mMediaDevices);
 
-        assertThat(mMediaOutputController.isAnyDeviceTransferring()).isTrue();
+        assertThat(mMediaSwitchingController.isAnyDeviceTransferring()).isTrue();
     }
 
     @Test
     public void isAnyDeviceTransferring_advancedLayoutSupport() {
         when(mMediaDevice1.getState()).thenReturn(
                 LocalMediaManager.MediaDeviceState.STATE_CONNECTING);
-        mMediaOutputController.start(mCb);
-        mMediaOutputController.onDeviceListUpdate(mMediaDevices);
+        mMediaSwitchingController.start(mCb);
+        mMediaSwitchingController.onDeviceListUpdate(mMediaDevices);
 
-        assertThat(mMediaOutputController.isAnyDeviceTransferring()).isTrue();
+        assertThat(mMediaSwitchingController.isAnyDeviceTransferring()).isTrue();
     }
 
     @Test
     public void isPlaying_stateIsNull() {
         when(mSessionMediaController.getPlaybackState()).thenReturn(null);
 
-        assertThat(mMediaOutputController.isPlaying()).isFalse();
+        assertThat(mMediaSwitchingController.isPlaying()).isFalse();
     }
 
     @Test
     public void onSelectedDeviceStateChanged_verifyCallback() {
         when(mLocalMediaManager.getCurrentConnectedDevice()).thenReturn(mMediaDevice2);
-        mMediaOutputController.start(mCb);
+        mMediaSwitchingController.start(mCb);
         reset(mCb);
-        mMediaOutputController.connectDevice(mMediaDevice1);
+        mMediaSwitchingController.connectDevice(mMediaDevice1);
 
-        mMediaOutputController.onSelectedDeviceStateChanged(mMediaDevice1,
-                LocalMediaManager.MediaDeviceState.STATE_CONNECTED);
+        mMediaSwitchingController.onSelectedDeviceStateChanged(
+                mMediaDevice1, LocalMediaManager.MediaDeviceState.STATE_CONNECTED);
 
         verify(mCb).onRouteChanged();
     }
 
     @Test
     public void onDeviceAttributesChanged_verifyCallback() {
-        mMediaOutputController.start(mCb);
+        mMediaSwitchingController.start(mCb);
         reset(mCb);
 
-        mMediaOutputController.onDeviceAttributesChanged();
+        mMediaSwitchingController.onDeviceAttributesChanged();
 
         verify(mCb).onRouteChanged();
     }
@@ -855,11 +857,11 @@
     @Test
     public void onRequestFailed_verifyCallback() {
         when(mLocalMediaManager.getCurrentConnectedDevice()).thenReturn(mMediaDevice1);
-        mMediaOutputController.start(mCb);
+        mMediaSwitchingController.start(mCb);
         reset(mCb);
-        mMediaOutputController.connectDevice(mMediaDevice2);
+        mMediaSwitchingController.connectDevice(mMediaDevice2);
 
-        mMediaOutputController.onRequestFailed(0 /* reason */);
+        mMediaSwitchingController.onRequestFailed(0 /* reason */);
 
         verify(mCb, atLeastOnce()).onRouteChanged();
     }
@@ -868,37 +870,40 @@
     public void getHeaderTitle_withoutMetadata_returnDefaultString() {
         when(mSessionMediaController.getMetadata()).thenReturn(null);
 
-        mMediaOutputController.start(mCb);
+        mMediaSwitchingController.start(mCb);
 
-        assertThat(mMediaOutputController.getHeaderTitle()).isEqualTo(
-                mContext.getText(R.string.controls_media_title));
+        assertThat(
+                        mMediaSwitchingController
+                                .getHeaderTitle()
+                                .equals(mContext.getText(R.string.controls_media_title)))
+                .isTrue();
     }
 
     @Test
     public void getHeaderTitle_withMetadata_returnSongName() {
         when(mSessionMediaController.getMetadata()).thenReturn(mMediaMetadata);
 
-        mMediaOutputController.start(mCb);
+        mMediaSwitchingController.start(mCb);
 
-        assertThat(mMediaOutputController.getHeaderTitle()).isEqualTo(TEST_SONG);
+        assertThat(mMediaSwitchingController.getHeaderTitle().equals(TEST_SONG)).isTrue();
     }
 
     @Test
     public void getHeaderSubTitle_withoutMetadata_returnNull() {
         when(mSessionMediaController.getMetadata()).thenReturn(null);
 
-        mMediaOutputController.start(mCb);
+        mMediaSwitchingController.start(mCb);
 
-        assertThat(mMediaOutputController.getHeaderSubTitle()).isNull();
+        assertThat(mMediaSwitchingController.getHeaderSubTitle()).isNull();
     }
 
     @Test
     public void getHeaderSubTitle_withMetadata_returnArtistName() {
         when(mSessionMediaController.getMetadata()).thenReturn(mMediaMetadata);
 
-        mMediaOutputController.start(mCb);
+        mMediaSwitchingController.start(mCb);
 
-        assertThat(mMediaOutputController.getHeaderSubTitle()).isEqualTo(TEST_ARTIST);
+        assertThat(mMediaSwitchingController.getHeaderSubTitle().equals(TEST_ARTIST)).isTrue();
     }
 
     @Test
@@ -911,8 +916,8 @@
         mRoutingSessionInfos.add(mRemoteSessionInfo);
         when(mLocalMediaManager.getRemoteRoutingSessions()).thenReturn(mRoutingSessionInfos);
 
-        assertThat(mMediaOutputController.getActiveRemoteMediaDevices()).containsExactly(
-                mRemoteSessionInfo);
+        assertThat(mMediaSwitchingController.getActiveRemoteMediaDevices())
+                .containsExactly(mRemoteSessionInfo);
     }
 
     @Test
@@ -933,7 +938,8 @@
         selectableMediaDevices.add(selectableMediaDevice2);
         doReturn(selectedMediaDevices).when(mLocalMediaManager).getSelectedMediaDevice();
         doReturn(selectableMediaDevices).when(mLocalMediaManager).getSelectableMediaDevice();
-        final List<MediaDevice> groupMediaDevices = mMediaOutputController.getGroupMediaDevices();
+        final List<MediaDevice> groupMediaDevices =
+                mMediaSwitchingController.getGroupMediaDevices();
         // Reset order
         selectedMediaDevices.clear();
         selectedMediaDevices.add(selectedMediaDevice2);
@@ -941,7 +947,7 @@
         selectableMediaDevices.clear();
         selectableMediaDevices.add(selectableMediaDevice2);
         selectableMediaDevices.add(selectableMediaDevice1);
-        final List<MediaDevice> newDevices = mMediaOutputController.getGroupMediaDevices();
+        final List<MediaDevice> newDevices = mMediaSwitchingController.getGroupMediaDevices();
 
         assertThat(newDevices.size()).isEqualTo(groupMediaDevices.size());
         for (int i = 0; i < groupMediaDevices.size(); i++) {
@@ -970,7 +976,8 @@
         selectableMediaDevices.add(selectableMediaDevice2);
         doReturn(selectedMediaDevices).when(mLocalMediaManager).getSelectedMediaDevice();
         doReturn(selectableMediaDevices).when(mLocalMediaManager).getSelectableMediaDevice();
-        final List<MediaDevice> groupMediaDevices = mMediaOutputController.getGroupMediaDevices();
+        final List<MediaDevice> groupMediaDevices =
+                mMediaSwitchingController.getGroupMediaDevices();
         // Reset order
         selectedMediaDevices.clear();
         selectedMediaDevices.add(selectedMediaDevice2);
@@ -979,7 +986,7 @@
         selectableMediaDevices.add(selectableMediaDevice3);
         selectableMediaDevices.add(selectableMediaDevice2);
         selectableMediaDevices.add(selectableMediaDevice1);
-        final List<MediaDevice> newDevices = mMediaOutputController.getGroupMediaDevices();
+        final List<MediaDevice> newDevices = mMediaSwitchingController.getGroupMediaDevices();
 
         assertThat(newDevices.size()).isEqualTo(5);
         for (int i = 0; i < groupMediaDevices.size(); i++) {
@@ -991,8 +998,8 @@
 
     @Test
     public void getNotificationLargeIcon_withoutPackageName_returnsNull() {
-        mMediaOutputController =
-                new MediaOutputController(
+        mMediaSwitchingController =
+                new MediaSwitchingController(
                         mSpyContext,
                         null,
                         mSpyContext.getUser(),
@@ -1010,7 +1017,7 @@
                         mVolumePanelGlobalStateInteractor,
                         mUserTracker);
 
-        assertThat(mMediaOutputController.getNotificationIcon()).isNull();
+        assertThat(mMediaSwitchingController.getNotificationIcon()).isNull();
     }
 
     @Test
@@ -1028,7 +1035,7 @@
         when(notification.isMediaNotification()).thenReturn(true);
         when(notification.getLargeIcon()).thenReturn(null);
 
-        assertThat(mMediaOutputController.getNotificationIcon()).isNull();
+        assertThat(mMediaSwitchingController.getNotificationIcon()).isNull();
     }
 
     @Test
@@ -1047,7 +1054,7 @@
         when(notification.isMediaNotification()).thenReturn(true);
         when(notification.getLargeIcon()).thenReturn(icon);
 
-        assertThat(mMediaOutputController.getNotificationIcon()).isInstanceOf(IconCompat.class);
+        assertThat(mMediaSwitchingController.getNotificationIcon()).isInstanceOf(IconCompat.class);
     }
 
     @Test
@@ -1066,7 +1073,7 @@
         when(notification.isMediaNotification()).thenReturn(false);
         when(notification.getLargeIcon()).thenReturn(icon);
 
-        assertThat(mMediaOutputController.getNotificationIcon()).isNull();
+        assertThat(mMediaSwitchingController.getNotificationIcon()).isNull();
     }
 
     @Test
@@ -1084,7 +1091,7 @@
         when(notification.isMediaNotification()).thenReturn(true);
         when(notification.getSmallIcon()).thenReturn(null);
 
-        assertThat(mMediaOutputController.getNotificationSmallIcon()).isNull();
+        assertThat(mMediaSwitchingController.getNotificationSmallIcon()).isNull();
     }
 
     @Test
@@ -1103,8 +1110,8 @@
         when(notification.isMediaNotification()).thenReturn(true);
         when(notification.getSmallIcon()).thenReturn(icon);
 
-        assertThat(mMediaOutputController.getNotificationSmallIcon()).isInstanceOf(
-                IconCompat.class);
+        assertThat(mMediaSwitchingController.getNotificationSmallIcon())
+                .isInstanceOf(IconCompat.class);
     }
 
     @Test
@@ -1112,8 +1119,8 @@
         when(mLocalMediaManager.getCurrentConnectedDevice()).thenReturn(mMediaDevice2);
         when(mMediaDevice1.getIcon()).thenReturn(mDrawable);
 
-        assertThat(mMediaOutputController.getDeviceIconCompat(mMediaDevice1)).isInstanceOf(
-                IconCompat.class);
+        assertThat(mMediaSwitchingController.getDeviceIconCompat(mMediaDevice1))
+                .isInstanceOf(IconCompat.class);
     }
 
     @Test
@@ -1121,13 +1128,13 @@
         when(mLocalMediaManager.getCurrentConnectedDevice()).thenReturn(mMediaDevice2);
         when(mMediaDevice1.getIcon()).thenReturn(null);
 
-        assertThat(mMediaOutputController.getDeviceIconCompat(mMediaDevice1)).isInstanceOf(
-                IconCompat.class);
+        assertThat(mMediaSwitchingController.getDeviceIconCompat(mMediaDevice1))
+                .isInstanceOf(IconCompat.class);
     }
 
     @Test
     public void setColorFilter_setColorFilterToDrawable() {
-        mMediaOutputController.setColorFilter(mDrawable, true);
+        mMediaSwitchingController.setColorFilter(mDrawable, true);
 
         verify(mDrawable).setColorFilter(any(PorterDuffColorFilter.class));
     }
@@ -1150,11 +1157,11 @@
         selectableMediaDevices.add(selectableMediaDevice2);
         doReturn(selectedMediaDevices).when(mLocalMediaManager).getSelectedMediaDevice();
         doReturn(selectableMediaDevices).when(mLocalMediaManager).getSelectableMediaDevice();
-        assertThat(mMediaOutputController.getGroupMediaDevices().isEmpty()).isFalse();
+        assertThat(mMediaSwitchingController.getGroupMediaDevices().isEmpty()).isFalse();
 
-        mMediaOutputController.resetGroupMediaDevices();
+        mMediaSwitchingController.resetGroupMediaDevices();
 
-        assertThat(mMediaOutputController.mGroupMediaDevices.isEmpty()).isTrue();
+        assertThat(mMediaSwitchingController.mGroupMediaDevices.isEmpty()).isTrue();
     }
 
     @Test
@@ -1164,7 +1171,7 @@
 
         when(mMediaDevice1.isVolumeFixed()).thenReturn(true);
 
-        assertThat(mMediaOutputController.isVolumeControlEnabled(mMediaDevice1)).isFalse();
+        assertThat(mMediaSwitchingController.isVolumeControlEnabled(mMediaDevice1)).isFalse();
     }
 
     @Test
@@ -1174,7 +1181,7 @@
 
         when(mMediaDevice1.isVolumeFixed()).thenReturn(false);
 
-        assertThat(mMediaOutputController.isVolumeControlEnabled(mMediaDevice1)).isTrue();
+        assertThat(mMediaSwitchingController.isVolumeControlEnabled(mMediaDevice1)).isTrue();
     }
 
     @Test
@@ -1187,7 +1194,7 @@
         when(mMediaDevice2.getDeviceType()).thenReturn(
                 MediaDevice.MediaDeviceType.TYPE_BLUETOOTH_DEVICE);
 
-        mMediaOutputController.setTemporaryAllowListExceptionIfNeeded(mMediaDevice2);
+        mMediaSwitchingController.setTemporaryAllowListExceptionIfNeeded(mMediaDevice2);
 
         verify(mPowerExemptionManager).addToTemporaryAllowList(anyString(), anyInt(), anyString(),
                 anyLong());
@@ -1195,8 +1202,8 @@
 
     @Test
     public void setTemporaryAllowListExceptionIfNeeded_packageNameIsNull_NoAction() {
-        MediaOutputController testMediaOutputController =
-                new MediaOutputController(
+        MediaSwitchingController testMediaSwitchingController =
+                new MediaSwitchingController(
                         mSpyContext,
                         null,
                         mSpyContext.getUser(),
@@ -1214,7 +1221,7 @@
                         mVolumePanelGlobalStateInteractor,
                         mUserTracker);
 
-        testMediaOutputController.setTemporaryAllowListExceptionIfNeeded(mMediaDevice2);
+        testMediaSwitchingController.setTemporaryAllowListExceptionIfNeeded(mMediaDevice2);
 
         verify(mPowerExemptionManager, never()).addToTemporaryAllowList(anyString(), anyInt(),
                 anyString(),
@@ -1223,22 +1230,22 @@
 
     @Test
     public void onMetadataChanged_triggersOnMetadataChanged() {
-        mMediaOutputController.mCallback = this.mCallback;
+        mMediaSwitchingController.mCallback = this.mCallback;
 
-        mMediaOutputController.mCb.onMetadataChanged(mMediaMetadata);
+        mMediaSwitchingController.mCb.onMetadataChanged(mMediaMetadata);
 
-        verify(mMediaOutputController.mCallback).onMediaChanged();
+        verify(mMediaSwitchingController.mCallback).onMediaChanged();
     }
 
     @Test
     public void onPlaybackStateChanged_updateWithNullState_onMediaStoppedOrPaused() {
         when(mPlaybackState.getState()).thenReturn(PlaybackState.STATE_PLAYING);
-        mMediaOutputController.mCallback = this.mCallback;
-        mMediaOutputController.start(mCb);
+        mMediaSwitchingController.mCallback = this.mCallback;
+        mMediaSwitchingController.start(mCb);
 
-        mMediaOutputController.mCb.onPlaybackStateChanged(null);
+        mMediaSwitchingController.mCb.onPlaybackStateChanged(null);
 
-        verify(mMediaOutputController.mCallback).onMediaStoppedOrPaused();
+        verify(mMediaSwitchingController.mCallback).onMediaStoppedOrPaused();
     }
 
     @Test
@@ -1246,9 +1253,9 @@
         when(mDialogTransitionAnimator.createActivityTransitionController(mDialogLaunchView))
                 .thenReturn(mActivityTransitionAnimatorController);
         when(mKeyguardManager.isKeyguardLocked()).thenReturn(true);
-        mMediaOutputController.mCallback = this.mCallback;
+        mMediaSwitchingController.mCallback = this.mCallback;
 
-        mMediaOutputController.launchBluetoothPairing(mDialogLaunchView);
+        mMediaSwitchingController.launchBluetoothPairing(mDialogLaunchView);
 
         verify(mCallback).dismissDialog();
     }