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

Commit 0f9a6446 authored by Vinay Kalia's avatar Vinay Kalia Committed by Gerrit Code Review
Browse files

Merge "Unregister display listener"

parents 258f385b 961b2ad0
Loading
Loading
Loading
Loading
+7 −1
Original line number Diff line number Diff line
@@ -107,13 +107,15 @@ public class ScanManager {
        mScanNative = new ScanNative();
        curUsedTrackableAdvertisements = 0;
        mDm = (DisplayManager) mService.getSystemService(Context.DISPLAY_SERVICE);
        mDm.registerDisplayListener(mDisplayListener, null);
    }

    void start() {
        HandlerThread thread = new HandlerThread("BluetoothScanManager");
        thread.start();
        mHandler = new ClientHandler(thread.getLooper());
        if (mDm != null) {
            mDm.registerDisplayListener(mDisplayListener, null);
        }
    }

    void cleanup() {
@@ -122,6 +124,10 @@ public class ScanManager {
        mSuspendedScanClients.clear();
        mScanNative.cleanup();

        if (mDm != null) {
            mDm.unregisterDisplayListener(mDisplayListener);
        }

        if (mHandler != null) {
            // Shut down the thread
            mHandler.removeCallbacksAndMessages(null);