Do not show error toast when received UNBOND_REASON_REMOVED

Do not show error toast when received UNBOND_REASON_REMOVED,
because this reason is also received when devices unbond
like forget devices.

Bug: 181738217
Bug: 173165769
Test: make -j42 RunSettingsLibRoboTests
Change-Id: I7c9675014bb642a28dcfb313fa5ce7283cb43d92
This commit is contained in:
Hugh Chen
2021-03-12 16:34:40 +08:00
parent b797729b3f
commit 035d65e81b
2 changed files with 0 additions and 16 deletions

View File

@@ -386,7 +386,6 @@ public class BluetoothEventManager {
case BluetoothDevice.UNBOND_REASON_AUTH_TIMEOUT:
case BluetoothDevice.UNBOND_REASON_REPEATED_ATTEMPTS:
case BluetoothDevice.UNBOND_REASON_REMOTE_AUTH_CANCELED:
case BluetoothDevice.UNBOND_REASON_REMOVED:
errorMsg = R.string.bluetooth_pairing_error_message;
break;
default:

View File

@@ -352,21 +352,6 @@ public class BluetoothEventManagerTest {
assertThat(mCachedDevice2.isActiveDevice(BluetoothProfile.HEARING_AID)).isFalse();
}
@Test
public void showUnbondMessage_reasonRemoved_showCorrectedErrorCode() {
mIntent = new Intent(BluetoothDevice.ACTION_BOND_STATE_CHANGED);
mIntent.putExtra(BluetoothDevice.EXTRA_DEVICE, mBluetoothDevice);
mIntent.putExtra(BluetoothDevice.EXTRA_BOND_STATE, BluetoothDevice.BOND_NONE);
mIntent.putExtra(BluetoothDevice.EXTRA_REASON, BluetoothDevice.UNBOND_REASON_REMOVED);
when(mCachedDeviceManager.findDevice(mBluetoothDevice)).thenReturn(mCachedDevice1);
when(mCachedDevice1.getName()).thenReturn(DEVICE_NAME);
mContext.sendBroadcast(mIntent);
verify(mErrorListener).onShowError(any(Context.class), eq(DEVICE_NAME),
eq(R.string.bluetooth_pairing_error_message));
}
@Test
public void showUnbondMessage_reasonAuthTimeout_showCorrectedErrorCode() {
mIntent = new Intent(BluetoothDevice.ACTION_BOND_STATE_CHANGED);