Loading packages/SettingsLib/src/com/android/settingslib/bluetooth/BluetoothUtils.java +2 −0 Original line number Diff line number Diff line Loading @@ -311,6 +311,8 @@ public class BluetoothUtils { } catch (SecurityException e) { Log.e(TAG, "Failed to get permission for: " + iconUri, e); } } else { return new Pair<>(context.getDrawable(R.drawable.ic_earbuds_advanced), pair.second); } } Loading packages/SettingsLib/tests/robotests/src/com/android/settingslib/bluetooth/BluetoothUtilsTest.java +17 −0 Original line number Diff line number Diff line Loading @@ -233,6 +233,23 @@ public class BluetoothUtilsTest { .isInstanceOf(AdaptiveIcon.class); } @Test public void getBtDrawableWithDescription_untetheredHeadset_returnUntetheredIcon() { when(mBluetoothDevice.getMetadata(BluetoothDevice.METADATA_IS_UNTETHERED_HEADSET)) .thenReturn("true".getBytes()); when(mCachedBluetoothDevice.getDevice()).thenReturn(mBluetoothDevice); when(mCachedBluetoothDevice.getAddress()).thenReturn("1f:aa:bb"); Drawable icon = mock(Drawable.class); when(mContext.getDrawable(com.android.settingslib.R.drawable.ic_earbuds_advanced)) .thenReturn(icon); assertThat( BluetoothUtils.getBtDrawableWithDescription( mContext, mCachedBluetoothDevice) .first) .isSameInstanceAs(icon); } @Test public void getStringMetaData_hasMetaData_getCorrectMetaData() { when(mBluetoothDevice.getMetadata(BluetoothDevice.METADATA_UNTETHERED_LEFT_ICON)) Loading Loading
packages/SettingsLib/src/com/android/settingslib/bluetooth/BluetoothUtils.java +2 −0 Original line number Diff line number Diff line Loading @@ -311,6 +311,8 @@ public class BluetoothUtils { } catch (SecurityException e) { Log.e(TAG, "Failed to get permission for: " + iconUri, e); } } else { return new Pair<>(context.getDrawable(R.drawable.ic_earbuds_advanced), pair.second); } } Loading
packages/SettingsLib/tests/robotests/src/com/android/settingslib/bluetooth/BluetoothUtilsTest.java +17 −0 Original line number Diff line number Diff line Loading @@ -233,6 +233,23 @@ public class BluetoothUtilsTest { .isInstanceOf(AdaptiveIcon.class); } @Test public void getBtDrawableWithDescription_untetheredHeadset_returnUntetheredIcon() { when(mBluetoothDevice.getMetadata(BluetoothDevice.METADATA_IS_UNTETHERED_HEADSET)) .thenReturn("true".getBytes()); when(mCachedBluetoothDevice.getDevice()).thenReturn(mBluetoothDevice); when(mCachedBluetoothDevice.getAddress()).thenReturn("1f:aa:bb"); Drawable icon = mock(Drawable.class); when(mContext.getDrawable(com.android.settingslib.R.drawable.ic_earbuds_advanced)) .thenReturn(icon); assertThat( BluetoothUtils.getBtDrawableWithDescription( mContext, mCachedBluetoothDevice) .first) .isSameInstanceAs(icon); } @Test public void getStringMetaData_hasMetaData_getCorrectMetaData() { when(mBluetoothDevice.getMetadata(BluetoothDevice.METADATA_UNTETHERED_LEFT_ICON)) Loading