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

Commit 2a149fd8 authored by Jack He's avatar Jack He
Browse files

PAN: No observable state transition when PAN is rejected

* When a incoming PAN connection is rejected, there should be no
  observable state transitions as intents to external packages
* Current sequence of events:
  - 1. Incoming PAN, DISCONNECTED -> CONNECTED
  - 2. Reject PAN, reset to DISCONNECTED, disconnect PAN, device removed
       from mPanDevices
  - 3. Disconnect pending, DISCONNECTED -> DISCONNECTING, ignored, device
       not removed from mPanDevices
  - 4. Disconnect complete, DISCONNECTING -> DISCONNECTED, currently not
       ignored, resulting in PAN state transition error
* Sequence of events after this fix
  - 1. Incoming PAN, DISCONNECTED -> CONNECTED
  - 2. Reject PAN, reset to DISCONNECTED, disconnect PAN, device removed
       from mPanDevices
  - 3. Disconnect pending, DISCONNECTED -> DISCONNECTING, ignored, device
       removed from mPanDevices, reset state to DISCONNECTED
  - 4. Disconnect complete, DISCONNECTED -> DISCONNECTED, ignored, no
       observable state transition

Bug: 65854008
Test: PAN regresstion test, testplans/109528/3975
Change-Id: I2eda16e717f8b9d54c737615ee0cf3f0a1bed6d1
parent de888022
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -472,6 +472,7 @@ public class PanService extends ProfileService {
        // will fail until the caller explicitly calls BluetoothPan#disconnect.
        if (prevState == BluetoothProfile.STATE_DISCONNECTED && state == BluetoothProfile.STATE_DISCONNECTING) {
            Log.d(TAG, "Ignoring state change from " + prevState + " to " + state);
            mPanDevices.remove(device);
            return;
        }