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

Commit a80db5c4 authored by Vinay Kalia's avatar Vinay Kalia Committed by android-build-merger
Browse files

Merge "Unregister display listener" am: 2abed10e

am: 615919cd

Change-Id: I29c1362f515803424c081fc07027fe4d6a36dbc4
parents 19b96912 615919cd
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);