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

Commit 468a227d 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: I298f71e0c24c8595692290dea9379c1c22fcc44d
parent 19ffc16b
Loading
Loading
Loading
Loading
+14 −3
Original line number Diff line number Diff line
@@ -459,16 +459,27 @@ class BluetoothManagerService {
        }

        if (currentState == STATE_ON) {
            sendDisableMsg(reason);
            mAdapterLock.readLock().lock();
            try {
                if (mAdapter != null) {
                    mEnable = 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);