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

Commit e77b3a03 authored by Bandari Ramesh's avatar Bandari Ramesh Committed by Bruno Martins
Browse files

Bluetooth: Fix for Global reference table overflow issue[1/2]

 -  To avoid RemoteCallbackList object leaks in Bluetooth Manager
    Service, Added unregister API in BluetoothAdapter.java which
    internally calls unregisterAdapter of Manager Service

CRs-Fixed: 2138560
Change-Id: I58ce5f5e1b86d87e0ff602b453abb74d0b5e1982
parent fb2370e9
Loading
Loading
Loading
Loading
+16 −0
Original line number Diff line number Diff line
@@ -2800,6 +2800,22 @@ public final class BluetoothAdapter {
        }
    }

    /**
     * @hide
     */
    public void unregisterAdapter() {
        try {
            //mServiceLock.writeLock().lock();
            if (mManagerService != null){
                mManagerService.unregisterAdapter(mManagerCallback);
            }
        } catch (RemoteException e) {
            Log.e(TAG, "", e);
        } finally {
            //mServiceLock.writeLock().unlock();
        }
    }

    private Set<BluetoothDevice> toDeviceSet(BluetoothDevice[] devices) {
        Set<BluetoothDevice> deviceSet = new HashSet<BluetoothDevice>(Arrays.asList(devices));
        return Collections.unmodifiableSet(deviceSet);
+4 −0
Original line number Diff line number Diff line
@@ -452,6 +452,10 @@ public final class BluetoothHeadset implements BluetoothProfile {
        doUnbind();
    }

    public void finalize() {
        close();
    }

    /**
     * Initiate connection to a profile of the remote bluetooth device.
     *