diff --git a/res/xml/bluetooth_le_audio_sharing.xml b/res/xml/bluetooth_le_audio_sharing.xml index 8ba6c077c7a..85a6468382e 100644 --- a/res/xml/bluetooth_le_audio_sharing.xml +++ b/res/xml/bluetooth_le_audio_sharing.xml @@ -34,7 +34,7 @@ android:key="calls_and_alarms" android:summary="" android:title="@string/audio_sharing_call_audio_title" - settings:controller="com.android.settings.connecteddevice.audiosharing.CallsAndAlarmsPreferenceController" /> + settings:controller="com.android.settings.connecteddevice.audiosharing.AudioSharingCallAudioPreferenceController" /> = 1) { - CallsAndAlarmsDialogFragment.show( + AudioSharingCallAudioDialogFragment.show( mFragment, mDeviceItemsInSharingSession, (AudioSharingDeviceItem item) -> { - if (!mGroupedConnectedDevices.containsKey( - item.getGroupId())) { - return; - } List devices = - mGroupedConnectedDevices.get(item.getGroupId()); + mGroupedConnectedDevices.getOrDefault( + item.getGroupId(), ImmutableList.of()); @Nullable CachedBluetoothDevice lead = AudioSharingUtils.getLeadDevice(devices); diff --git a/src/com/android/settings/connecteddevice/audiosharing/AudioSharingDashboardFragment.java b/src/com/android/settings/connecteddevice/audiosharing/AudioSharingDashboardFragment.java index 275d1976086..c3248c7e573 100644 --- a/src/com/android/settings/connecteddevice/audiosharing/AudioSharingDashboardFragment.java +++ b/src/com/android/settings/connecteddevice/audiosharing/AudioSharingDashboardFragment.java @@ -33,7 +33,7 @@ public class AudioSharingDashboardFragment extends DashboardFragment SettingsMainSwitchBar mMainSwitchBar; private AudioSharingSwitchBarController mSwitchBarController; private AudioSharingDeviceVolumeGroupController mAudioSharingDeviceVolumeGroupController; - private CallsAndAlarmsPreferenceController mCallsAndAlarmsPreferenceController; + private AudioSharingCallAudioPreferenceController mAudioSharingCallAudioPreferenceController; private AudioSharingPlaySoundPreferenceController mAudioSharingPlaySoundPreferenceController; private AudioStreamsCategoryController mAudioStreamsCategoryController; @@ -67,8 +67,9 @@ public class AudioSharingDashboardFragment extends DashboardFragment mAudioSharingDeviceVolumeGroupController = use(AudioSharingDeviceVolumeGroupController.class); mAudioSharingDeviceVolumeGroupController.init(this); - mCallsAndAlarmsPreferenceController = use(CallsAndAlarmsPreferenceController.class); - mCallsAndAlarmsPreferenceController.init(this); + mAudioSharingCallAudioPreferenceController = + use(AudioSharingCallAudioPreferenceController.class); + mAudioSharingCallAudioPreferenceController.init(this); mAudioSharingPlaySoundPreferenceController = use(AudioSharingPlaySoundPreferenceController.class); mAudioStreamsCategoryController = use(AudioStreamsCategoryController.class); @@ -100,7 +101,7 @@ public class AudioSharingDashboardFragment extends DashboardFragment private void updateVisibilityForAttachedPreferences() { mAudioSharingDeviceVolumeGroupController.updateVisibility(); - mCallsAndAlarmsPreferenceController.updateVisibility(); + mAudioSharingCallAudioPreferenceController.updateVisibility(); mAudioSharingPlaySoundPreferenceController.updateVisibility(); mAudioStreamsCategoryController.updateVisibility(); } diff --git a/tests/robotests/src/com/android/settings/connecteddevice/audiosharing/CallsAndAlarmsDialogFragmentTest.java b/tests/robotests/src/com/android/settings/connecteddevice/audiosharing/AudioSharingCallAudioDialogFragmentTest.java similarity index 95% rename from tests/robotests/src/com/android/settings/connecteddevice/audiosharing/CallsAndAlarmsDialogFragmentTest.java rename to tests/robotests/src/com/android/settings/connecteddevice/audiosharing/AudioSharingCallAudioDialogFragmentTest.java index 53e0d71c5d6..4477fa3bff2 100644 --- a/tests/robotests/src/com/android/settings/connecteddevice/audiosharing/CallsAndAlarmsDialogFragmentTest.java +++ b/tests/robotests/src/com/android/settings/connecteddevice/audiosharing/AudioSharingCallAudioDialogFragmentTest.java @@ -51,7 +51,7 @@ import java.util.ArrayList; ShadowAlertDialogCompat.class, ShadowBluetoothAdapter.class, }) -public class CallsAndAlarmsDialogFragmentTest { +public class AudioSharingCallAudioDialogFragmentTest { @Rule public final MockitoRule mocks = MockitoJUnit.rule(); @Rule public final SetFlagsRule mSetFlagsRule = new SetFlagsRule(); @@ -64,7 +64,7 @@ public class CallsAndAlarmsDialogFragmentTest { new AudioSharingDeviceItem(TEST_DEVICE_NAME2, /* groupId= */ 1, /* isActive= */ true); private Fragment mParent; - private CallsAndAlarmsDialogFragment mFragment; + private AudioSharingCallAudioDialogFragment mFragment; private ShadowBluetoothAdapter mShadowBluetoothAdapter; @Before @@ -76,7 +76,7 @@ public class CallsAndAlarmsDialogFragmentTest { BluetoothStatusCodes.FEATURE_SUPPORTED); mShadowBluetoothAdapter.setIsLeAudioBroadcastAssistantSupported( BluetoothStatusCodes.FEATURE_SUPPORTED); - mFragment = new CallsAndAlarmsDialogFragment(); + mFragment = new AudioSharingCallAudioDialogFragment(); mParent = new Fragment(); FragmentController.setupFragment( mParent, FragmentActivity.class, /* containerViewId= */ 0, /* bundle= */ null); diff --git a/tests/robotests/src/com/android/settings/connecteddevice/audiosharing/CallsAndAlarmsPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/connecteddevice/audiosharing/AudioSharingCallAudioPreferenceControllerTest.java similarity index 98% rename from tests/robotests/src/com/android/settings/connecteddevice/audiosharing/CallsAndAlarmsPreferenceControllerTest.java rename to tests/robotests/src/com/android/settings/connecteddevice/audiosharing/AudioSharingCallAudioPreferenceControllerTest.java index 614cb5ba3b9..bdfc71fed0e 100644 --- a/tests/robotests/src/com/android/settings/connecteddevice/audiosharing/CallsAndAlarmsPreferenceControllerTest.java +++ b/tests/robotests/src/com/android/settings/connecteddevice/audiosharing/AudioSharingCallAudioPreferenceControllerTest.java @@ -88,7 +88,7 @@ import java.util.List; ShadowBluetoothUtils.class, ShadowThreadUtils.class, }) -public class CallsAndAlarmsPreferenceControllerTest { +public class AudioSharingCallAudioPreferenceControllerTest { private static final String PREF_KEY = "calls_and_alarms"; private static final String TEST_DEVICE_NAME1 = "test1"; private static final String TEST_DEVICE_NAME2 = "test2"; @@ -118,7 +118,7 @@ public class CallsAndAlarmsPreferenceControllerTest { @Mock private CachedBluetoothDevice mCachedDevice3; @Mock private BluetoothLeBroadcastReceiveState mState; @Mock private ContentResolver mContentResolver; - private CallsAndAlarmsPreferenceController mController; + private AudioSharingCallAudioPreferenceController mController; @Spy private ContentObserver mContentObserver; private ShadowBluetoothAdapter mShadowBluetoothAdapter; private LocalBluetoothManager mBtManager; @@ -151,7 +151,7 @@ public class CallsAndAlarmsPreferenceControllerTest { bisSyncState.add(1L); when(mState.getBisSyncState()).thenReturn(bisSyncState); when(mContext.getContentResolver()).thenReturn(mContentResolver); - mController = new CallsAndAlarmsPreferenceController(mContext); + mController = new AudioSharingCallAudioPreferenceController(mContext); mController.init(null); mContentObserver = mController.getSettingsObserver(); mPreference = new Preference(mContext);