Update output switch UI

This CL include following update:

1. Add onDeviceAttributesChanged() callback to update UI
   when device attributes are changed.
2. Fix the top device when user press device to transfer.
3. Update UI when device is on goning call state and receive
   STREAM_DEVICES_CHANGED_ACTION intent.

Bug: 144535188
Test: make -j42 RunSettingsRoboTests
Change-Id: Idd5fb95054db30f8184faf4f6ab75d0b550907a1
This commit is contained in:
hughchen
2020-01-08 19:38:40 +08:00
parent d0811849ec
commit c770c9133a
4 changed files with 71 additions and 11 deletions

View File

@@ -64,7 +64,6 @@ import java.util.List;
@Config(shadows = {ShadowBluetoothAdapter.class})
public class MediaOutputSliceTest {
private static final String TEST_PACKAGE_NAME = "com.fake.android.music";
private static final String TEST_DEVICE_1_ID = "test_device_1_id";
private static final String TEST_DEVICE_1_NAME = "test_device_1_name";
private static final int TEST_DEVICE_1_ICON =
@@ -100,12 +99,12 @@ public class MediaOutputSliceTest {
mMediaDeviceUpdateWorker = new MediaDeviceUpdateWorker(mContext, MEDIA_OUTPUT_SLICE_URI);
mMediaDeviceUpdateWorker.onDeviceListUpdate(mDevices);
mMediaDeviceUpdateWorker.mLocalMediaManager = mLocalMediaManager;
mMediaOutputSlice.init(TEST_PACKAGE_NAME, mMediaDeviceUpdateWorker);
mMediaOutputSlice.init(mMediaDeviceUpdateWorker);
}
@Test
public void getSlice_workerIsNull_shouldReturnZeroRow() {
mMediaOutputSlice.init(TEST_PACKAGE_NAME, null);
mMediaOutputSlice.init(null);
final Slice slice = mMediaOutputSlice.getSlice();