Loading packages/SettingsLib/src/com/android/settingslib/bluetooth/CachedBluetoothDevice.java +1 −1 Original line number Diff line number Diff line Loading @@ -583,7 +583,7 @@ public class CachedBluetoothDevice implements Comparable<CachedBluetoothDevice> */ public void setName(String name) { // Prevent getName() to be set to null if setName(null) is called if (name == null || TextUtils.equals(name, getName())) { if (TextUtils.isEmpty(name) || TextUtils.equals(name, getName())) { return; } mDevice.setAlias(name); Loading packages/SettingsLib/tests/robotests/src/com/android/settingslib/bluetooth/CachedBluetoothDeviceTest.java +7 −0 Original line number Diff line number Diff line Loading @@ -1014,6 +1014,13 @@ public class CachedBluetoothDeviceTest { verify(mDevice, never()).setAlias(any()); } @Test public void setName_setDeviceNameIsEmpty() { mCachedDevice.setName(""); verify(mDevice, never()).setAlias(any()); } @Test public void getProfileConnectionState_nullProfile_returnDisconnected() { assertThat(mCachedDevice.getProfileConnectionState(null)).isEqualTo( Loading Loading
packages/SettingsLib/src/com/android/settingslib/bluetooth/CachedBluetoothDevice.java +1 −1 Original line number Diff line number Diff line Loading @@ -583,7 +583,7 @@ public class CachedBluetoothDevice implements Comparable<CachedBluetoothDevice> */ public void setName(String name) { // Prevent getName() to be set to null if setName(null) is called if (name == null || TextUtils.equals(name, getName())) { if (TextUtils.isEmpty(name) || TextUtils.equals(name, getName())) { return; } mDevice.setAlias(name); Loading
packages/SettingsLib/tests/robotests/src/com/android/settingslib/bluetooth/CachedBluetoothDeviceTest.java +7 −0 Original line number Diff line number Diff line Loading @@ -1014,6 +1014,13 @@ public class CachedBluetoothDeviceTest { verify(mDevice, never()).setAlias(any()); } @Test public void setName_setDeviceNameIsEmpty() { mCachedDevice.setName(""); verify(mDevice, never()).setAlias(any()); } @Test public void getProfileConnectionState_nullProfile_returnDisconnected() { assertThat(mCachedDevice.getProfileConnectionState(null)).isEqualTo( Loading