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

Commit ab46f8b6 authored by Hyundo Moon's avatar Hyundo Moon
Browse files

OppService: Make sure ContentObserver is not called after stop

Bug: 346179390
Bug: 346467641
Test: atest BluetoothOppServiceCleanupTest BluetoothOppServiceTest
Change-Id: Iec360464622643b647fa79657e1228dada03a4e1
parent 8ca813a5
Loading
Loading
Loading
Loading
+7 −0
Original line number Diff line number Diff line
@@ -118,6 +118,13 @@ public class BluetoothOppService extends ProfileService implements IObexConnecti
        @Override
        public void onChange(boolean selfChange) {
            Log.v(TAG, "ContentObserver received notification");

            // Since ContentObserver is created with Handler, onChange() can be called
            // even after the observer is unregistered.
            if (Flags.oppIgnoreContentObserverAfterServiceStop() && mObserver != this) {
                Log.d(TAG, "onChange() called after stop() is called.");
                return;
            }
            updateFromProvider();
        }
    }