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

Commit 1f943c1c authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Unregister display listener" into oc-mr1-dev

parents 468a5b4b a4aadd26
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);