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

Commit 985121e7 authored by Zach Johnson's avatar Zach Johnson
Browse files

Simplify more discovery functions

Fold into binder stub, clean up references.

Bug: 145171640
Test: compile & run
Change-Id: I980a1f05fc51ead832bbe34835026f4f3ac10d7f
parent 7c79c345
Loading
Loading
Loading
Loading
+0 −9
Original line number Diff line number Diff line
@@ -916,15 +916,6 @@ class AdapterProperties {
        setScanMode(AbstractionLayer.BT_SCAN_MODE_NONE);
    }

    void onBluetoothDisable() {
        // From STATE_ON to BLE_ON
        debugLog("onBluetoothDisable()");
        // Turn off any Device Search/Inquiry
        mService.cancelDiscovery();
        // Set the scan_mode to NONE (no incoming connections).
        setScanMode(AbstractionLayer.BT_SCAN_MODE_NONE);
    }

    void discoveryStateChangeCallback(int state) {
        infoLog("Callback:discoveryStateChangeCallback with state:" + state);
        synchronized (mObject) {
+8 −17
Original line number Diff line number Diff line
@@ -618,7 +618,10 @@ public class AdapterService extends Service {
    }

    void stopProfileServices() {
        mAdapterProperties.onBluetoothDisable();
        // Make sure to stop classic background tasks now
        cancelDiscoveryNative();
        mAdapterProperties.setScanMode(AbstractionLayer.BT_SCAN_MODE_NONE);

        Class[] supportedProfileServices = Config.getSupportedProfiles();
        if (supportedProfileServices.length == 1 && (mRunningProfiles.size() == 1
                && GattService.class.getSimpleName().equals(mRunningProfiles.get(0).getName()))) {
@@ -1320,7 +1323,8 @@ public class AdapterService extends Service {

            enforceBluetoothAdminPermission(service);

            return service.cancelDiscovery();
            service.debugLog("cancelDiscovery");
            return service.cancelDiscoveryNative();
        }

        @Override
@@ -1332,7 +1336,7 @@ public class AdapterService extends Service {

            enforceBluetoothPermission(service);

            return service.isDiscovering();
            return service.mAdapterProperties.isDiscovering();
        }

        @Override
@@ -1344,7 +1348,7 @@ public class AdapterService extends Service {

            enforceBluetoothPermission(service);

            return service.getDiscoveryEndMillis();
            return service.mAdapterProperties.discoveryEndMillis();
        }

        @Override
@@ -1981,19 +1985,6 @@ public class AdapterService extends Service {
        return startDiscoveryNative();
    }

    boolean cancelDiscovery() {
        debugLog("cancelDiscovery");
        return cancelDiscoveryNative();
    }

    boolean isDiscovering() {
        return mAdapterProperties.isDiscovering();
    }

    long getDiscoveryEndMillis() {
        return mAdapterProperties.discoveryEndMillis();
    }

    /**
     * Same as API method {@link BluetoothAdapter#getBondedDevices()}
     *