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

Commit 9d3f3ac6 authored by William Escande's avatar William Escande
Browse files

SystemServer: SatelliteMode bypass thread jump

The callback from the satellite listener and the airplane mode are
already executed in the correct context.
It is not necessary to send a message to disable, instead call disable
directly.

Note that this was already the case to finalize the disable of the BLE
mode

Bug: 349428963
Test: Manual:
      Trigger satellite mode while bluetooth is on and observe logs
Flag: Exempt: very specific usecase that is entirely tested
Change-Id: I231408fc313a7ff932fc900147e3db59eaa7c383
parent 9d9867d4
Loading
Loading
Loading
Loading
+15 −3
Original line number Diff line number Diff line
@@ -459,16 +459,28 @@ class BluetoothManagerService {
        }

        if (currentState == STATE_ON) {
            sendDisableMsg(reason);
            mAdapterLock.readLock().lock();
            try {
                if (mAdapter != null) {
                    mEnable = false;
                    mEnableExternal = false;
                    addActiveLog(reason, false);
                    mAdapter.disable(mContext.getAttributionSource());
                }
            } catch (RemoteException e) {
                Log.e(TAG, "Unable to call disable", e);
            } finally {
                mAdapterLock.readLock().unlock();
            }
        } else if (currentState == STATE_BLE_ON) {
            // If currentState is BLE_ON make sure we trigger stopBle
            mAdapterLock.readLock().lock();
            try {
                if (mAdapter != null) {
                    addActiveLog(reason, false);
                    mAdapter.stopBle(mContext.getAttributionSource());
                    mEnable = false;
                    mEnableExternal = false;
                    addActiveLog(reason, false);
                    mAdapter.stopBle(mContext.getAttributionSource());
                }
            } catch (RemoteException e) {
                Log.e(TAG, "Unable to call stopBle", e);