From 99e64da8994668fdb615e6aa4a883dc0c6fe2785 Mon Sep 17 00:00:00 2001 From: Malcolm Chen Date: Tue, 14 Apr 2020 11:26:23 -0700 Subject: [PATCH] Add check of canConnectTo5GInDsds to show NrDisabledInDsdsFooter Bug: 152786064 Test: build and manual Change-Id: I6194592d9a7bf4d4b7993fc344d7392bf5c296aa Merged-In: I6194592d9a7bf4d4b7993fc344d7392bf5c296aa --- .../NrDisabledInDsdsFooterPreferenceController.java | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/com/android/settings/network/telephony/NrDisabledInDsdsFooterPreferenceController.java b/src/com/android/settings/network/telephony/NrDisabledInDsdsFooterPreferenceController.java index b8cf9966850..4077e91ae8d 100644 --- a/src/com/android/settings/network/telephony/NrDisabledInDsdsFooterPreferenceController.java +++ b/src/com/android/settings/network/telephony/NrDisabledInDsdsFooterPreferenceController.java @@ -82,13 +82,18 @@ public class NrDisabledInDsdsFooterPreferenceController extends BasePreferenceCo final TelephonyManager teleManager = ((TelephonyManager) mContext.getSystemService(Context.TELEPHONY_SERVICE)) .createForSubscriptionId(mSubId); + final SubscriptionManager subManager = ((SubscriptionManager) + mContext.getSystemService(Context.TELEPHONY_SUBSCRIPTION_SERVICE)); + final int[] activeSubIdList = subManager.getActiveSubscriptionIdList(); + final int activeSubCount = activeSubIdList == null ? 0 : activeSubIdList.length; // Show the footer only when DSDS is enabled, and mobile data is enabled on this SIM, and // 5G is supported on this device. - if (!teleManager.isDataEnabled() || teleManager.getActiveModemCount() < 2 - || !is5GSupportedByRadio(teleManager)) { + if (teleManager.isDataEnabled() && activeSubCount >= 2 && is5GSupportedByRadio(teleManager) + && !teleManager.canConnectTo5GInDsdsMode()) { + return AVAILABLE; + } else { return CONDITIONALLY_UNAVAILABLE; } - return AVAILABLE; } private boolean is5GSupportedByRadio(TelephonyManager tm) {