Add 5G stats to Phone info menu
Make sure 5G stats only show if device supports 5G
Test: manual testing *#*#INFO#*#* with 5G
Test: manual testing 5G stats don't show up for blueline
Bug: 160825855
Change-Id: I1daa0ef277fec3cf40af77480853d850d43ba826
Merged-In: I1daa0ef277fec3cf40af77480853d850d43ba826
diff --git a/res/layout/radio_info.xml b/res/layout/radio_info.xml
index 40c2e53..71cd32a 100644
--- a/res/layout/radio_info.xml
+++ b/res/layout/radio_info.xml
@@ -122,6 +122,37 @@
<TextView android:id="@+id/ul_kbps" style="@style/info_value" />
</LinearLayout>
+
+ <!-- EN-DC Available -->
+ <LinearLayout style="@style/RadioInfo_entry_layout" android:orientation="horizontal">
+ <TextView android:id="@+id/endc_available_label" android:text="@string/radio_info_endc_available" style="@style/info_label" />
+ <TextView android:id="@+id/endc_available" style="@style/info_value" />
+ </LinearLayout>
+
+ <!-- DCNR Restricted -->
+ <LinearLayout style="@style/RadioInfo_entry_layout" android:orientation="horizontal">
+ <TextView android:id="@+id/dcnr_restricted_label" android:text="@string/radio_info_dcnr_restricted" style="@style/info_label" />
+ <TextView android:id="@+id/dcnr_restricted" style="@style/info_value" />
+ </LinearLayout>
+
+ <!-- NR Available -->
+ <LinearLayout style="@style/RadioInfo_entry_layout" android:orientation="horizontal">
+ <TextView android:id="@+id/nr_available_label" android:text="@string/radio_info_nr_available" style="@style/info_label" />
+ <TextView android:id="@+id/nr_available" style="@style/info_value" />
+ </LinearLayout>
+
+ <!-- NR State -->
+ <LinearLayout style="@style/RadioInfo_entry_layout" android:orientation="horizontal">
+ <TextView android:id="@+id/nr_state_label" android:text="@string/radio_info_nr_state" style="@style/info_label" />
+ <TextView android:id="@+id/nr_state" style="@style/info_value" />
+ </LinearLayout>
+
+ <!-- NR Frequency -->
+ <LinearLayout style="@style/RadioInfo_entry_layout" android:orientation="horizontal">
+ <TextView android:id="@+id/nr_frequency_label" android:text="@string/radio_info_nr_frequency" style="@style/info_label" />
+ <TextView android:id="@+id/nr_frequency" style="@style/info_value" />
+ </LinearLayout>
+
<!-- Physical Channel Config -->
<LinearLayout style="@style/RadioInfo_entry_layout">
<TextView android:text="@string/radio_info_phy_chan_config" style="@style/info_label" />
diff --git a/res/values/strings.xml b/res/values/strings.xml
index b74b2ff..54047c2 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -2140,6 +2140,16 @@
<string name="radio_info_toggle_dns_check_label">Toggle DNS Check</string>
<!-- Radio Info screen. Label for a status item. Used for diagnostic info screens, precise translation isn't needed -->
<string name="oem_radio_info_label">OEM-specific Info/Settings</string>
+ <!-- Radio Info screen. Label for a status item. Used for diagnostic info screens, precise translation isn't needed -->
+ <string name="radio_info_endc_available">EN-DC Available:</string>
+ <!-- Radio Info screen. Label for a status item. Used for diagnostic info screens, precise translation isn't needed -->
+ <string name="radio_info_dcnr_restricted">DCNR Restricted:</string>
+ <!-- Radio Info screen. Label for a status item. Used for diagnostic info screens, precise translation isn't needed -->
+ <string name="radio_info_nr_available">NR Available:</string>
+ <!-- Radio Info screen. Label for a status item. Used for diagnostic info screens, precise translation isn't needed -->
+ <string name="radio_info_nr_state">NR State:</string>
+ <!-- Radio Info screen. Label for a status item. Used for diagnostic info screens, precise translation isn't needed -->
+ <string name="radio_info_nr_frequency">NR Frequency:</string>
<!-- Band Mode Selection -->
<!-- Band mode screen. Title of activity. -->
diff --git a/src/com/android/phone/settings/RadioInfo.java b/src/com/android/phone/settings/RadioInfo.java
index d0951e4..f20da59 100644
--- a/src/com/android/phone/settings/RadioInfo.java
+++ b/src/com/android/phone/settings/RadioInfo.java
@@ -41,6 +41,7 @@
import android.os.PersistableBundle;
import android.os.SystemProperties;
import android.provider.Settings;
+import android.telephony.AccessNetworkConstants;
import android.telephony.CarrierConfigManager;
import android.telephony.CellIdentityCdma;
import android.telephony.CellIdentityGsm;
@@ -56,6 +57,8 @@
import android.telephony.CellSignalStrengthGsm;
import android.telephony.CellSignalStrengthLte;
import android.telephony.CellSignalStrengthWcdma;
+import android.telephony.DataSpecificRegistrationInfo;
+import android.telephony.NetworkRegistrationInfo;
import android.telephony.PhoneStateListener;
import android.telephony.PhysicalChannelConfig;
import android.telephony.PreciseCallState;
@@ -240,6 +243,11 @@
private TextView mDnsCheckState;
private TextView mDownlinkKbps;
private TextView mUplinkKbps;
+ private TextView mEndcAvailable;
+ private TextView mDcnrRestricted;
+ private TextView mNrAvailable;
+ private TextView mNrState;
+ private TextView mNrFrequency;
private EditText mSmsc;
private Switch mRadioPowerOnSwitch;
private Button mCellInfoRefreshRateButton;
@@ -357,6 +365,7 @@
updateRadioPowerState();
updateNetworkType();
updateImsProvisionedState();
+ updateNrStats(serviceState);
}
}
@@ -501,9 +510,28 @@
mPingHostnameV4 = (TextView) findViewById(R.id.pingHostnameV4);
mPingHostnameV6 = (TextView) findViewById(R.id.pingHostnameV6);
mHttpClientTest = (TextView) findViewById(R.id.httpClientTest);
-
+ mEndcAvailable = (TextView) findViewById(R.id.endc_available);
+ mDcnrRestricted = (TextView) findViewById(R.id.dcnr_restricted);
+ mNrAvailable = (TextView) findViewById(R.id.nr_available);
+ mNrState = (TextView) findViewById(R.id.nr_state);
+ mNrFrequency = (TextView) findViewById(R.id.nr_frequency);
mPhyChanConfig = (TextView) findViewById(R.id.phy_chan_config);
+ // hide 5G stats on devices that don't support 5G
+ if ((mTelephonyManager.getSupportedRadioAccessFamily()
+ & TelephonyManager.NETWORK_TYPE_BITMASK_NR) == 0) {
+ ((TextView) findViewById(R.id.endc_available_label)).setVisibility(View.GONE);
+ mEndcAvailable.setVisibility(View.GONE);
+ ((TextView) findViewById(R.id.dcnr_restricted_label)).setVisibility(View.GONE);
+ mDcnrRestricted.setVisibility(View.GONE);
+ ((TextView) findViewById(R.id.nr_available_label)).setVisibility(View.GONE);
+ mNrAvailable.setVisibility(View.GONE);
+ ((TextView) findViewById(R.id.nr_state_label)).setVisibility(View.GONE);
+ mNrState.setVisibility(View.GONE);
+ ((TextView) findViewById(R.id.nr_frequency_label)).setVisibility(View.GONE);
+ mNrFrequency.setVisibility(View.GONE);
+ }
+
mPreferredNetworkType = (Spinner) findViewById(R.id.preferredNetworkType);
ArrayAdapter<String> mPreferredNetworkTypeAdapter = new ArrayAdapter<String>(this,
android.R.layout.simple_spinner_item, PREFERRED_NETWORK_LABELS);
@@ -625,6 +653,7 @@
updateProperties();
updateDnsCheckState();
updateNetworkType();
+ updateNrStats(null);
updateLocation(mCellLocationResult);
updateCellInfo(mCellInfoResult);
@@ -1132,6 +1161,32 @@
}
}
+ private void updateNrStats(ServiceState serviceState) {
+ if ((mTelephonyManager.getSupportedRadioAccessFamily()
+ & TelephonyManager.NETWORK_TYPE_BITMASK_NR) == 0) {
+ return;
+ }
+
+ ServiceState ss = serviceState;
+ if (ss == null && mPhone != null) {
+ ss = mPhone.getServiceState();
+ }
+ if (ss != null) {
+ NetworkRegistrationInfo nri = ss.getNetworkRegistrationInfo(
+ NetworkRegistrationInfo.DOMAIN_PS, AccessNetworkConstants.TRANSPORT_TYPE_WWAN);
+ if (nri != null) {
+ DataSpecificRegistrationInfo dsri = nri.getDataSpecificInfo();
+ if (dsri != null) {
+ mEndcAvailable.setText(dsri.isEnDcAvailable ? "True" : "False");
+ mDcnrRestricted.setText(dsri.isDcNrRestricted ? "True" : "False");
+ mNrAvailable.setText(dsri.isNrAvailable ? "True" : "False");
+ }
+ }
+ mNrState.setText(NetworkRegistrationInfo.nrStateToString(ss.getNrState()));
+ mNrFrequency.setText(ServiceState.frequencyRangeToString(ss.getNrFrequencyRange()));
+ }
+ }
+
private void updateProperties() {
String s;
Resources r = getResources();