Merge "Support CDMA emergency callback. (1/2)" into lmp-dev
diff --git a/res/values/config.xml b/res/values/config.xml
index cfca00b..914add0 100644
--- a/res/values/config.xml
+++ b/res/values/config.xml
@@ -138,11 +138,6 @@
<string name="carrier_settings" translatable="false"></string>
<string name="carrier_settings_menu" translatable="false"></string>
- <!-- Default connection service setting.
- TODO: This is GSM specific. Need to define a generic "use the builtin SIMs" Connection
- Service and use it as the default. -->
- <string name="connection_service_default" translatable="false">com.android.phone/com.android.services.telephony.TelephonyConnectionService</string>
-
<!-- Does not display additional call seting for IMS phone based on GSM Phone -->
<bool name="config_additional_call_setting">true</bool>
</resources>
diff --git a/src/com/android/phone/CallFeaturesSetting.java b/src/com/android/phone/CallFeaturesSetting.java
index 103606a..aa01862 100644
--- a/src/com/android/phone/CallFeaturesSetting.java
+++ b/src/com/android/phone/CallFeaturesSetting.java
@@ -160,7 +160,6 @@
// String keys for preference lookup
// TODO: Naming these "BUTTON_*" is confusing since they're not actually buttons(!)
- private static final String BUTTON_DEFAULT_CONNECTION_SERVICE = "button_connection_service";
private static final String BUTTON_VOICEMAIL_KEY = "button_voicemail_key";
private static final String BUTTON_VOICEMAIL_PROVIDER_KEY = "button_voicemail_provider_key";
private static final String BUTTON_VOICEMAIL_SETTING_KEY = "button_voicemail_setting_key";
@@ -261,14 +260,11 @@
private ListPreference mButtonSipCallOptions;
private Preference mWifiCallOptionsPreference;
private Preference mWifiCallAccountPreference;
- private ListPreference mConnectionService;
private ListPreference mVoicemailProviders;
private PreferenceScreen mVoicemailSettings;
private Preference mVoicemailNotificationRingtone;
private CheckBoxPreference mVoicemailNotificationVibrate;
private SipSharedPreferences mSipSharedPreferences;
- private final Map<String, CharSequence> mConnectionServiceLabelByComponentName =
- new HashMap<>();
private class VoiceMailProvider {
public VoiceMailProvider(String name, Intent intent) {
@@ -576,8 +572,6 @@
}
} else if (preference == mButtonSipCallOptions) {
handleSipCallOptionsChange(objValue);
- } else if (preference == mConnectionService) {
- updateConnectionServiceSummary((String) objValue);
}
// always let the preference setting proceed.
return true;
@@ -1515,8 +1509,6 @@
mButtonAutoRetry = (CheckBoxPreference) findPreference(BUTTON_RETRY_KEY);
mButtonHAC = (CheckBoxPreference) findPreference(BUTTON_HAC_KEY);
mButtonTTY = (ListPreference) findPreference(BUTTON_TTY_KEY);
- mConnectionService = (ListPreference)
- findPreference(BUTTON_DEFAULT_CONNECTION_SERVICE);
mVoicemailProviders = (ListPreference) findPreference(BUTTON_VOICEMAIL_PROVIDER_KEY);
if (mVoicemailProviders != null) {
@@ -1646,12 +1638,6 @@
actionBar.setDisplayHomeAsUpEnabled(true);
actionBar.setDisplayShowTitleEnabled(true);
}
-
- if (mConnectionService != null) {
- mConnectionService.setOnPreferenceChangeListener(this);
- setupConnectionServiceOptions();
- updateConnectionServiceSummary(null);
- }
}
private void createSipCallSettings() {
@@ -2106,66 +2092,6 @@
return super.onOptionsItemSelected(item);
}
- private void setupConnectionServiceOptions() {
- loadConnectionServiceEntries();
- String[] entryValues = new String[mConnectionServiceLabelByComponentName.size()];
- CharSequence[] entries = new CharSequence[mConnectionServiceLabelByComponentName.size()];
- int i = 0;
- for (String entryValue : mConnectionServiceLabelByComponentName.keySet()) {
- entryValues[i] = entryValue;
- entries[i] = mConnectionServiceLabelByComponentName.get(entryValue);
- i++;
- }
- mConnectionService.setEntryValues(entryValues);
- mConnectionService.setEntries(entries);
-
- if (mConnectionService.getValue() == null) {
- mConnectionService.setValue(getString(R.string.connection_service_default));
- }
- }
-
- private void updateConnectionServiceSummary(String value) {
- CharSequence label = mConnectionServiceLabelByComponentName.get(
- value == null ? mConnectionService.getValue() : value);
- if (label == null) {
- Log.w(LOG_TAG, "Unknown default connection service entry " +
- mConnectionService.getValue());
- mConnectionService.setSummary("");
- }
- mConnectionService.setSummary(label);
- }
-
- private void loadConnectionServiceEntries() {
- Intent intent = new Intent(ConnectionService.SERVICE_INTERFACE);
- for (ResolveInfo entry : getPackageManager().queryIntentServices(intent, 0)) {
- ServiceInfo serviceInfo = entry.serviceInfo;
- if (serviceInfo != null) {
- // The entry resolves to a proper service, add it to the list of service names
- ComponentName componentName =
- new ComponentName(serviceInfo.packageName, serviceInfo.name);
- mConnectionServiceLabelByComponentName.put(
- componentName.flattenToString(),
- serviceInfo.loadLabel(getPackageManager()));
- }
- }
-
- // If the default built-in ConnectionService is not installed, according to the package
- // manager, then in a newly initialized system, Telecomm is going to read the preference
- // and find the service to be nonexistent. Telecomm should have error checking for this
- // case, but it is problematic and it's hard to program around it. Here we simply pretend
- // like the built-in default is installed anyway (so the default value defined in the XML
- // for the ListPreference points to something useful and does not throw an NPE) and proceed.
- String connectionServiceDefault = getString(R.string.connection_service_default);
- if (!mConnectionServiceLabelByComponentName.containsKey(connectionServiceDefault)) {
- Log.w(LOG_TAG, "Package manager reports built-in ConnectionService not installed: "
- + connectionServiceDefault);
- } else {
- mConnectionServiceLabelByComponentName.put(
- connectionServiceDefault,
- getString(R.string.connection_service_default_label));
- }
- }
-
/**
* Finish current Activity and go up to the top level Settings ({@link CallFeaturesSetting}).
* This is useful for implementing "HomeAsUp" capability for second-level Settings.
diff --git a/src/com/android/services/telephony/TelephonyConnection.java b/src/com/android/services/telephony/TelephonyConnection.java
index adb430c..3821132 100644
--- a/src/com/android/services/telephony/TelephonyConnection.java
+++ b/src/com/android/services/telephony/TelephonyConnection.java
@@ -360,7 +360,12 @@
private void hangup(int disconnectCause) {
if (mOriginalConnection != null) {
try {
- mOriginalConnection.hangup();
+ Call call = getCall();
+ if (call != null) {
+ call.hangup();
+ } else {
+ Log.w(this, "Attempting to hangup a connection without backing call.");
+ }
} catch (CallStateException e) {
Log.e(this, e, "Call to Connection.hangup failed with exception");
}