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

Commit eeef98b9 authored by Nitin Shivpure's avatar Nitin Shivpure Committed by Steve Kondik
Browse files

Bluetooth: Fix to avoid object leaks during BT OFF

A case where script is running to do BT ON/OFF 2000 times,
Each time while turning off BT FULL_CONNECTED_ASYNC_CHANNEL
is disconnected by Pan Service. HALF_CONNECTED_ASYNC_CHANNEL
is not disconnected, which leads memory leak in Pan Service
object as messenger passed by PanService & ASYNC Channel object.
which are still referred from BT tethering framework code. So GC
does not claim for these objects. HALF_CONNECTED_ASYNC_CHANNEL
should be disconnected, once FULL_CONNECTED_ASYNC_CHANNEL
is disconnected to solve this issue.

Change-Id: I5a7a2beb0169a755cf4f3f37fd0a0ab7d08fd9e5
CRs-Fixed: 591180
parent 2cffa0a1
Loading
Loading
Loading
Loading
+10 −2
Original line number Diff line number Diff line
@@ -402,13 +402,21 @@ public class BluetoothTetheringDataTracker extends BaseNetworkStateTracker {
                        } else {
                            ac.sendMessage(
                                    AsyncChannel.CMD_CHANNEL_FULL_CONNECTION);
                            mStackChannel = ac;
                            if (VDBG) Log.d(TAG, "CMD_CHANNEL_HALF_CONNECTED: " + mStackChannel);
                        }
                    }
                    break;
                case AsyncChannel.CMD_CHANNEL_DISCONNECTED:
                    if (VDBG) Log.d(TAG, "got CMD_CHANNEL_DISCONNECTED");
                    if (mStackChannel != null) {
                        mBtdt.stopReverseTether();
                        mBtdt.mAsyncChannel.set(null);

                        Log.d(TAG, "Disconnect CMD_CHANNEL_HALF_CONNECTED: " + mStackChannel);
                        mStackChannel.disconnect();
                        mStackChannel = null;
                    }
                    break;
                case NetworkStateTracker.EVENT_NETWORK_CONNECTED:
                    LinkProperties linkProperties = (LinkProperties)(msg.obj);