Convert dataDuringCall to autoDataSWitch
The feature is enabled via TelephonyManager.MOBILE_DATA_POLICY_AUTO_DATA_SWITCH. The feature only applies to non-DDS. If enabled, we automatically switch to the non-DDS for data traffic when it has better availability than the DDS. The UI change are(as required by b/247880971): 1. data during call is replaced by auto data switch, and moved under mobile data toggle. 2. Network & internet and Internet page now show the currently active subscription, instead of the defalut subscription. If the currently active sub is not the default, it's reflected in summary as "temporarily". Test: manual Bug: 244064524 Change-Id: Ica1eba99cee0d4af528d58f1c7bd1439400bfa66
This commit is contained in:
@@ -220,7 +220,11 @@ public class SubscriptionsPreferenceController extends AbstractPreferenceControl
|
||||
return;
|
||||
}
|
||||
|
||||
SubscriptionInfo subInfo = mSubscriptionManager.getDefaultDataSubscriptionInfo();
|
||||
// Prefer using the currently active sub
|
||||
SubscriptionInfo subInfoCandidate = mSubscriptionManager.getActiveSubscriptionInfo(
|
||||
SubscriptionManager.getActiveDataSubscriptionId());
|
||||
SubscriptionInfo subInfo = mSubscriptionManager.isSubscriptionVisible(subInfoCandidate)
|
||||
? subInfoCandidate : mSubscriptionManager.getDefaultDataSubscriptionInfo();
|
||||
if (subInfo == null) {
|
||||
mPreferenceGroup.removeAll();
|
||||
return;
|
||||
@@ -255,9 +259,17 @@ public class SubscriptionsPreferenceController extends AbstractPreferenceControl
|
||||
mUpdateListener.onChildrenUpdated();
|
||||
}
|
||||
|
||||
/**@return {@code true} if subId is the default data sub. **/
|
||||
private boolean isDds(int subId) {
|
||||
return mSubscriptionManager.getDefaultDataSubscriptionInfo() != null
|
||||
&& mSubscriptionManager.getDefaultDataSubscriptionInfo().getSubscriptionId()
|
||||
== subId;
|
||||
}
|
||||
|
||||
private CharSequence getMobilePreferenceSummary(int subId) {
|
||||
final TelephonyManager tmForSubId = mTelephonyManager.createForSubscriptionId(subId);
|
||||
if (!tmForSubId.isDataEnabled()) {
|
||||
boolean isDds = isDds(subId);
|
||||
if (!tmForSubId.isDataEnabled() && isDds) {
|
||||
return mContext.getString(R.string.mobile_data_off_summary);
|
||||
}
|
||||
final ServiceState serviceState = tmForSubId.getServiceState();
|
||||
@@ -275,10 +287,12 @@ public class SubscriptionsPreferenceController extends AbstractPreferenceControl
|
||||
mContext, mConfig, mTelephonyDisplayInfo, subId, isCarrierNetworkActive);
|
||||
if (mSubsPrefCtrlInjector.isActiveCellularNetwork(mContext) || isCarrierNetworkActive) {
|
||||
if (result.isEmpty()) {
|
||||
result = mContext.getString(R.string.mobile_data_connection_active);
|
||||
result = mContext.getString(isDds ? R.string.mobile_data_connection_active
|
||||
: R.string.mobile_data_temp_connection_active);
|
||||
} else {
|
||||
result = mContext.getString(R.string.preference_summary_default_combination,
|
||||
mContext.getString(R.string.mobile_data_connection_active), result);
|
||||
mContext.getString(isDds ? R.string.mobile_data_connection_active
|
||||
: R.string.mobile_data_temp_connection_active), result);
|
||||
}
|
||||
} else if (!isDataInService) {
|
||||
result = mContext.getString(R.string.mobile_data_no_connection);
|
||||
@@ -316,9 +330,12 @@ public class SubscriptionsPreferenceController extends AbstractPreferenceControl
|
||||
final boolean isVoiceInService = (serviceState == null)
|
||||
? false
|
||||
: (serviceState.getState() == ServiceState.STATE_IN_SERVICE);
|
||||
final boolean isDataEnabled = tmForSubId.isDataEnabled()
|
||||
// non-Dds but auto data switch feature is enabled
|
||||
|| (!isDds(subId) && tmForSubId.isMobileDataPolicyEnabled(
|
||||
TelephonyManager.MOBILE_DATA_POLICY_AUTO_DATA_SWITCH));
|
||||
if (isDataInService || isVoiceInService || isCarrierNetworkActive) {
|
||||
icon = mSubsPrefCtrlInjector.getIcon(mContext, level, numLevels,
|
||||
!tmForSubId.isDataEnabled());
|
||||
icon = mSubsPrefCtrlInjector.getIcon(mContext, level, numLevels, !isDataEnabled);
|
||||
}
|
||||
|
||||
final boolean isActiveCellularNetwork =
|
||||
|
||||
Reference in New Issue
Block a user