Fix concurrent issue

- Add a thread lock

Fix: 286495550
Test: make pass
Change-Id: I72877551bda18cf93734d270770a0bd53bab465b
This commit is contained in:
tomhsu
2024-03-20 08:29:43 +00:00
parent cc10abe1c2
commit 55899976e9

View File

@@ -295,7 +295,9 @@ public class MobileNetworkRepository extends SubscriptionManager.OnSubscriptions
}
public void removeRegister(MobileNetworkCallback mobileNetworkCallback) {
sCallbacks.remove(mobileNetworkCallback);
synchronized (this) {
sCallbacks.remove(mobileNetworkCallback);
}
if (sCallbacks.isEmpty()) {
mSubscriptionManager.removeOnSubscriptionsChangedListener(this);
mAirplaneModeObserver.unRegister(mContext);