use of android.media.MediaRouter.RouteInfo in project robolectric by robolectric.
the class ShadowMediaRouterTest method testSelectBluetoothRoute_getsSetAsSelectedRoute.
@Test
public void testSelectBluetoothRoute_getsSetAsSelectedRoute() {
// Although this isn't something faked out by the shadow we should ensure that the Bluetooth
// route can be selected after it's been added.
shadowOf(mediaRouter).addBluetoothRoute();
RouteInfo bluetoothRoute = mediaRouter.getRouteAt(1);
mediaRouter.selectRoute(ROUTE_TYPE_LIVE_AUDIO, bluetoothRoute);
assertThat(mediaRouter.getSelectedRoute(ROUTE_TYPE_LIVE_AUDIO)).isEqualTo(bluetoothRoute);
}
use of android.media.MediaRouter.RouteInfo in project robolectric by robolectric.
the class ShadowMediaRouterTest method testAddBluetoothRoute_checkBluetoothRouteProperties_apiJbMr2.
@Test
@Config(minSdk = JELLY_BEAN_MR2)
public void testAddBluetoothRoute_checkBluetoothRouteProperties_apiJbMr2() {
shadowOf(mediaRouter).addBluetoothRoute();
RouteInfo bluetoothRoute = mediaRouter.getRouteAt(1);
assertThat(bluetoothRoute.getDescription().toString()).isEqualTo("Bluetooth audio");
}
use of android.media.MediaRouter.RouteInfo in project robolectric by robolectric.
the class ShadowMediaRouterTest method testIsBluetoothRouteSelected_bluetoothRouteSelectedForDifferentType_returnsFalse.
@Test
@Config(minSdk = JELLY_BEAN_MR1)
public void testIsBluetoothRouteSelected_bluetoothRouteSelectedForDifferentType_returnsFalse() {
shadowOf(mediaRouter).addBluetoothRoute();
RouteInfo bluetoothRoute = mediaRouter.getRouteAt(1);
// Select the Bluetooth route for AUDIO and the default route for AUDIO.
mediaRouter.selectRoute(ROUTE_TYPE_LIVE_AUDIO, bluetoothRoute);
mediaRouter.selectRoute(ROUTE_TYPE_LIVE_VIDEO, getDefaultRoute());
assertThat(shadowOf(mediaRouter).isBluetoothRouteSelected(ROUTE_TYPE_LIVE_VIDEO)).isFalse();
}
use of android.media.MediaRouter.RouteInfo in project android_frameworks_base by ParanoidAndroid.
the class MediaRouteButton method updateRemoteIndicator.
void updateRemoteIndicator() {
final RouteInfo selected = mRouter.getSelectedRoute(mRouteTypes);
final boolean isRemote = selected != mRouter.getDefaultRoute();
final boolean isConnecting = selected != null && selected.getStatusCode() == RouteInfo.STATUS_CONNECTING;
boolean needsRefresh = false;
if (mRemoteActive != isRemote) {
mRemoteActive = isRemote;
needsRefresh = true;
}
if (mIsConnecting != isConnecting) {
mIsConnecting = isConnecting;
needsRefresh = true;
}
if (needsRefresh) {
refreshDrawableState();
}
}
use of android.media.MediaRouter.RouteInfo in project android_frameworks_base by AOSPA.
the class CastControllerImpl method startCasting.
@Override
public void startCasting(CastDevice device) {
if (device == null || device.tag == null)
return;
final RouteInfo route = (RouteInfo) device.tag;
if (DEBUG)
Log.d(TAG, "startCasting: " + routeToString(route));
mMediaRouter.selectRoute(ROUTE_TYPE_REMOTE_DISPLAY, route);
}
Aggregations