Remove duplicate routing logic from Settings app
Also, remove unused MediaRouter2Manager references. This is a non-functional change. Bug: 192657812 Test: Presubmit Change-Id: I72f5f40e157cea922ad40a2602fba881572fb708
This commit is contained in:
@@ -40,7 +40,6 @@ import com.android.settingslib.media.LocalMediaManager;
|
||||
import com.android.settingslib.media.MediaDevice;
|
||||
import com.android.settingslib.utils.ThreadUtils;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.CopyOnWriteArrayList;
|
||||
@@ -224,18 +223,8 @@ public class MediaDeviceUpdateWorker extends SliceBackgroundWorker
|
||||
return mLocalMediaManager.getSessionName();
|
||||
}
|
||||
|
||||
List<RoutingSessionInfo> getActiveRemoteMediaDevice() {
|
||||
final List<RoutingSessionInfo> sessionInfos = new ArrayList<>();
|
||||
for (RoutingSessionInfo info : mLocalMediaManager.getActiveMediaSession()) {
|
||||
if (!info.isSystemSession()) {
|
||||
if (DEBUG) {
|
||||
Log.d(TAG, "getActiveRemoteMediaDevice() info : " + info.toString()
|
||||
+ ", package name : " + info.getClientPackageName());
|
||||
}
|
||||
sessionInfos.add(info);
|
||||
}
|
||||
}
|
||||
return sessionInfos;
|
||||
List<RoutingSessionInfo> getActiveRemoteMediaDevices() {
|
||||
return mLocalMediaManager.getRemoteRoutingSessions();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -100,8 +100,9 @@ public class RemoteMediaSlice implements CustomSliceable {
|
||||
Log.e(TAG, "Unable to get the slice worker.");
|
||||
return listBuilder.build();
|
||||
}
|
||||
|
||||
// Only displaying remote devices
|
||||
final List<RoutingSessionInfo> infos = getWorker().getActiveRemoteMediaDevice();
|
||||
final List<RoutingSessionInfo> infos = getWorker().getActiveRemoteMediaDevices();
|
||||
if (infos.isEmpty()) {
|
||||
Log.d(TAG, "No active remote media device");
|
||||
return listBuilder.build();
|
||||
|
@@ -54,7 +54,7 @@ public class RemoteVolumeGroupController extends BasePreferenceController implem
|
||||
static final String SWITCHER_PREFIX = "OUTPUT_SWITCHER";
|
||||
|
||||
private PreferenceCategory mPreferenceCategory;
|
||||
private List<RoutingSessionInfo> mRoutingSessionInfos = new ArrayList<>();
|
||||
private final List<RoutingSessionInfo> mRoutingSessionInfos = new ArrayList<>();
|
||||
|
||||
@VisibleForTesting
|
||||
LocalMediaManager mLocalMediaManager;
|
||||
@@ -89,11 +89,7 @@ public class RemoteVolumeGroupController extends BasePreferenceController implem
|
||||
|
||||
private void initRemoteMediaSession() {
|
||||
mRoutingSessionInfos.clear();
|
||||
for (RoutingSessionInfo info : mLocalMediaManager.getActiveMediaSession()) {
|
||||
if (!info.isSystemSession()) {
|
||||
mRoutingSessionInfos.add(info);
|
||||
}
|
||||
}
|
||||
mRoutingSessionInfos.addAll(mLocalMediaManager.getRemoteRoutingSessions());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
Reference in New Issue
Block a user