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

Commit 72210b24 authored by Steve Kondik's avatar Steve Kondik
Browse files

Bluetooth: Add support for enabling Bluetooth in airplane mode.

Check AIRPLANE_MODE_TOGGLEABLE_RADIOS for RADIO_BLUETOOTH so Bluetooth
can be enabled in airplane mode if configured.
parent 28ad8f25
Loading
Loading
Loading
Loading
+9 −2
Original line number Diff line number Diff line
@@ -370,7 +370,7 @@ public class BluetoothService extends IBluetooth.Stub {
                                                "Need BLUETOOTH_ADMIN permission");

        // Airplane mode can prevent Bluetooth radio from being turned on.
        if (mIsAirplaneSensitive && isAirplaneModeOn()) {
        if (mIsAirplaneSensitive && isAirplaneModeOn() && !isAirplaneToggleable()) {
            return false;
        }
        if (mBluetoothState != BluetoothAdapter.STATE_OFF) {
@@ -545,7 +545,7 @@ public class BluetoothService extends IBluetooth.Stub {
                mEventLoop.onPropertyChanged(propVal);
            }

            if (mIsAirplaneSensitive && isAirplaneModeOn()) {
            if (mIsAirplaneSensitive && isAirplaneModeOn() && !isAirplaneToggleable()) {
                disable(false);
            }

@@ -1612,6 +1612,13 @@ public class BluetoothService extends IBluetooth.Stub {
                Settings.System.AIRPLANE_MODE_ON, 0) == 1;
    }

    private boolean isAirplaneToggleable() {
        String toggleableRadios = Settings.System.getString(mContext.getContentResolver(),
                Settings.System.AIRPLANE_MODE_TOGGLEABLE_RADIOS);
        return toggleableRadios != null
            && toggleableRadios.contains(Settings.System.RADIO_BLUETOOTH);
    }
    
    /* Broadcast the Uuid intent */
    /*package*/ synchronized void sendUuidIntent(String address) {
        ParcelUuid[] uuid = getUuidFromCache(address);