Skip to content

Commit 9f051c1

Browse files
empratyushmuhomorr
authored andcommitted
restrict '5G Only' mode to standalone 5G supported carrier.
many carrier where 5G network options is available (in settings) doesn't really support standalone 5G and in that case setting it to 'NR/5G only' soft fails. it is disabled for NSA carrier, calling options will be broken on NSA (non standalone 5G).
1 parent 428ee1c commit 9f051c1

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

src/com/android/settings/network/telephony/EnabledNetworkModePreferenceController.java

+12-1
Original file line numberDiff line numberDiff line change
@@ -215,6 +215,7 @@ private final class PreferenceEntriesBuilder {
215215
private boolean mDisplay2gOptions;
216216
private boolean mDisplay3gOptions;
217217
private boolean mLteEnabled;
218+
private boolean isNrSaAvailable; // Nr-Sa (5G standalone)
218219
private int mSelectedEntry;
219220
private int mSubId;
220221
private String mSummary;
@@ -278,6 +279,14 @@ public void updateConfig() {
278279
}
279280

280281
mLteEnabled = carrierConfig.getBoolean(CarrierConfigManager.KEY_LTE_ENABLED_BOOL);
282+
int[] supported5gOptions = carrierConfig.getIntArray(
283+
CarrierConfigManager.KEY_CARRIER_NR_AVAILABILITIES_INT_ARRAY);
284+
isNrSaAvailable = supported5gOptions != null && com.google.common.primitives.Ints.contains(
285+
supported5gOptions,
286+
CarrierConfigManager.CARRIER_NR_AVAILABILITY_SA
287+
) && (mTelephonyManager.getAllowedNetworkTypesForReason(TelephonyManager.ALLOWED_NETWORK_TYPES_REASON_USER)
288+
& TelephonyManager.NETWORK_TYPE_BITMASK_NR
289+
) > 0;
281290
}
282291
Log.d(LOG_TAG, "PreferenceEntriesBuilder: subId" + mSubId
283292
+ " ,Supported5gRadioAccessFamily :" + mSupported5gRadioAccessFamily
@@ -460,7 +469,9 @@ void setPreferenceEntries() {
460469

461470
if (!lteOnlyUnsupported && is5GSupported.get()) {
462471
addNrOrLteOnlyEntry();
463-
addNrOnlyEntry();
472+
if (isNrSaAvailable) {
473+
addNrOnlyEntry();
474+
}
464475
}
465476
}
466477

0 commit comments

Comments
 (0)