Update OutputSwitcher from MediaOutputSlice to MediaOutputDialog in Settings

-Update entry point at media indicator in volume panel
-Update entry point at remote media slice in volume panel
-Update entry point at remote volume group in Sound Settings
-Update entry point at media output preference in Sound Settings
-Hide Media output dialog when the caller is not active

Bug: 155822415
Test: make -j50 RunSettingsRoboTests
Merged-In: Ib6c86067522925c439f336644e4d027dbae3379c
Change-Id: Ib6c86067522925c439f336644e4d027dbae3379c
This commit is contained in:
timhypeng
2020-09-26 15:43:11 +08:00
committed by tim peng
parent 6afe358556
commit 7127fff467
7 changed files with 83 additions and 39 deletions

View File

@@ -208,12 +208,14 @@ public class MediaOutputIndicatorSliceTest {
when(mMediaController.getPackageName()).thenReturn(TEST_PACKAGE_NAME);
doReturn(mMediaController).when(sMediaOutputIndicatorWorker)
.getActiveLocalMediaController();
final Intent intent = mMediaOutputIndicatorSlice.getMediaOutputSliceIntent();
final Intent intent = mMediaOutputIndicatorSlice.getMediaOutputDialogIntent();
assertThat(TextUtils.equals(TEST_PACKAGE_NAME, intent.getStringExtra(
MediaOutputSliceConstants.EXTRA_PACKAGE_NAME))).isTrue();
assertThat(MediaOutputSliceConstants.ACTION_MEDIA_OUTPUT).isEqualTo(intent.getAction());
assertThat(TextUtils.equals(Utils.SETTINGS_PACKAGE_NAME, intent.getPackage())).isTrue();
assertThat(MediaOutputSliceConstants.ACTION_LAUNCH_MEDIA_OUTPUT_DIALOG).isEqualTo(
intent.getAction());
assertThat(TextUtils.equals(MediaOutputSliceConstants.SYSTEMUI_PACKAGE_NAME,
intent.getPackage())).isTrue();
assertThat(mToken == intent.getExtras().getParcelable(
MediaOutputSliceConstants.KEY_MEDIA_SESSION_TOKEN)).isTrue();
}
@@ -222,12 +224,14 @@ public class MediaOutputIndicatorSliceTest {
public void getMediaOutputSliceIntent_withoutActiveLocalMedia_verifyIntentExtra() {
doReturn(mMediaController).when(sMediaOutputIndicatorWorker)
.getActiveLocalMediaController();
final Intent intent = mMediaOutputIndicatorSlice.getMediaOutputSliceIntent();
final Intent intent = mMediaOutputIndicatorSlice.getMediaOutputDialogIntent();
assertThat(TextUtils.isEmpty(intent.getStringExtra(
MediaOutputSliceConstants.EXTRA_PACKAGE_NAME))).isTrue();
assertThat(MediaOutputSliceConstants.ACTION_MEDIA_OUTPUT).isEqualTo(intent.getAction());
assertThat(TextUtils.equals(Utils.SETTINGS_PACKAGE_NAME, intent.getPackage())).isTrue();
assertThat(MediaOutputSliceConstants.ACTION_LAUNCH_MEDIA_OUTPUT_DIALOG).isEqualTo(
intent.getAction());
assertThat(TextUtils.equals(MediaOutputSliceConstants.SYSTEMUI_PACKAGE_NAME,
intent.getPackage())).isTrue();
assertThat(intent.getExtras().getParcelable(
MediaOutputSliceConstants.KEY_MEDIA_SESSION_TOKEN) == null).isTrue();
}

View File

@@ -299,9 +299,9 @@ public class MediaOutputPreferenceControllerTest {
mPreference.setKey(TEST_KEY);
mController.handlePreferenceTreeClick(mPreference);
verify(mContext).startActivity(intentCaptor.capture());
verify(mContext).sendBroadcast(intentCaptor.capture());
assertThat(intentCaptor.getValue().getAction())
.isEqualTo(MediaOutputSliceConstants.ACTION_MEDIA_OUTPUT);
.isEqualTo(MediaOutputSliceConstants.ACTION_LAUNCH_MEDIA_OUTPUT_DIALOG);
}
/**