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

Commit f156d145 authored by Nitin Shivpure's avatar Nitin Shivpure Committed by Ricardo Cerqueira
Browse files

Bluetooth: Fix to avoid framework reboot during monkey.

A case where monkey is running & sometimes framework is
disconnected due to unhandled java Exception during the
binding of PAN service on unsuccessful binding. So it never
handled. Handing java exception while binding PAN service
to solve this issue.

Change-Id: Idea710593a3f9496305f636042605303e73e7749
CRs-Fixed: 564709
parent 2453e4c7
Loading
Loading
Loading
Loading
+12 −5
Original line number Diff line number Diff line
@@ -138,7 +138,6 @@ public final class BluetoothPan implements BluetoothProfile {
        }
        if (VDBG) Log.d(TAG, "BluetoothPan() call bindService");
        doBind();
        if (VDBG) Log.d(TAG, "BluetoothPan(), bindService called");
    }

    boolean doBind() {
@@ -185,12 +184,20 @@ public final class BluetoothPan implements BluetoothProfile {
    final private IBluetoothStateChangeCallback mStateChangeCallback = new IBluetoothStateChangeCallback.Stub() {

        @Override
        public void onBluetoothStateChange(boolean on) throws RemoteException {
        public void onBluetoothStateChange(boolean on) {
            //Handle enable request to bind again.
            Log.d(TAG, "onBluetoothStateChange on: " + on);
            if (on) {
                Log.d(TAG, "onBluetoothStateChange(on) call bindService");
                try {
                    if (mPanService == null) {
                        Log.d(TAG, "onBluetoothStateChange call bindService");
                        doBind();
                if (VDBG) Log.d(TAG, "BluetoothPan(), bindService called");
                    }
                } catch (IllegalStateException e) {
                    Log.e(TAG,"onBluetoothStateChange: could not bind to PAN service: ", e);
                } catch (SecurityException e) {
                    Log.e(TAG,"onBluetoothStateChange: could not bind to PAN service: ", e);
                }
            } else {
                if (VDBG) Log.d(TAG,"Unbinding service...");
                synchronized (mConnection) {