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

Commit 88e3cd60 authored by Etienne Ruffieux's avatar Etienne Ruffieux
Browse files

Replace usage of hidden API getLeState by isLeEnabled

Tag: #feature
Bug: 200202780
Test: build
Change-Id: If682deb4e2d8bc32bc74fa7a61f5e660c84918fa
parent d7a62ace
Loading
Loading
Loading
Loading
+1 −13
Original line number Diff line number Diff line
@@ -21,8 +21,6 @@ import static android.bluetooth.BluetoothAdapter.ACTION_BLE_STATE_CHANGED;
import static android.bluetooth.BluetoothAdapter.ACTION_STATE_CHANGED;
import static android.bluetooth.BluetoothAdapter.EXTRA_PREVIOUS_STATE;
import static android.bluetooth.BluetoothAdapter.EXTRA_STATE;
import static android.bluetooth.BluetoothAdapter.STATE_BLE_ON;
import static android.bluetooth.BluetoothAdapter.STATE_ON;
import static android.bluetooth.BluetoothAdapter.nameForState;
import static android.bluetooth.le.ScanCallback.SCAN_FAILED_ALREADY_STARTED;
import static android.bluetooth.le.ScanCallback.SCAN_FAILED_APPLICATION_REGISTRATION_FAILED;
@@ -156,7 +154,7 @@ class BleCompanionDeviceScanner implements AssociationStore.OnChangeListener {
    private void checkBleState() {
        enforceInitialized();

        final boolean bleAvailable = isBleAvailable();
        final boolean bleAvailable = mBtAdapter.isLeEnabled();
        if (DEBUG) {
            Log.i(TAG, "checkBleState() bleAvailable=" + bleAvailable);
        }
@@ -183,16 +181,6 @@ class BleCompanionDeviceScanner implements AssociationStore.OnChangeListener {
        }
    }

    /**
     * A duplicate of {@code BluetoothAdapter.getLeAccess()} method which has the package-private
     * access level, so it's not accessible from here.
     */
    private boolean isBleAvailable() {
        final int state = mBtAdapter.getLeState();
        if (DEBUG) Log.d(TAG, "getLeAccess() state=" + nameForBtState(state));
        return state == STATE_ON || state == STATE_BLE_ON;
    }

    @MainThread
    private void startScan() {
        enforceInitialized();