use of android.media.MediaRouter.RouteInfo in project android_frameworks_base by AOSPA.
the class CastControllerImpl method getCastDevices.
@Override
public Set<CastDevice> getCastDevices() {
final ArraySet<CastDevice> devices = new ArraySet<CastDevice>();
synchronized (mProjectionLock) {
if (mProjection != null) {
final CastDevice device = new CastDevice();
device.id = mProjection.getPackageName();
device.name = getAppName(mProjection.getPackageName());
device.description = mContext.getString(R.string.quick_settings_casting);
device.state = CastDevice.STATE_CONNECTED;
device.tag = mProjection;
devices.add(device);
return devices;
}
}
synchronized (mRoutes) {
for (RouteInfo route : mRoutes.values()) {
final CastDevice device = new CastDevice();
device.id = route.getTag().toString();
final CharSequence name = route.getName(mContext);
device.name = name != null ? name.toString() : null;
final CharSequence description = route.getDescription();
device.description = description != null ? description.toString() : null;
device.state = route.isConnecting() ? CastDevice.STATE_CONNECTING : route.isSelected() ? CastDevice.STATE_CONNECTED : CastDevice.STATE_DISCONNECTED;
device.tag = route;
devices.add(device);
}
}
return devices;
}
use of android.media.MediaRouter.RouteInfo in project android_frameworks_base by ResurrectionRemix.
the class CastControllerImpl method updateRemoteDisplays.
private void updateRemoteDisplays() {
synchronized (mRoutes) {
mRoutes.clear();
final int n = mMediaRouter.getRouteCount();
for (int i = 0; i < n; i++) {
final RouteInfo route = mMediaRouter.getRouteAt(i);
if (!route.isEnabled())
continue;
if (!route.matchesTypes(ROUTE_TYPE_REMOTE_DISPLAY))
continue;
ensureTagExists(route);
mRoutes.put(route.getTag().toString(), route);
}
final RouteInfo selected = mMediaRouter.getSelectedRoute(ROUTE_TYPE_REMOTE_DISPLAY);
if (selected != null && !selected.isDefault()) {
ensureTagExists(selected);
mRoutes.put(selected.getTag().toString(), selected);
}
}
fireOnCastDevicesChanged();
}
use of android.media.MediaRouter.RouteInfo in project android_frameworks_base by ResurrectionRemix.
the class CastControllerImpl method startCasting.
@Override
public void startCasting(CastDevice device) {
if (device == null || !(device.tag instanceof RouteInfo))
return;
final RouteInfo route = (RouteInfo) device.tag;
if (DEBUG)
Log.d(TAG, "startCasting: " + routeToString(route));
mMediaRouter.selectRoute(ROUTE_TYPE_REMOTE_DISPLAY, route);
}
use of android.media.MediaRouter.RouteInfo in project android_frameworks_base by crdroidandroid.
the class CastControllerImpl method getCastDevices.
@Override
public Set<CastDevice> getCastDevices() {
final ArraySet<CastDevice> devices = new ArraySet<CastDevice>();
synchronized (mProjectionLock) {
if (mProjection != null) {
final CastDevice device = new CastDevice();
device.id = mProjection.getPackageName();
device.name = getAppName(mProjection.getPackageName());
device.description = mContext.getString(R.string.quick_settings_casting);
device.state = CastDevice.STATE_CONNECTED;
device.tag = mProjection;
devices.add(device);
return devices;
}
}
synchronized (mRoutes) {
for (RouteInfo route : mRoutes.values()) {
final CastDevice device = new CastDevice();
device.id = route.getTag().toString();
final CharSequence name = route.getName(mContext);
device.name = name != null ? name.toString() : null;
final CharSequence description = route.getDescription();
device.description = description != null ? description.toString() : null;
device.state = route.isConnecting() ? CastDevice.STATE_CONNECTING : route.isSelected() ? CastDevice.STATE_CONNECTED : CastDevice.STATE_DISCONNECTED;
device.tag = route;
devices.add(device);
}
}
return devices;
}
use of android.media.MediaRouter.RouteInfo in project android_frameworks_base by crdroidandroid.
the class CastControllerImpl method startCasting.
@Override
public void startCasting(CastDevice device) {
if (device == null || !(device.tag instanceof RouteInfo))
return;
final RouteInfo route = (RouteInfo) device.tag;
if (DEBUG)
Log.d(TAG, "startCasting: " + routeToString(route));
mMediaRouter.selectRoute(ROUTE_TYPE_REMOTE_DISPLAY, route);
}
Aggregations