Merge "For guest users, make all Mobile settings non-searchable."
diff --git a/res/values/config.xml b/res/values/config.xml
index 615d43f..b3fc30a 100644
--- a/res/values/config.xml
+++ b/res/values/config.xml
@@ -232,6 +232,9 @@
disconnecting the ongoing Telephony call when the call goes active. -->
<bool name="config_support_handover_from">false</bool>
+ <!-- Flag indicating whether the device supports RTT (real-time text) -->
+ <bool name="config_support_rtt">false</bool>
+
<!-- Flag indicating whether a system app can use video calling fallback if carrier video
calling is not available. -->
<bool name="config_support_video_calling_fallback">false</bool>
diff --git a/src/com/android/phone/CarrierConfigLoader.java b/src/com/android/phone/CarrierConfigLoader.java
index a26e3d8..df006e2 100644
--- a/src/com/android/phone/CarrierConfigLoader.java
+++ b/src/com/android/phone/CarrierConfigLoader.java
@@ -776,11 +776,15 @@
PersistableBundle retConfig = CarrierConfigManager.getDefaultConfig();
if (SubscriptionManager.isValidPhoneId(phoneId)) {
PersistableBundle config = mConfigFromDefaultApp[phoneId];
- if (config != null)
+ if (config != null) {
retConfig.putAll(config);
+ retConfig.putBoolean(CarrierConfigManager.KEY_CARRIER_CONFIG_APPLIED_BOOL, true);
+ }
config = mConfigFromCarrierApp[phoneId];
- if (config != null)
+ if (config != null) {
retConfig.putAll(config);
+ retConfig.putBoolean(CarrierConfigManager.KEY_CARRIER_CONFIG_APPLIED_BOOL, true);
+ }
}
return retConfig;
}
diff --git a/src/com/android/phone/CdmaOptions.java b/src/com/android/phone/CdmaOptions.java
index 8749565..7c09265 100644
--- a/src/com/android/phone/CdmaOptions.java
+++ b/src/com/android/phone/CdmaOptions.java
@@ -26,6 +26,8 @@
import android.telephony.CarrierConfigManager;
import android.text.TextUtils;
+import com.android.internal.logging.MetricsLogger;
+import com.android.internal.logging.nano.MetricsProto.MetricsEvent;
import com.android.internal.telephony.Phone;
/**
@@ -95,6 +97,8 @@
new Preference.OnPreferenceClickListener() {
@Override
public boolean onPreferenceClick(Preference preference) {
+ MetricsLogger.action(mButtonAPNExpand.getContext(),
+ MetricsEvent.ACTION_MOBILE_NETWORK_APN_SETTINGS);
// We need to build the Intent by hand as the Preference Framework
// does not allow to add an Intent with some extras into a Preference
// XML file
diff --git a/src/com/android/phone/GsmUmtsOptions.java b/src/com/android/phone/GsmUmtsOptions.java
index a68b1cb..5cf19ad 100644
--- a/src/com/android/phone/GsmUmtsOptions.java
+++ b/src/com/android/phone/GsmUmtsOptions.java
@@ -21,10 +21,11 @@
import android.preference.Preference;
import android.preference.PreferenceFragment;
import android.preference.PreferenceScreen;
-import android.preference.TwoStatePreference;
import android.provider.Settings;
import android.telephony.CarrierConfigManager;
+import com.android.internal.logging.MetricsLogger;
+import com.android.internal.logging.nano.MetricsProto.MetricsEvent;
import com.android.internal.telephony.PhoneConstants;
import com.android.internal.telephony.PhoneFactory;
@@ -116,6 +117,8 @@
new Preference.OnPreferenceClickListener() {
@Override
public boolean onPreferenceClick(Preference preference) {
+ MetricsLogger.action(mButtonAPNExpand.getContext(),
+ MetricsEvent.ACTION_MOBILE_NETWORK_APN_SETTINGS);
// We need to build the Intent by hand as the Preference Framework
// does not allow to add an Intent with some extras into a Preference
// XML file
diff --git a/src/com/android/phone/MobileDataPreference.java b/src/com/android/phone/MobileDataPreference.java
index fe70028..38d700e 100644
--- a/src/com/android/phone/MobileDataPreference.java
+++ b/src/com/android/phone/MobileDataPreference.java
@@ -36,6 +36,9 @@
import android.view.View;
import android.widget.Checkable;
+import com.android.internal.logging.MetricsLogger;
+import com.android.internal.logging.nano.MetricsProto.MetricsEvent;
+
import java.util.List;
/**
@@ -156,6 +159,10 @@
private void setMobileDataEnabled(boolean enabled) {
if (DBG) Log.d(TAG, "setMobileDataEnabled(" + enabled + "," + mSubId + ")");
+
+ MetricsLogger.action(getContext(), MetricsEvent.ACTION_MOBILE_NETWORK_MOBILE_DATA_TOGGLE,
+ enabled);
+
mTelephonyManager.setDataEnabled(mSubId, enabled);
setChecked(enabled);
}
diff --git a/src/com/android/phone/MobileNetworkSettings.java b/src/com/android/phone/MobileNetworkSettings.java
index 0cd3c05..5909f03 100644
--- a/src/com/android/phone/MobileNetworkSettings.java
+++ b/src/com/android/phone/MobileNetworkSettings.java
@@ -49,13 +49,13 @@
import android.telecom.PhoneAccountHandle;
import android.telecom.TelecomManager;
import android.telephony.CarrierConfigManager;
-import android.telephony.ims.feature.ImsFeature;
import android.telephony.PhoneStateListener;
import android.telephony.ServiceState;
import android.telephony.SubscriptionInfo;
import android.telephony.SubscriptionManager;
import android.telephony.TelephonyManager;
import android.telephony.euicc.EuiccManager;
+import android.telephony.ims.feature.ImsFeature;
import android.text.TextUtils;
import android.util.Log;
import android.view.LayoutInflater;
@@ -76,7 +76,6 @@
import com.android.phone.settings.PhoneAccountSettingsFragment;
import com.android.settingslib.RestrictedLockUtils;
-
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
@@ -186,6 +185,7 @@
private static final String BUTTON_CELL_BROADCAST_SETTINGS = "cell_broadcast_settings";
private static final String BUTTON_CARRIER_SETTINGS_KEY = "carrier_settings_key";
private static final String BUTTON_CDMA_SYSTEM_SELECT_KEY = "cdma_system_select_key";
+ private static final String BUTTON_CDMA_SUBSCRIPTION_KEY = "cdma_subscription_key";
private static final String BUTTON_CARRIER_SETTINGS_EUICC_KEY =
"carrier_settings_euicc_key";
private static final String BUTTON_WIFI_CALLING_KEY = "wifi_calling_key";
@@ -196,6 +196,8 @@
private static final String CATEGORY_CALLING_KEY = "calling";
private static final String CATEGORY_GSM_APN_EXPAND_KEY = "category_gsm_apn_key";
private static final String CATEGORY_CDMA_APN_EXPAND_KEY = "category_cdma_apn_key";
+ private static final String BUTTON_GSM_APN_EXPAND_KEY = "button_gsm_apn_key";
+ private static final String BUTTON_CDMA_APN_EXPAND_KEY = "button_cdma_apn_key";
private final BroadcastReceiver mPhoneChangeReceiver = new PhoneChangeReceiver();
@@ -328,6 +330,9 @@
public void onPositiveButtonClick(DialogFragment dialog) {
mPhone.setDataRoamingEnabled(true);
mButtonDataRoam.setChecked(true);
+ MetricsLogger.action(getContext(),
+ getMetricsEventCategory(getPreferenceScreen(), mButtonDataRoam),
+ true);
}
@Override
@@ -622,12 +627,6 @@
bindNetworkQueryService();
- if (mUm.hasUserRestriction(UserManager.DISALLOW_CONFIG_MOBILE_NETWORKS)) {
- mUnavailable = true;
- activity.setContentView(R.layout.telephony_disallowed_preference_screen);
- return;
- }
-
addPreferencesFromResource(R.xml.network_setting_fragment);
mButton4glte = (SwitchPreference)findPreference(BUTTON_4G_LTE_KEY);
@@ -688,7 +687,13 @@
@Override
public void onActivityCreated(Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState);
- initializeSubscriptions();
+ if (mUm.hasUserRestriction(UserManager.DISALLOW_CONFIG_MOBILE_NETWORKS)
+ || !mUm.isSystemUser()) {
+ mUnavailable = true;
+ getActivity().setContentView(R.layout.telephony_disallowed_preference_screen);
+ } else {
+ initializeSubscriptions();
+ }
}
private class PhoneChangeReceiver extends BroadcastReceiver {
@@ -1022,6 +1027,19 @@
}
}
+ /**
+ * Listen to extra preference changes that need as Metrics events logging.
+ */
+ if (prefSet.findPreference(BUTTON_CDMA_SYSTEM_SELECT_KEY) != null) {
+ prefSet.findPreference(BUTTON_CDMA_SYSTEM_SELECT_KEY)
+ .setOnPreferenceChangeListener(this);
+ }
+
+ if (prefSet.findPreference(BUTTON_CDMA_SUBSCRIPTION_KEY) != null) {
+ prefSet.findPreference(BUTTON_CDMA_SUBSCRIPTION_KEY)
+ .setOnPreferenceChangeListener(this);
+ }
+
// Get the networkMode from Settings.System and displays it
mButtonEnabledNetworks.setValue(Integer.toString(settingsNetworkMode));
mButtonPreferredNetworkMode.setValue(Integer.toString(settingsNetworkMode));
@@ -1106,6 +1124,8 @@
* display value.
*/
public boolean onPreferenceChange(Preference preference, Object objValue) {
+ sendMetricsEventPreferenceChanged(getPreferenceScreen(), preference, objValue);
+
final int phoneSubId = mPhone.getSubId();
if (preference == mButtonPreferredNetworkMode) {
//NOTE onPreferenceChange seems to be called even if there is no change
@@ -1225,6 +1245,9 @@
CarrierConfigManager.KEY_DISABLE_CHARGE_INDICATION_BOOL)) {
mPhone.setDataRoamingEnabled(true);
} else {
+ // MetricsEvent with no value update.
+ MetricsLogger.action(getContext(),
+ getMetricsEventCategory(getPreferenceScreen(), mButtonDataRoam));
// First confirm with a warning dialog about charges
mOkClicked = false;
RoamingDialogFragment fragment = new RoamingDialogFragment();
@@ -1234,8 +1257,11 @@
}
} else {
mPhone.setDataRoamingEnabled(false);
+ MetricsLogger.action(getContext(),
+ getMetricsEventCategory(getPreferenceScreen(), mButtonDataRoam),
+ false);
+ return true;
}
- return true;
} else if (preference == mVideoCallingPref) {
// If mButton4glte is not checked, mVideoCallingPref should be disabled.
// So it only makes sense to call phoneMgr.enableVideoCalling if it's checked.
@@ -1247,6 +1273,11 @@
mVideoCallingPref.setEnabled(false);
return false;
}
+ } else if (preference == getPreferenceScreen()
+ .findPreference(BUTTON_CDMA_SYSTEM_SELECT_KEY)
+ || preference == getPreferenceScreen()
+ .findPreference(BUTTON_CDMA_SUBSCRIPTION_KEY)) {
+ return true;
}
updateBody();
@@ -1813,17 +1844,104 @@
return false;
}
+ /**
+ * Metrics events related methods. it takes care of all preferences possible in this
+ * fragment(except a few that log on their own). It doesn't only include preferences in
+ * network_setting_fragment.xml, but also those defined in GsmUmtsOptions and CdmaOptions.
+ */
private void sendMetricsEventPreferenceClicked(
PreferenceScreen preferenceScreen, Preference preference) {
- if (preference == mMobileDataPref) {
- MetricsLogger.action(getContext(),
- MetricsEvent.ACTION_MOBILE_NETWORK_MOBILE_DATA_TOGGLE,
- ((MobileDataPreference) preference).mChecked);
- } else if (preference == mDataUsagePref) {
- MetricsLogger.action(getContext(),
- MetricsEvent.ACTION_MOBILE_NETWORK_DATA_USAGE);
+ final int category = getMetricsEventCategory(preferenceScreen, preference);
+ if (category == MetricsEvent.VIEW_UNKNOWN) {
+ return;
}
- // TODO: add Metrics constants for other preferences and send events here accordingly.
+
+ // Send MetricsEvent on click. It includes preferences other than SwitchPreferences,
+ // which send MetricsEvent in onPreferenceChange.
+ // For ListPreferences, we log it here without a value, only indicating it's clicked to
+ // open the list dialog. When a value is chosen, another MetricsEvent is logged with
+ // new value in onPreferenceChange.
+ if (preference == mLteDataServicePref || preference == mDataUsagePref
+ || preference == mEuiccSettingsPref || preference == mAdvancedOptions
+ || preference == mWiFiCallingPref || preference == mButtonPreferredNetworkMode
+ || preference == mButtonEnabledNetworks
+ || preference == preferenceScreen.findPreference(BUTTON_CDMA_SYSTEM_SELECT_KEY)
+ || preference == preferenceScreen.findPreference(BUTTON_CDMA_SUBSCRIPTION_KEY)
+ || preference == preferenceScreen.findPreference(BUTTON_GSM_APN_EXPAND_KEY)
+ || preference == preferenceScreen.findPreference(BUTTON_CDMA_APN_EXPAND_KEY)
+ || preference == preferenceScreen.findPreference(BUTTON_CARRIER_SETTINGS_KEY)) {
+ MetricsLogger.action(getContext(), category);
+ }
+ }
+
+ private void sendMetricsEventPreferenceChanged(
+ PreferenceScreen preferenceScreen, Preference preference, Object newValue) {
+ final int category = getMetricsEventCategory(preferenceScreen, preference);
+ if (category == MetricsEvent.VIEW_UNKNOWN) {
+ return;
+ }
+
+ // MetricsEvent logging with new value, for SwitchPreferences and ListPreferences.
+ if (preference == mButton4glte || preference == mVideoCallingPref) {
+ MetricsLogger.action(getContext(), category, (Boolean) newValue);
+ } else if (preference == mButtonPreferredNetworkMode
+ || preference == mButtonEnabledNetworks
+ || preference == preferenceScreen
+ .findPreference(BUTTON_CDMA_SYSTEM_SELECT_KEY)
+ || preference == preferenceScreen
+ .findPreference(BUTTON_CDMA_SUBSCRIPTION_KEY)) {
+ // Network select preference sends metrics event in its own listener.
+ MetricsLogger.action(getContext(), category, Integer.valueOf((String) newValue));
+ }
+ }
+
+ private int getMetricsEventCategory(
+ PreferenceScreen preferenceScreen, Preference preference) {
+
+ if (preference == null) {
+ return MetricsEvent.VIEW_UNKNOWN;
+ } else if (preference == mMobileDataPref) {
+ return MetricsEvent.ACTION_MOBILE_NETWORK_MOBILE_DATA_TOGGLE;
+ } else if (preference == mButtonDataRoam) {
+ return MetricsEvent.ACTION_MOBILE_NETWORK_DATA_ROAMING_TOGGLE;
+ } else if (preference == mDataUsagePref) {
+ return MetricsEvent.ACTION_MOBILE_NETWORK_DATA_USAGE;
+ } else if (preference == mLteDataServicePref) {
+ return MetricsEvent.ACTION_MOBILE_NETWORK_SET_UP_DATA_SERVICE;
+ } else if (preference == mAdvancedOptions) {
+ return MetricsEvent.ACTION_MOBILE_NETWORK_EXPAND_ADVANCED_FIELDS;
+ } else if (preference == mButton4glte) {
+ return MetricsEvent.ACTION_MOBILE_ENHANCED_4G_LTE_MODE_TOGGLE;
+ } else if (preference == mButtonPreferredNetworkMode) {
+ return MetricsEvent.ACTION_MOBILE_NETWORK_SELECT_PREFERRED_NETWORK;
+ } else if (preference == mButtonEnabledNetworks) {
+ return MetricsEvent.ACTION_MOBILE_NETWORK_SELECT_ENABLED_NETWORK;
+ } else if (preference == mEuiccSettingsPref) {
+ return MetricsEvent.ACTION_MOBILE_NETWORK_EUICC_SETTING;
+ } else if (preference == mWiFiCallingPref) {
+ return MetricsEvent.ACTION_MOBILE_NETWORK_WIFI_CALLING;
+ } else if (preference == mVideoCallingPref) {
+ return MetricsEvent.ACTION_MOBILE_NETWORK_VIDEO_CALLING_TOGGLE;
+ } else if (preference == preferenceScreen
+ .findPreference(NetworkOperators.BUTTON_AUTO_SELECT_KEY)) {
+ return MetricsEvent.ACTION_MOBILE_NETWORK_AUTO_SELECT_NETWORK_TOGGLE;
+ } else if (preference == preferenceScreen
+ .findPreference(NetworkOperators.BUTTON_NETWORK_SELECT_KEY)) {
+ return MetricsEvent.ACTION_MOBILE_NETWORK_MANUAL_SELECT_NETWORK;
+ } else if (preference == preferenceScreen
+ .findPreference(BUTTON_CDMA_SYSTEM_SELECT_KEY)) {
+ return MetricsEvent.ACTION_MOBILE_NETWORK_CDMA_SYSTEM_SELECT;
+ } else if (preference == preferenceScreen
+ .findPreference(BUTTON_CDMA_SUBSCRIPTION_KEY)) {
+ return MetricsEvent.ACTION_MOBILE_NETWORK_CDMA_SUBSCRIPTION_SELECT;
+ } else if (preference == preferenceScreen.findPreference(BUTTON_GSM_APN_EXPAND_KEY)
+ || preference == preferenceScreen.findPreference(BUTTON_CDMA_APN_EXPAND_KEY)) {
+ return MetricsEvent.ACTION_MOBILE_NETWORK_APN_SETTINGS;
+ } else if (preference == preferenceScreen.findPreference(BUTTON_CARRIER_SETTINGS_KEY)) {
+ return MetricsEvent.ACTION_MOBILE_NETWORK_CARRIER_SETTINGS;
+ } else {
+ return MetricsEvent.VIEW_UNKNOWN;
+ }
}
private void updateGsmUmtsOptions(PreferenceFragment prefFragment,
diff --git a/src/com/android/phone/NetworkOperators.java b/src/com/android/phone/NetworkOperators.java
index 4ac5c84..05cfe42 100644
--- a/src/com/android/phone/NetworkOperators.java
+++ b/src/com/android/phone/NetworkOperators.java
@@ -30,6 +30,8 @@
import android.util.AttributeSet;
import android.util.Log;
+import com.android.internal.logging.MetricsLogger;
+import com.android.internal.logging.nano.MetricsProto.MetricsEvent;
import com.android.internal.telephony.CommandException;
import com.android.internal.telephony.Phone;
import com.android.internal.telephony.PhoneFactory;
@@ -112,6 +114,8 @@
if (preference == mAutoSelect) {
boolean autoSelect = (Boolean) newValue;
selectNetworkAutomatic(autoSelect);
+ MetricsLogger.action(getContext(),
+ MetricsEvent.ACTION_MOBILE_NETWORK_AUTO_SELECT_NETWORK_TOGGLE, autoSelect);
return true;
}
return false;
diff --git a/src/com/android/phone/NetworkSelectListPreference.java b/src/com/android/phone/NetworkSelectListPreference.java
index 936c2a0..1af31b2 100644
--- a/src/com/android/phone/NetworkSelectListPreference.java
+++ b/src/com/android/phone/NetworkSelectListPreference.java
@@ -19,6 +19,7 @@
import android.app.ProgressDialog;
import android.content.Context;
import android.content.DialogInterface;
+import android.metrics.LogMaker;
import android.os.AsyncResult;
import android.os.Handler;
import android.os.Message;
@@ -35,6 +36,8 @@
import android.util.AttributeSet;
import android.util.Log;
+import com.android.internal.logging.MetricsLogger;
+import com.android.internal.logging.nano.MetricsProto.MetricsEvent;
import com.android.internal.telephony.OperatorInfo;
import com.android.internal.telephony.Phone;
import com.android.internal.telephony.PhoneFactory;
@@ -80,6 +83,7 @@
@Override
protected void onClick() {
+ sendMetricsEvent(null);
loadNetworksList();
}
@@ -406,12 +410,15 @@
* @param preference is the preference to be changed, should be network select button.
* @param newValue should be the value of the selection as index of operators.
*/
+ @Override
public boolean onPreferenceChange(Preference preference, Object newValue) {
int operatorIndex = findIndexOfValue((String) newValue);
mOperatorInfo = mOperatorInfoList.get(operatorIndex);
if (DBG) logd("selected network: " + getNetworkTitle(mOperatorInfo));
+ sendMetricsEvent(getNetworkTitle(mOperatorInfo));
+
Message msg = mHandler.obtainMessage(EVENT_NETWORK_SELECTION_DONE);
Phone phone = PhoneFactory.getPhone(mPhoneId);
if (phone != null) {
@@ -505,6 +512,21 @@
};
}
+ private void sendMetricsEvent(String network) {
+ final LogMaker logMaker =
+ new LogMaker(MetricsEvent.ACTION_MOBILE_NETWORK_MANUAL_SELECT_NETWORK)
+ .setType(MetricsEvent.TYPE_ACTION);
+
+ if (network != null) {
+ // Since operator list is loaded dynamically from modem, we cannot know which network
+ // user chooses if we only record integer index of newValue. So a new tag and a string
+ // value (network) is added in this MetricsEvent.
+ logMaker.addTaggedData(MetricsEvent.FIELD_MOBILE_NETWORK, network);
+ }
+
+ MetricsLogger.action(logMaker);
+ }
+
private void logd(String msg) {
Log.d(LOG_TAG, "[NetworksList] " + msg);
}
diff --git a/src/com/android/phone/NotificationMgr.java b/src/com/android/phone/NotificationMgr.java
index 97daa34..d36c761 100644
--- a/src/com/android/phone/NotificationMgr.java
+++ b/src/com/android/phone/NotificationMgr.java
@@ -45,7 +45,6 @@
import android.telephony.ServiceState;
import android.telephony.SubscriptionInfo;
import android.telephony.SubscriptionManager;
-import android.telephony.SubscriptionManager.OnSubscriptionsChangedListener;
import android.telephony.TelephonyManager;
import android.text.TextUtils;
import android.util.ArrayMap;
@@ -162,7 +161,7 @@
/* package */ void refreshMwi(int subId) {
// In a single-sim device, subId can be -1 which means "no sub id". In this case we will
// reference the single subid stored in the mMwiVisible map.
- if (subId == SubscriptionInfoHelper.NO_SUB_ID) {
+ if (subId == SubscriptionManager.INVALID_SUBSCRIPTION_ID) {
if (mMwiVisible.keySet().size() == 1) {
Set<Integer> keySet = mMwiVisible.keySet();
Iterator<Integer> keyIt = keySet.iterator();
diff --git a/src/com/android/phone/PhoneInterfaceManager.java b/src/com/android/phone/PhoneInterfaceManager.java
index c750d27..2705c67 100644
--- a/src/com/android/phone/PhoneInterfaceManager.java
+++ b/src/com/android/phone/PhoneInterfaceManager.java
@@ -39,7 +39,6 @@
import android.os.Message;
import android.os.Messenger;
import android.os.PersistableBundle;
-import android.os.Process;
import android.os.ResultReceiver;
import android.os.ServiceManager;
import android.os.UserHandle;
@@ -2616,9 +2615,13 @@
* Set the network selection mode to manual with the selected carrier.
*/
@Override
- public boolean setNetworkSelectionModeManual(int subId, OperatorInfo operator,
+ public boolean setNetworkSelectionModeManual(int subId, String operatorNumeric,
boolean persistSelection) {
enforceModifyPermissionOrCarrierPrivilege(subId);
+ OperatorInfo operator = new OperatorInfo(
+ /* operatorAlphaLong */ "",
+ /* operatorAlphaShort */ "",
+ operatorNumeric);
if (DBG) log("setNetworkSelectionModeManual: subId:" + subId + " operator:" + operator);
ManualNetworkSelectionArgument arg = new ManualNetworkSelectionArgument(operator,
persistSelection);
diff --git a/src/com/android/phone/SubscriptionInfoHelper.java b/src/com/android/phone/SubscriptionInfoHelper.java
index 9f0ebd0..7c373e0 100644
--- a/src/com/android/phone/SubscriptionInfoHelper.java
+++ b/src/com/android/phone/SubscriptionInfoHelper.java
@@ -20,12 +20,12 @@
import android.content.Context;
import android.content.Intent;
import android.content.res.Resources;
+import android.telecom.PhoneAccountHandle;
import android.telephony.SubscriptionInfo;
import android.telephony.SubscriptionManager;
import android.telephony.TelephonyManager;
import android.text.TextUtils;
-import com.android.phone.PhoneGlobals;
import com.android.internal.telephony.Phone;
import com.android.internal.telephony.PhoneFactory;
@@ -37,7 +37,6 @@
* helping extract this info and perform common operations using this info.
*/
public class SubscriptionInfoHelper {
- public static final int NO_SUB_ID = -1;
// Extra on intent containing the id of a subscription.
public static final String SUB_ID_EXTRA =
@@ -46,17 +45,24 @@
private static final String SUB_LABEL_EXTRA =
"com.android.phone.settings.SubscriptionInfoHelper.SubscriptionLabel";
- private static Context mContext;
+ private Context mContext;
- private static int mSubId = NO_SUB_ID;
- private static String mSubLabel;
+ private int mSubId = SubscriptionManager.INVALID_SUBSCRIPTION_ID;
+ private String mSubLabel;
/**
* Instantiates the helper, by extracting the subscription id and label from the intent.
*/
public SubscriptionInfoHelper(Context context, Intent intent) {
mContext = context;
- mSubId = intent.getIntExtra(SUB_ID_EXTRA, NO_SUB_ID);
+ PhoneAccountHandle phoneAccountHandle =
+ intent.getParcelableExtra(TelephonyManager.EXTRA_PHONE_ACCOUNT_HANDLE);
+ if (phoneAccountHandle != null) {
+ mSubId = PhoneUtils.getSubIdForPhoneAccountHandle(phoneAccountHandle);
+ }
+ if (mSubId == SubscriptionManager.INVALID_SUBSCRIPTION_ID) {
+ mSubId = intent.getIntExtra(SUB_ID_EXTRA, SubscriptionManager.INVALID_SUBSCRIPTION_ID);
+ }
mSubLabel = intent.getStringExtra(SUB_LABEL_EXTRA);
}
@@ -118,7 +124,7 @@
}
public boolean hasSubId() {
- return mSubId != NO_SUB_ID;
+ return mSubId != SubscriptionManager.INVALID_SUBSCRIPTION_ID;
}
public int getSubId() {
diff --git a/src/com/android/services/telephony/TelecomAccountRegistry.java b/src/com/android/services/telephony/TelecomAccountRegistry.java
index 8963229..49a21c8 100644
--- a/src/com/android/services/telephony/TelecomAccountRegistry.java
+++ b/src/com/android/services/telephony/TelecomAccountRegistry.java
@@ -226,6 +226,12 @@
isHandoverFromSupported);
}
+ boolean isDeviceRttSupported = mContext.getResources().getBoolean(
+ R.bool.config_support_rtt);
+ if (isDeviceRttSupported && isCarrierRttSupported()) {
+ capabilities |= PhoneAccount.CAPABILITY_RTT;
+ }
+
extras.putBoolean(PhoneAccount.EXTRA_SUPPORTS_VIDEO_CALLING_FALLBACK,
mContext.getResources()
.getBoolean(R.bool.config_support_video_calling_fallback));
@@ -390,6 +396,12 @@
b.getBoolean(CarrierConfigManager.KEY_SUPPORT_VIDEO_CONFERENCE_CALL_BOOL);
}
+ private boolean isCarrierRttSupported() {
+ PersistableBundle b =
+ PhoneGlobals.getInstance().getCarrierConfigForSubId(mPhone.getSubId());
+ return b != null && b.getBoolean(CarrierConfigManager.KEY_RTT_SUPPORTED_BOOL);
+ }
+
/**
* Determines from carrier config whether merging of wifi calls is allowed when VoWIFI is
* turned off.
diff --git a/src/com/android/services/telephony/TelephonyConnection.java b/src/com/android/services/telephony/TelephonyConnection.java
index 26aeaba..bd8fb71 100644
--- a/src/com/android/services/telephony/TelephonyConnection.java
+++ b/src/com/android/services/telephony/TelephonyConnection.java
@@ -33,7 +33,6 @@
import android.telecom.TelecomManager;
import android.telecom.VideoProfile;
import android.telephony.CarrierConfigManager;
-import android.telephony.DisconnectCause;
import android.telephony.PhoneNumberUtils;
import android.telephony.TelephonyManager;
import android.util.Pair;
@@ -521,6 +520,11 @@
protected final boolean mIsOutgoing;
/**
+ * Indicates whether this call is using assisted dialing.
+ */
+ private boolean mIsUsingAssistedDialing;
+
+ /**
* Listeners to our TelephonyConnection specific callbacks
*/
private final Set<TelephonyConnectionListener> mTelephonyListeners = Collections.newSetFromMap(
@@ -823,6 +827,8 @@
isExternalConnection());
newProperties = changeBitmask(newProperties, PROPERTY_HAS_CDMA_VOICE_PRIVACY,
mIsCdmaVoicePrivacyEnabled);
+ newProperties = changeBitmask(newProperties, PROPERTY_ASSISTED_DIALING_USED,
+ mIsUsingAssistedDialing);
if (getConnectionProperties() != newProperties) {
setConnectionProperties(newProperties);
@@ -1379,6 +1385,7 @@
updateConnectionProperties();
updateAddress();
updateMultiparty();
+ refreshDisableAddCall();
}
/**
@@ -1692,6 +1699,15 @@
return mWasImsConnection;
}
+ boolean getIsUsingAssistedDialing() {
+ return mIsUsingAssistedDialing;
+ }
+
+ void setIsUsingAssistedDialing(Boolean isUsingAssistedDialing) {
+ mIsUsingAssistedDialing = isUsingAssistedDialing;
+ updateConnectionProperties();
+ }
+
private static Uri getAddressFromNumber(String number) {
// Address can be null for blocked calls.
if (number == null) {
diff --git a/src/com/android/services/telephony/TelephonyConnectionService.java b/src/com/android/services/telephony/TelephonyConnectionService.java
index f4ee745..ea460cf 100644
--- a/src/com/android/services/telephony/TelephonyConnectionService.java
+++ b/src/com/android/services/telephony/TelephonyConnectionService.java
@@ -421,7 +421,11 @@
isEmergencyNumber, handle, phone);
// If there was a failure, the resulting connection will not be a TelephonyConnection,
// so don't place the call!
- if(resultConnection instanceof TelephonyConnection) {
+ if (resultConnection instanceof TelephonyConnection) {
+ if (request.getExtras() != null && request.getExtras().getBoolean(
+ TelecomManager.EXTRA_USE_ASSISTED_DIALING, false)) {
+ ((TelephonyConnection) resultConnection).setIsUsingAssistedDialing(true);
+ }
placeOutgoingConnection((TelephonyConnection) resultConnection, phone, request);
}
return resultConnection;