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

Commit 1bac3121 authored by Hemant Gupta's avatar Hemant Gupta Committed by android-build-merger
Browse files

Merge "SAP : Prevent crash during turn on Airplane mode" am: 342b2bbe

am: ef01b6a3

Change-Id: Id6701b0115488bf55c59307689f2104987fbc3a4
parents f9386a93 ef01b6a3
Loading
Loading
Loading
Loading
+7 −0
Original line number Diff line number Diff line
@@ -5,6 +5,7 @@ import android.app.Notification;
import android.app.NotificationChannel;
import android.app.NotificationManager;
import android.app.PendingIntent;
import android.bluetooth.BluetoothAdapter;
import android.bluetooth.BluetoothSap;
import android.content.BroadcastReceiver;
import android.content.Context;
@@ -450,6 +451,12 @@ public class SapServer extends Thread implements Callback {
            /* TODO: Change to the needed Exception types when done testing */
            Log.w(TAG, e);
        } finally {
            BluetoothAdapter adapter = BluetoothAdapter.getDefaultAdapter();
            int state = (adapter != null) ? adapter.getState() : -1;
            if (state != BluetoothAdapter.STATE_ON) {
                if (DEBUG) Log.d(TAG, "BT State :" + state);
                mDeinitSignal.countDown();
            }
            // Do cleanup even if an exception occurs
            stopDisconnectTimer();
            /* In case of e.g. a RFCOMM close while connected: