Merge changes I6194592d,I5a02f847
* changes: Add check of canConnectTo5GInDsds to show NrDisabledInDsdsFooter Define a helper link for 5G limitation in DSDS footer.
This commit is contained in:
@@ -11313,4 +11313,12 @@
|
|||||||
<!-- Subtext for showing the option of RTT setting. [CHAR LIMIT=NONE] -->
|
<!-- Subtext for showing the option of RTT setting. [CHAR LIMIT=NONE] -->
|
||||||
<string name="rtt_settings_always_visible"></string>
|
<string name="rtt_settings_always_visible"></string>
|
||||||
|
|
||||||
|
<!-- Footer to show current limitation of 5G on DSDS mode. [CHAR LIMIT=NONE] -->
|
||||||
|
<string name="no_5g_in_dsds_text" product="default">When using 2 SIMs, this phone will be limited to 4G. <annotation id="url">Learn more</annotation>.</string>
|
||||||
|
<!-- Footer to show current limitation of 5G on DSDS mode for tablets. [CHAR LIMIT=NONE] -->
|
||||||
|
<string name="no_5g_in_dsds_text" product="tablet">When using 2 SIMs, this tablet will be limited to 4G. <annotation id="url">Learn more</annotation>.</string>
|
||||||
|
<!-- Footer to show current limitation of 5G on DSDS mode for general devices. [CHAR LIMIT=NONE] -->
|
||||||
|
<string name="no_5g_in_dsds_text" product="device">When using 2 SIMs, this device will be limited to 4G. <annotation id="url">Learn more</annotation>.</string>
|
||||||
|
<!-- Help URI, 5G limitation in DSDS condition. [DO NOT TRANSLATE] -->
|
||||||
|
<string name="help_uri_5g_dsds" translatable="false"></string>
|
||||||
</resources>
|
</resources>
|
||||||
|
@@ -17,10 +17,17 @@
|
|||||||
package com.android.settings.network.telephony;
|
package com.android.settings.network.telephony;
|
||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
|
import android.content.Intent;
|
||||||
import android.telephony.SubscriptionManager;
|
import android.telephony.SubscriptionManager;
|
||||||
import android.telephony.TelephonyManager;
|
import android.telephony.TelephonyManager;
|
||||||
|
|
||||||
|
import androidx.preference.Preference;
|
||||||
|
|
||||||
|
import com.android.settings.R;
|
||||||
import com.android.settings.core.BasePreferenceController;
|
import com.android.settings.core.BasePreferenceController;
|
||||||
|
import com.android.settings.utils.AnnotationSpan;
|
||||||
|
import com.android.settingslib.HelpUtils;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class to show the footer that can't connect to 5G when device is in DSDS mode.
|
* Class to show the footer that can't connect to 5G when device is in DSDS mode.
|
||||||
@@ -43,6 +50,29 @@ public class NrDisabledInDsdsFooterPreferenceController extends BasePreferenceCo
|
|||||||
mSubId = subId;
|
mSubId = subId;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void updateState(Preference preference) {
|
||||||
|
super.updateState(preference);
|
||||||
|
|
||||||
|
if (preference != null) {
|
||||||
|
preference.setTitle(getFooterText());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private CharSequence getFooterText() {
|
||||||
|
final Intent helpIntent = HelpUtils.getHelpIntent(mContext,
|
||||||
|
mContext.getString(R.string.help_uri_5g_dsds),
|
||||||
|
mContext.getClass().getName());
|
||||||
|
final AnnotationSpan.LinkInfo linkInfo = new AnnotationSpan.LinkInfo(mContext,
|
||||||
|
"url", helpIntent);
|
||||||
|
|
||||||
|
if (linkInfo.isActionable()) {
|
||||||
|
return AnnotationSpan.linkify(mContext.getText(R.string.no_5g_in_dsds_text), linkInfo);
|
||||||
|
} else {
|
||||||
|
return mContext.getText(R.string.no_5g_in_dsds_text);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getAvailabilityStatus() {
|
public int getAvailabilityStatus() {
|
||||||
if (mSubId == SubscriptionManager.INVALID_SUBSCRIPTION_ID) {
|
if (mSubId == SubscriptionManager.INVALID_SUBSCRIPTION_ID) {
|
||||||
@@ -52,13 +82,18 @@ public class NrDisabledInDsdsFooterPreferenceController extends BasePreferenceCo
|
|||||||
final TelephonyManager teleManager = ((TelephonyManager)
|
final TelephonyManager teleManager = ((TelephonyManager)
|
||||||
mContext.getSystemService(Context.TELEPHONY_SERVICE))
|
mContext.getSystemService(Context.TELEPHONY_SERVICE))
|
||||||
.createForSubscriptionId(mSubId);
|
.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
|
// Show the footer only when DSDS is enabled, and mobile data is enabled on this SIM, and
|
||||||
// 5G is supported on this device.
|
// 5G is supported on this device.
|
||||||
if (!teleManager.isDataEnabled() || teleManager.getActiveModemCount() < 2
|
if (teleManager.isDataEnabled() && activeSubCount >= 2 && is5GSupportedByRadio(teleManager)
|
||||||
|| !is5GSupportedByRadio(teleManager)) {
|
&& !teleManager.canConnectTo5GInDsdsMode()) {
|
||||||
|
return AVAILABLE;
|
||||||
|
} else {
|
||||||
return CONDITIONALLY_UNAVAILABLE;
|
return CONDITIONALLY_UNAVAILABLE;
|
||||||
}
|
}
|
||||||
return AVAILABLE;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean is5GSupportedByRadio(TelephonyManager tm) {
|
private boolean is5GSupportedByRadio(TelephonyManager tm) {
|
||||||
|
Reference in New Issue
Block a user