Merge "Skip RAT type listener registration if IMSI is not available" into rvc-d1-dev am: 5403c7646a
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/12406769 Change-Id: Ia10dc546e107e9c1fc249766c2bcfc5856ce1bd2
This commit is contained in:
@@ -100,11 +100,16 @@ public class NetworkStatsSubscriptionsMonitor extends
|
|||||||
if (match != null) continue;
|
if (match != null) continue;
|
||||||
|
|
||||||
// Create listener for every newly added sub. Also store subscriberId into it to
|
// Create listener for every newly added sub. Also store subscriberId into it to
|
||||||
// prevent binder call to telephony when querying RAT.
|
// prevent binder call to telephony when querying RAT. If the subscriberId is empty
|
||||||
|
// for any reason, such as SIM PIN locked, skip registration.
|
||||||
|
// SubscriberId will be unavailable again if 1. modem crashed 2. reboot
|
||||||
|
// 3. re-insert SIM. If that happens, the listeners will be eventually synchronized
|
||||||
|
// with active sub list once all subscriberIds are ready.
|
||||||
final String subscriberId = mTeleManager.getSubscriberId(subId);
|
final String subscriberId = mTeleManager.getSubscriberId(subId);
|
||||||
if (TextUtils.isEmpty(subscriberId)) {
|
if (TextUtils.isEmpty(subscriberId)) {
|
||||||
Log.wtf(NetworkStatsService.TAG,
|
Log.d(NetworkStatsService.TAG, "Empty subscriberId for newly added sub "
|
||||||
"Empty subscriberId for newly added sub: " + subId);
|
+ subId + ", skip listener registration");
|
||||||
|
continue;
|
||||||
}
|
}
|
||||||
final RatTypeListener listener =
|
final RatTypeListener listener =
|
||||||
new RatTypeListener(mExecutor, this, subId, subscriberId);
|
new RatTypeListener(mExecutor, this, subId, subscriberId);
|
||||||
@@ -113,6 +118,7 @@ public class NetworkStatsSubscriptionsMonitor extends
|
|||||||
// Register listener to the telephony manager that associated with specific sub.
|
// Register listener to the telephony manager that associated with specific sub.
|
||||||
mTeleManager.createForSubscriptionId(subId)
|
mTeleManager.createForSubscriptionId(subId)
|
||||||
.listen(listener, PhoneStateListener.LISTEN_SERVICE_STATE);
|
.listen(listener, PhoneStateListener.LISTEN_SERVICE_STATE);
|
||||||
|
Log.d(NetworkStatsService.TAG, "RAT type listener registered for sub " + subId);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (final RatTypeListener listener : new ArrayList<>(mRatListeners)) {
|
for (final RatTypeListener listener : new ArrayList<>(mRatListeners)) {
|
||||||
@@ -165,6 +171,7 @@ public class NetworkStatsSubscriptionsMonitor extends
|
|||||||
private void handleRemoveRatTypeListener(@NonNull RatTypeListener listener) {
|
private void handleRemoveRatTypeListener(@NonNull RatTypeListener listener) {
|
||||||
mTeleManager.createForSubscriptionId(listener.mSubId)
|
mTeleManager.createForSubscriptionId(listener.mSubId)
|
||||||
.listen(listener, PhoneStateListener.LISTEN_NONE);
|
.listen(listener, PhoneStateListener.LISTEN_NONE);
|
||||||
|
Log.d(NetworkStatsService.TAG, "RAT type listener unregistered for sub " + listener.mSubId);
|
||||||
mRatListeners.remove(listener);
|
mRatListeners.remove(listener);
|
||||||
|
|
||||||
// Removal of subscriptions doesn't generate RAT changed event, fire it for every
|
// Removal of subscriptions doesn't generate RAT changed event, fire it for every
|
||||||
|
|||||||
Reference in New Issue
Block a user