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

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

Merge "Unregister display listener" am: 2abed10e am: 615919cd

am: a80db5c4

Change-Id: Ia559e72cc83688f646fbca0681cc665352191b6f
parents 80aa787e a80db5c4
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);