use of android.media.RoutingSessionInfo in project android_packages_apps_Settings by omnirom.
the class RemoteMediaSlice method onNotifyChange.
@Override
public void onNotifyChange(Intent intent) {
final int newPosition = intent.getIntExtra(EXTRA_RANGE_VALUE, -1);
final String id = intent.getStringExtra(MEDIA_ID);
if (!TextUtils.isEmpty(id)) {
getWorker().adjustSessionVolume(id, newPosition);
return;
}
if (TextUtils.equals(ACTION_LAUNCH_DIALOG, intent.getStringExtra(CUSTOMIZED_ACTION))) {
// Launch Media Output Dialog
final RoutingSessionInfo info = intent.getParcelableExtra(SESSION_INFO);
mContext.sendBroadcast(new Intent().setPackage(MediaOutputConstants.SYSTEMUI_PACKAGE_NAME).setAction(MediaOutputConstants.ACTION_LAUNCH_MEDIA_OUTPUT_DIALOG).putExtra(MediaOutputConstants.EXTRA_PACKAGE_NAME, info.getClientPackageName()));
// Dismiss volume panel
mContext.sendBroadcast(new Intent().setPackage(MediaOutputConstants.SETTINGS_PACKAGE_NAME).setAction(MediaOutputConstants.ACTION_CLOSE_PANEL));
}
}
use of android.media.RoutingSessionInfo in project android_packages_apps_Settings by omnirom.
the class RemoteVolumeGroupControllerTest method setUp.
@Before
public void setUp() {
MockitoAnnotations.initMocks(this);
mContext = spy(RuntimeEnvironment.application);
doReturn(mMediaSessionManager).when(mContext).getSystemService(Context.MEDIA_SESSION_SERVICE);
mController = new RemoteVolumeGroupController(mContext, KEY_REMOTE_VOLUME_GROUP);
mController.mLocalMediaManager = mLocalMediaManager;
mController.mRouterManager = mock(MediaRouter2Manager.class);
mPreferenceCategory = spy(new PreferenceCategory(mContext));
mPreferenceCategory.setKey(mController.getPreferenceKey());
when(mPreferenceCategory.getPreferenceManager()).thenReturn(mPreferenceManager);
when(mPreferenceManager.getSharedPreferences()).thenReturn(mSharedPreferences);
when(mScreen.findPreference(mController.getPreferenceKey())).thenReturn(mPreferenceCategory);
final RoutingSessionInfo remoteSessionInfo = mock(RoutingSessionInfo.class);
when(remoteSessionInfo.getId()).thenReturn(TEST_SESSION_1_ID);
when(remoteSessionInfo.getName()).thenReturn(TEST_SESSION_1_NAME);
when(remoteSessionInfo.getVolumeMax()).thenReturn(MAX_VOLUME);
when(remoteSessionInfo.getVolume()).thenReturn(CURRENT_VOLUME);
when(remoteSessionInfo.getClientPackageName()).thenReturn(TEST_PACKAGE_NAME);
when(remoteSessionInfo.isSystemSession()).thenReturn(false);
mRoutingSessionInfos.add(remoteSessionInfo);
when(mLocalMediaManager.getActiveMediaSession()).thenReturn(mRoutingSessionInfos);
}
Aggregations