Merge "Add getSelectedMediaDevice() API for output switcher"
This commit is contained in:
@@ -192,6 +192,34 @@ public class InfoMediaManager extends MediaManager {
|
||||
return deviceList;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the MediaDevice list that has been selected to current media.
|
||||
*
|
||||
* @return list of MediaDevice
|
||||
*/
|
||||
List<MediaDevice> getSelectedMediaDevice() {
|
||||
final List<MediaDevice> deviceList = new ArrayList<>();
|
||||
if (TextUtils.isEmpty(mPackageName)) {
|
||||
Log.w(TAG, "getSelectedMediaDevice() package name is null or empty!");
|
||||
return deviceList;
|
||||
}
|
||||
|
||||
final RoutingSessionInfo info = getRoutingSessionInfo();
|
||||
if (info != null) {
|
||||
for (MediaRoute2Info route : mRouterManager.getControllerForSession(info)
|
||||
.getSelectedRoutes()) {
|
||||
deviceList.add(new InfoMediaDevice(mContext, mRouterManager,
|
||||
route, mPackageName));
|
||||
}
|
||||
return deviceList;
|
||||
}
|
||||
|
||||
Log.w(TAG, "getSelectedMediaDevice() cannot found selectable MediaDevice from : "
|
||||
+ mPackageName);
|
||||
|
||||
return deviceList;
|
||||
}
|
||||
|
||||
/**
|
||||
* Adjust the volume of {@link android.media.RoutingSessionInfo}.
|
||||
*
|
||||
|
||||
@@ -281,6 +281,15 @@ public class LocalMediaManager implements BluetoothCallback {
|
||||
return mInfoMediaManager.getSelectableMediaDevice();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the MediaDevice list that has been selected to current media.
|
||||
*
|
||||
* @return list of MediaDevice
|
||||
*/
|
||||
public List<MediaDevice> getSelectedMediaDevice() {
|
||||
return mInfoMediaManager.getSelectedMediaDevice();
|
||||
}
|
||||
|
||||
/**
|
||||
* Adjust the volume of session.
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user