Merge "When SIM card removed, dismiss the de-perso UI"
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/PhoneInterfaceManager.java b/src/com/android/phone/PhoneInterfaceManager.java
index 2346e32..8c6be60 100755
--- a/src/com/android/phone/PhoneInterfaceManager.java
+++ b/src/com/android/phone/PhoneInterfaceManager.java
@@ -5783,6 +5783,11 @@
private int getCarrierPrivilegeStatusFromCarrierConfigRules(int privilegeFromSim, int uid,
Phone phone) {
+ if (uid == Process.SYSTEM_UID || uid == Process.PHONE_UID) {
+ // Skip the check if it's one of these special uids
+ return TelephonyManager.CARRIER_PRIVILEGE_STATUS_HAS_ACCESS;
+ }
+
//load access rules from carrier configs, and check those as well: b/139133814
SubscriptionController subController = SubscriptionController.getInstance();
if (privilegeFromSim == TelephonyManager.CARRIER_PRIVILEGE_STATUS_HAS_ACCESS
@@ -6514,6 +6519,8 @@
@Override
public @Nullable PhoneAccountHandle getPhoneAccountHandleForSubscriptionId(int subscriptionId) {
+ enforceReadPrivilegedPermission("getPhoneAccountHandleForSubscriptionId, "
+ + "subscriptionId: " + subscriptionId);
final long identity = Binder.clearCallingIdentity();
try {
Phone phone = getPhone(subscriptionId);
@@ -7663,7 +7670,7 @@
private boolean getDefaultDataRoamingEnabled(int subId) {
final CarrierConfigManager configMgr = (CarrierConfigManager)
mApp.getSystemService(Context.CARRIER_CONFIG_SERVICE);
- boolean isDataRoamingEnabled = TelephonyProperties.data_roaming().orElse(true);
+ boolean isDataRoamingEnabled = TelephonyProperties.data_roaming().orElse(false);
isDataRoamingEnabled |= configMgr.getConfigForSubId(subId).getBoolean(
CarrierConfigManager.KEY_CARRIER_DEFAULT_DATA_ROAMING_ENABLED_BOOL);
return isDataRoamingEnabled;
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();
diff --git a/src/com/android/services/telephony/TelecomAccountRegistry.java b/src/com/android/services/telephony/TelecomAccountRegistry.java
index c38923f..ade72ec 100644
--- a/src/com/android/services/telephony/TelecomAccountRegistry.java
+++ b/src/com/android/services/telephony/TelecomAccountRegistry.java
@@ -59,7 +59,6 @@
import com.android.ims.ImsManager;
import com.android.internal.telephony.ExponentialBackoff;
-import com.android.internal.telephony.LocaleTracker;
import com.android.internal.telephony.Phone;
import com.android.internal.telephony.PhoneFactory;
import com.android.internal.telephony.SubscriptionController;
@@ -120,7 +119,7 @@
private ImsMmTelManager.CapabilityCallback mMmtelCapabilityCallback;
private RegistrationManager.RegistrationCallback mImsRegistrationCallback;
private ImsMmTelManager mMmTelManager;
- private final boolean mIsDummy;
+ private final boolean mIsTestAccount;
private boolean mIsVideoCapable;
private boolean mIsVideoPresenceSupported;
private boolean mIsVideoPauseSupported;
@@ -132,20 +131,20 @@
private boolean mIsUsingSimCallManager;
private boolean mIsShowPreciseFailedCause;
- AccountEntry(Phone phone, boolean isEmergency, boolean isDummy) {
+ AccountEntry(Phone phone, boolean isEmergency, boolean isTest) {
mPhone = phone;
mIsEmergency = isEmergency;
- mIsDummy = isDummy;
+ mIsTestAccount = isTest;
mIsAdhocConfCapable = mPhone.isImsRegistered();
- mAccount = registerPstnPhoneAccount(isEmergency, isDummy);
+ mAccount = registerPstnPhoneAccount(isEmergency, isTest);
Log.i(this, "Registered phoneAccount: %s with handle: %s",
mAccount, mAccount.getAccountHandle());
mIncomingCallNotifier = new PstnIncomingCallNotifier((Phone) mPhone);
mPhoneCapabilitiesNotifier = new PstnPhoneCapabilitiesNotifier((Phone) mPhone,
this);
- if (mIsDummy || isEmergency) {
- // For dummy and emergency entries, there is no sub ID that can be assigned, so do
+ if (mIsTestAccount || isEmergency) {
+ // For test and emergency entries, there is no sub ID that can be assigned, so do
// not register for capabilities callbacks.
return;
}
@@ -248,7 +247,7 @@
* Trigger re-registration of this account.
*/
public void reRegisterPstnPhoneAccount() {
- PhoneAccount newAccount = buildPstnPhoneAccount(mIsEmergency, mIsDummy);
+ PhoneAccount newAccount = buildPstnPhoneAccount(mIsEmergency, mIsTestAccount);
if (!newAccount.equals(mAccount)) {
Log.i(this, "reRegisterPstnPhoneAccount: subId: " + getSubId()
+ " - re-register due to account change.");
@@ -259,8 +258,8 @@
}
}
- private PhoneAccount registerPstnPhoneAccount(boolean isEmergency, boolean isDummyAccount) {
- PhoneAccount account = buildPstnPhoneAccount(mIsEmergency, mIsDummy);
+ private PhoneAccount registerPstnPhoneAccount(boolean isEmergency, boolean isTestAccount) {
+ PhoneAccount account = buildPstnPhoneAccount(mIsEmergency, mIsTestAccount);
// Register with Telecom and put into the account entry.
mTelecomManager.registerPhoneAccount(account);
return account;
@@ -269,13 +268,13 @@
/**
* Registers the specified account with Telecom as a PhoneAccountHandle.
*/
- private PhoneAccount buildPstnPhoneAccount(boolean isEmergency, boolean isDummyAccount) {
- String dummyPrefix = isDummyAccount ? "Dummy " : "";
+ private PhoneAccount buildPstnPhoneAccount(boolean isEmergency, boolean isTestAccount) {
+ String testPrefix = isTestAccount ? "Test " : "";
// Build the Phone account handle.
PhoneAccountHandle phoneAccountHandle =
PhoneUtils.makePstnPhoneAccountHandleWithPrefix(
- mPhone, dummyPrefix, isEmergency);
+ mPhone, testPrefix, isEmergency);
// Populate the phone account data.
int subId = mPhone.getSubId();
@@ -335,8 +334,8 @@
// The label is user-visible so let's use the display name that the user may
// have set in Settings->Sim cards.
- label = dummyPrefix + subDisplayName;
- description = dummyPrefix + mContext.getResources().getString(
+ label = testPrefix + subDisplayName;
+ description = testPrefix + mContext.getResources().getString(
R.string.sim_description_default, slotIdString);
}
@@ -768,7 +767,7 @@
// time we get here, the original phone account could have been torn down.
return;
}
- mAccount = registerPstnPhoneAccount(mIsEmergency, mIsDummy);
+ mAccount = registerPstnPhoneAccount(mIsEmergency, mIsTestAccount);
}
}
@@ -787,7 +786,7 @@
Log.i(this, "updateAdhocConfCapability - changed, new value: "
+ isAdhocConfCapable);
mIsAdhocConfCapable = isAdhocConfCapable;
- mAccount = registerPstnPhoneAccount(mIsEmergency, mIsDummy);
+ mAccount = registerPstnPhoneAccount(mIsEmergency, mIsTestAccount);
}
}
}
@@ -806,7 +805,7 @@
if (mIsVideoPresenceSupported != isVideoPresenceSupported) {
Log.i(this, "updateVideoPresenceCapability for subId=" + mPhone.getSubId()
+ ", new value= " + isVideoPresenceSupported);
- mAccount = registerPstnPhoneAccount(mIsEmergency, mIsDummy);
+ mAccount = registerPstnPhoneAccount(mIsEmergency, mIsTestAccount);
}
}
}
@@ -815,7 +814,7 @@
boolean isRttEnabled = isRttCurrentlySupported();
if (isRttEnabled != mIsRttCapable) {
Log.i(this, "updateRttCapability - changed, new value: " + isRttEnabled);
- mAccount = registerPstnPhoneAccount(mIsEmergency, mIsDummy);
+ mAccount = registerPstnPhoneAccount(mIsEmergency, mIsTestAccount);
}
}
@@ -824,7 +823,7 @@
activeDataSubId);
if (isEmergencyPreferred != mIsEmergencyPreferred) {
Log.i(this, "updateDefaultDataSubId - changed, new value: " + isEmergencyPreferred);
- mAccount = registerPstnPhoneAccount(mIsEmergency, mIsDummy);
+ mAccount = registerPstnPhoneAccount(mIsEmergency, mIsTestAccount);
}
}
@@ -1464,7 +1463,7 @@
}
mAccounts.add(new AccountEntry(phone, false /* emergency */,
- false /* isDummy */));
+ false /* isTest */));
}
}
} finally {
@@ -1475,14 +1474,14 @@
Log.i(this, "setupAccounts: adding default");
mAccounts.add(
new AccountEntry(PhoneFactory.getDefaultPhone(), true /* emergency */,
- false /* isDummy */));
+ false /* isTest */));
}
}
// Add a fake account entry.
- if (DBG && phones.length > 0 && "TRUE".equals(System.getProperty("dummy_sim"))) {
+ if (DBG && phones.length > 0 && "TRUE".equals(System.getProperty("test_sim"))) {
mAccounts.add(new AccountEntry(phones[0], false /* emergency */,
- true /* isDummy */));
+ true /* isTest */));
}
}