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

Commit 44abcd27 authored by Jaikumar Ganesh's avatar Jaikumar Ganesh Committed by Android (Google) Code Review
Browse files

Set scan mode to be connectable when turning on.

If scan mode is not set, set it to be connectable.

Change-Id: I146505dade5d46aa70068cdaada94c06f30d75de
parent fba70fe2
Loading
Loading
Loading
Loading
+11 −0
Original line number Diff line number Diff line
@@ -424,6 +424,17 @@ class AdapterProperties {
        }
    }

    void onBluetoothReady() {
        // When BT is being turned on, all adapter properties will be sent in 1
        // callback. At this stage, set the scan mode.
        synchronized (mObject) {
            if (getState() == BluetoothAdapter.STATE_TURNING_ON &&
                    mScanMode == BluetoothAdapter.SCAN_MODE_NONE) {
                    setScanMode(AbstractionLayer.BT_SCAN_MODE_CONNECTABLE);
            }
        }
    }

    void discoveryStateChangeCallback(int state) {
        infoLog("Callback:discoveryStateChangeCallback with state:" + state);
        synchronized (mObject) {
+0 −9
Original line number Diff line number Diff line
@@ -444,15 +444,6 @@ public class AdapterService extends Application {
                                       Settings.Secure.BLUETOOTH_ON, 0) > 0);
    }

    void onBluetoothEnabled() {
        getAdapterPropertiesNative();
    }

    void onBluetoothEnabledAdapterReady() {
        mAdapterStateMachine.sendMessage(AdapterState.ENABLED_READY);
    }


    private native static void classInitNative();
    private native boolean initNative();
    private native void cleanupNative();
+1 −0
Original line number Diff line number Diff line
@@ -156,6 +156,7 @@ final class AdapterState extends StateMachine {
                    break;
                case ENABLED_READY:
                    removeMessages(ENABLE_TIMEOUT);
                    mAdapterProperties.onBluetoothReady();
                    sendIntent(BluetoothAdapter.STATE_ON);
                    transitionTo(mOnState);
                    break;