Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit d4f0e93e authored by Zach Johnson's avatar Zach Johnson
Browse files

Simplify LE up & BREDR down

Bug: 145171640
Test: compile & run
Change-Id: I5507e687ef1c977d87f379475bb29c6304f45ebd
parent 6fa706a6
Loading
Loading
Loading
Loading
+4 −10
Original line number Diff line number Diff line
@@ -2108,7 +2108,8 @@ public class AdapterService extends Service {
            if (service == null) {
                return;
            }
            service.onLeServiceUp();

            service.mAdapterStateMachine.sendMessage(AdapterState.USER_TURN_ON);
        }

        @Override
@@ -2117,7 +2118,8 @@ public class AdapterService extends Service {
            if (service == null) {
                return;
            }
            service.onBrEdrDown();

            service.mAdapterStateMachine.sendMessage(AdapterState.BLE_TURN_OFF);
        }

        @Override
@@ -2750,14 +2752,6 @@ public class AdapterService extends Service {
        return mAdapterProperties.getTotalNumOfTrackableAdvertisements();
    }

    void onLeServiceUp() {
        mAdapterStateMachine.sendMessage(AdapterState.USER_TURN_ON);
    }

    void onBrEdrDown() {
        mAdapterStateMachine.sendMessage(AdapterState.BLE_TURN_OFF);
    }

    private static int convertScanModeToHal(int mode) {
        switch (mode) {
            case BluetoothAdapter.SCAN_MODE_NONE:
+4 −4
Original line number Diff line number Diff line
@@ -202,7 +202,7 @@ public class AdapterServiceTest {
        verifyStateChange(BluetoothAdapter.STATE_BLE_TURNING_ON, BluetoothAdapter.STATE_BLE_ON,
                invocationNumber + 1, NATIVE_INIT_MS);

        mAdapterService.onLeServiceUp();
        mServiceBinder.onLeServiceUp();

        verifyStateChange(BluetoothAdapter.STATE_BLE_ON, BluetoothAdapter.STATE_TURNING_ON,
                invocationNumber + 1, CONTEXT_SWITCH_MS);
@@ -249,7 +249,7 @@ public class AdapterServiceTest {
        verifyStateChange(BluetoothAdapter.STATE_TURNING_OFF, BluetoothAdapter.STATE_BLE_ON,
                invocationNumber + 1, CONTEXT_SWITCH_MS);

        mAdapterService.onBrEdrDown();
        mServiceBinder.onBrEdrDown();

        verifyStateChange(BluetoothAdapter.STATE_BLE_ON, BluetoothAdapter.STATE_BLE_TURNING_OFF,
                invocationNumber + 1, CONTEXT_SWITCH_MS);
@@ -363,7 +363,7 @@ public class AdapterServiceTest {
        verifyStateChange(BluetoothAdapter.STATE_TURNING_OFF, BluetoothAdapter.STATE_BLE_ON, 1,
                CONTEXT_SWITCH_MS);

        mAdapterService.onBrEdrDown();
        mServiceBinder.onBrEdrDown();

        verifyStateChange(BluetoothAdapter.STATE_BLE_ON, BluetoothAdapter.STATE_BLE_TURNING_OFF, 1,
                CONTEXT_SWITCH_MS);
@@ -398,7 +398,7 @@ public class AdapterServiceTest {
        verifyStateChange(BluetoothAdapter.STATE_BLE_TURNING_ON, BluetoothAdapter.STATE_BLE_ON, 1,
                NATIVE_INIT_MS);

        mAdapterService.onLeServiceUp();
        mServiceBinder.onLeServiceUp();

        verifyStateChange(BluetoothAdapter.STATE_BLE_ON, BluetoothAdapter.STATE_TURNING_ON, 1,
                CONTEXT_SWITCH_MS);