Loading android/app/src/com/android/bluetooth/bas/BatteryStateMachine.java +2 −4 Original line number Diff line number Diff line Loading @@ -333,7 +333,6 @@ public class BatteryStateMachine extends StateMachine { public void enter() { log(TAG, "Enter (" + mDevice + "): " + messageWhatToString(getCurrentMessage().what)); sendMessageDelayed(CONNECT_TIMEOUT, sConnectTimeoutMs); dispatchConnectionStateChanged(mLastConnectionState, BluetoothProfile.STATE_CONNECTING); } Loading @@ -342,7 +341,6 @@ public class BatteryStateMachine extends StateMachine { log(TAG, "Exit (" + mDevice + "): " + messageWhatToString(getCurrentMessage().what)); mLastConnectionState = BluetoothProfile.STATE_CONNECTING; removeMessages(CONNECT_TIMEOUT); } @Override Loading @@ -355,8 +353,8 @@ public class BatteryStateMachine extends StateMachine { Log.w(TAG, "CONNECT ignored: " + mDevice); break; case CONNECT_TIMEOUT: Log.w(TAG, "Connection timeout: " + mDevice); // fall through Log.e(TAG, "Connection timeout unexpected: " + mDevice); break; case DISCONNECT: log(TAG, "Connection canceled to " + mDevice); if (mBluetoothGatt != null) { Loading android/app/tests/unit/src/com/android/bluetooth/bas/BatteryStateMachineTest.java +0 −26 Original line number Diff line number Diff line Loading @@ -55,7 +55,6 @@ import org.junit.Test; import org.junit.runner.RunWith; import org.junit.runners.JUnit4; import org.mockito.Mock; import org.mockito.MockitoAnnotations; import org.mockito.junit.MockitoJUnit; import org.mockito.junit.MockitoRule; Loading Loading @@ -278,31 +277,6 @@ public class BatteryStateMachineTest { .isInstanceOf(BatteryStateMachine.Connected.class); } @Test public void testConnectGattTimeout() { allowConnection(true); allowConnectGatt(true); // Inject an event for when incoming connection is requested mBatteryStateMachine.sendMessage(BatteryStateMachine.CONNECT); verify(mBatteryService, timeout(TIMEOUT_MS)) .handleConnectionStateChanged(any(BatteryStateMachine.class), eq(BluetoothProfile.STATE_DISCONNECTED), eq(BluetoothProfile.STATE_CONNECTING)); Assert.assertThat(mBatteryStateMachine.getCurrentState(), IsInstanceOf.instanceOf(BatteryStateMachine.Connecting.class)); verify(mBatteryService, timeout(TIMEOUT_MS)) .handleConnectionStateChanged(any(BatteryStateMachine.class), eq(BluetoothProfile.STATE_CONNECTING), eq(BluetoothProfile.STATE_DISCONNECTED)); Assert.assertThat(mBatteryStateMachine.getCurrentState(), IsInstanceOf.instanceOf(BatteryStateMachine.Disconnected.class)); } @Test public void testBatteryLevelChanged() { allowConnection(true); Loading Loading
android/app/src/com/android/bluetooth/bas/BatteryStateMachine.java +2 −4 Original line number Diff line number Diff line Loading @@ -333,7 +333,6 @@ public class BatteryStateMachine extends StateMachine { public void enter() { log(TAG, "Enter (" + mDevice + "): " + messageWhatToString(getCurrentMessage().what)); sendMessageDelayed(CONNECT_TIMEOUT, sConnectTimeoutMs); dispatchConnectionStateChanged(mLastConnectionState, BluetoothProfile.STATE_CONNECTING); } Loading @@ -342,7 +341,6 @@ public class BatteryStateMachine extends StateMachine { log(TAG, "Exit (" + mDevice + "): " + messageWhatToString(getCurrentMessage().what)); mLastConnectionState = BluetoothProfile.STATE_CONNECTING; removeMessages(CONNECT_TIMEOUT); } @Override Loading @@ -355,8 +353,8 @@ public class BatteryStateMachine extends StateMachine { Log.w(TAG, "CONNECT ignored: " + mDevice); break; case CONNECT_TIMEOUT: Log.w(TAG, "Connection timeout: " + mDevice); // fall through Log.e(TAG, "Connection timeout unexpected: " + mDevice); break; case DISCONNECT: log(TAG, "Connection canceled to " + mDevice); if (mBluetoothGatt != null) { Loading
android/app/tests/unit/src/com/android/bluetooth/bas/BatteryStateMachineTest.java +0 −26 Original line number Diff line number Diff line Loading @@ -55,7 +55,6 @@ import org.junit.Test; import org.junit.runner.RunWith; import org.junit.runners.JUnit4; import org.mockito.Mock; import org.mockito.MockitoAnnotations; import org.mockito.junit.MockitoJUnit; import org.mockito.junit.MockitoRule; Loading Loading @@ -278,31 +277,6 @@ public class BatteryStateMachineTest { .isInstanceOf(BatteryStateMachine.Connected.class); } @Test public void testConnectGattTimeout() { allowConnection(true); allowConnectGatt(true); // Inject an event for when incoming connection is requested mBatteryStateMachine.sendMessage(BatteryStateMachine.CONNECT); verify(mBatteryService, timeout(TIMEOUT_MS)) .handleConnectionStateChanged(any(BatteryStateMachine.class), eq(BluetoothProfile.STATE_DISCONNECTED), eq(BluetoothProfile.STATE_CONNECTING)); Assert.assertThat(mBatteryStateMachine.getCurrentState(), IsInstanceOf.instanceOf(BatteryStateMachine.Connecting.class)); verify(mBatteryService, timeout(TIMEOUT_MS)) .handleConnectionStateChanged(any(BatteryStateMachine.class), eq(BluetoothProfile.STATE_CONNECTING), eq(BluetoothProfile.STATE_DISCONNECTED)); Assert.assertThat(mBatteryStateMachine.getCurrentState(), IsInstanceOf.instanceOf(BatteryStateMachine.Disconnected.class)); } @Test public void testBatteryLevelChanged() { allowConnection(true); Loading