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

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

Merge "Unregister display listener"

am: 0f9a6446

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


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


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


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

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