Merge "Update NR info using the most recent ServiceState" into udc-qpr-dev
diff --git a/src/com/android/phone/settings/RadioInfo.java b/src/com/android/phone/settings/RadioInfo.java
index 124badf..59ff11d 100644
--- a/src/com/android/phone/settings/RadioInfo.java
+++ b/src/com/android/phone/settings/RadioInfo.java
@@ -207,6 +207,7 @@
private static final int EVENT_QUERY_SMSC_DONE = 1005;
private static final int EVENT_UPDATE_SMSC_DONE = 1006;
private static final int EVENT_PHYSICAL_CHANNEL_CONFIG_CHANGED = 1007;
+ private static final int EVENT_UPDATE_NR_STATS = 1008;
private static final int MENU_ITEM_VIEW_ADN = 1;
private static final int MENU_ITEM_VIEW_FDN = 2;
@@ -379,7 +380,14 @@
updateNetworkType();
updateRawRegistrationState(serviceState);
updateImsProvisionedState();
- updateNrStats(serviceState);
+
+ // Since update NR stats includes a ril message to get slicing information, it runs
+ // as blocking during the timeout period of 1 second. if ServiceStateChanged event
+ // fires consecutively, RadioInfo can run for more than 10 seconds. This can cause ANR.
+ // Therefore, send event only when there is no same event being processed.
+ if (!mHandler.hasMessages(EVENT_UPDATE_NR_STATS)) {
+ mHandler.obtainMessage(EVENT_UPDATE_NR_STATS).sendToTarget();
+ }
}
@Override
@@ -465,6 +473,10 @@
}
updatePhysicalChannelConfiguration((List<PhysicalChannelConfig>) ar.result);
break;
+ case EVENT_UPDATE_NR_STATS:
+ log("got EVENT_UPDATE_NR_STATS");
+ updateNrStats();
+ break;
default:
super.handleMessage(msg);
break;
@@ -690,7 +702,7 @@
updateProperties();
updateDnsCheckState();
updateNetworkType();
- updateNrStats(null);
+ updateNrStats();
updateCellInfo(mCellInfoResult);
updateSubscriptionIds();
@@ -1235,15 +1247,12 @@
AccessNetworkConstants.TRANSPORT_TYPE_WLAN));
}
- private void updateNrStats(ServiceState serviceState) {
+ private void updateNrStats() {
if ((mTelephonyManager.getSupportedRadioAccessFamily()
& TelephonyManager.NETWORK_TYPE_BITMASK_NR) == 0) {
return;
}
- ServiceState ss = serviceState;
- if (ss == null && mPhone != null) {
- ss = mPhone.getServiceState();
- }
+ ServiceState ss = (mPhone == null) ? null : mPhone.getServiceState();
if (ss != null) {
NetworkRegistrationInfo nri = ss.getNetworkRegistrationInfo(
NetworkRegistrationInfo.DOMAIN_PS, AccessNetworkConstants.TRANSPORT_TYPE_WWAN);
@@ -1257,6 +1266,13 @@
}
mNrState.setText(NetworkRegistrationInfo.nrStateToString(ss.getNrState()));
mNrFrequency.setText(ServiceState.frequencyRangeToString(ss.getNrFrequencyRange()));
+ } else {
+ Log.e(TAG, "Clear Nr stats by null service state");
+ mEndcAvailable.setText("");
+ mDcnrRestricted.setText("");
+ mNrAvailable.setText("");
+ mNrState.setText("");
+ mNrFrequency.setText("");
}
CompletableFuture<NetworkSlicingConfig> resultFuture = new CompletableFuture<>();