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

Commit 7f0122af authored by Juffin Alex Varghese's avatar Juffin Alex Varghese
Browse files

Bluetooth: Update SCAN MODE state based on the storage value

Change will update the SCAN MODE state while Bluetooth is turning ON based
on the previous SCAN MODE state which is stored in the storage. Otherwise,
inquiry scan and page scan are disabled on the local Bluetooth adapter
while turning ON.

CRs-Fixed: 538749
Change-Id: I48af6e3d0d6bc4e8f9c1de139eb74cbb94b8364f
parent 7d88c5ad
Loading
Loading
Loading
Loading
+12 −2
Original line number Diff line number Diff line
@@ -506,8 +506,18 @@ class AdapterProperties {
                    /* mDiscoverableTimeout is part of the
                       adapterPropertyChangedCallback received before
                       onBluetoothReady */
                    switch (mScanMode) {
                        case BluetoothAdapter.SCAN_MODE_CONNECTABLE_DISCOVERABLE:
                            if (mDiscoverableTimeout != 0)
                                setScanMode(AbstractionLayer.BT_SCAN_MODE_CONNECTABLE);
                            else
                                setScanMode(AbstractionLayer.BT_SCAN_MODE_CONNECTABLE_DISCOVERABLE);
                            break;
                        case BluetoothAdapter.SCAN_MODE_NONE:
                        case BluetoothAdapter.SCAN_MODE_CONNECTABLE:
                        default:
                            setScanMode(AbstractionLayer.BT_SCAN_MODE_CONNECTABLE);
                    }
                    /* though not always required, this keeps NV up-to date on first-boot after flash */
                    setDiscoverableTimeout(mDiscoverableTimeout);
            }