Merge "Fix bug #16703191 APN settings shows back button even when you intent into it" into lmp-dev
diff --git a/res/values/config.xml b/res/values/config.xml
index cc0cf1a..0d1ae54 100644
--- a/res/values/config.xml
+++ b/res/values/config.xml
@@ -120,6 +120,8 @@
<bool name="config_enabled_lte" translatable="false">false</bool>
<!-- Show cdma auto network mode in (glabal) roaming -->
<bool name="config_show_cdma" translatable="false">false</bool>
+ <!-- Display enhanced 4G LTE mode menu if true -->
+ <bool name="config_enhanced_4g_lte_mode_enable" translatable="false">true</bool>
<!-- Package name for the default in-call UI and dialer [DO NOT TRANSLATE] -->
<string name="ui_default_package" translatable="false">com.android.dialer</string>
diff --git a/res/values/strings.xml b/res/values/strings.xml
index c343deb..0745ad7 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -1139,11 +1139,6 @@
on this device. [CHAR LIMIT=40] -->
<string name="not_voice_capable">Voice calling not supported</string>
- <!-- Title of settings screen for managing the "Respond via SMS" feature. [CHAR LIMIT=30] -->
- <string name="respond_via_sms_setting_title">Quick responses</string>
- <!-- Settings summary string for the "Respond via SMS" feature. [CHAR LIMIT=40] -->
- <string name="respond_via_sms_setting_summary"></string>
-
<!-- String describing the Dial ImageButton
Used by AccessibilityService to announce the purpose of the button.
@@ -1161,12 +1156,6 @@
[CHAR LIMIT=30] -->
<string name="voicemail_notification_ringtone_title">Sound</string>
- <!-- The string used to describe a notification if it is the default one in the system. For
- example, if the user selects the default notification, it will appear as something like
- Default sound(Capella) in the notification summary.
- [CHAR LIMIT=40] -->
- <string name="default_notification_description">Default sound (<xliff:g id="default_sound_title">%1$s</xliff:g>)</string>
-
<!-- The default value value for voicemail notification. -->
<string name="voicemail_notification_vibrate_when_default" translatable="false">never</string>
@@ -1177,18 +1166,6 @@
<item>never</item>
</string-array>
- <!-- Setting option name to pick ringtone (a list dialog comes up). [CHAR LIMIT=30] -->
- <string name="ringtone_title" msgid="5379026328015343686">Phone ringtone</string>
-
- <!-- Setting option name to enable or disable vibration when ringing
- the phone.
- [CHAR LIMIT=30] -->
- <string name="vibrate_on_ring_title">Vibrate when ringing</string>
-
- <!-- Setting option name to enable or disable DTMF tone sound
- [CHAR LIMIT=30] -->
- <string name="dtmf_tone_enable_title">Dial pad touch tones</string>
-
<!-- Setting option name to enable or disable dialpad autocomplete functionality
[CHAR LIMIT=30] -->
<string name="dial_pad_autocomplete">Dial pad autocomplete</string>
diff --git a/res/xml/call_feature_setting.xml b/res/xml/call_feature_setting.xml
index 30811e4..625ff4c 100644
--- a/res/xml/call_feature_setting.xml
+++ b/res/xml/call_feature_setting.xml
@@ -17,110 +17,77 @@
xmlns:phone="http://schemas.android.com/apk/res/com.android.phone"
android:title="@string/call_settings">
- <PreferenceCategory
- android:key="button_ringtone_category_key"
- android:title="@string/preference_category_ringtone"
- android:persistent="false">
-
- <com.android.phone.DefaultRingtonePreference
- android:key="button_ringtone_key"
- android:title="@string/ringtone_title"
- android:dialogTitle="@string/ringtone_title"
- android:persistent="false"
- android:ringtoneType="ringtone" />
-
- <CheckBoxPreference
- android:key="button_vibrate_on_ring"
- android:title="@string/vibrate_on_ring_title"
- android:persistent="false"
- android:defaultValue="false" />
- </PreferenceCategory>
-
- <PreferenceCategory
- android:key="button_misc_category_key"
- android:title="@string/other_settings"
- android:persistent="false" />
-
<Preference
- android:key="phone_accounts"
- android:title="@string/phone_accounts" >
+ android:key="phone_accounts"
+ android:title="@string/phone_accounts">
+
<intent
- android:targetClass="com.android.telecomm.PhoneAccountPreferencesActivity"
- android:targetPackage="com.android.telecomm" />
+ android:targetClass="com.android.telecomm.PhoneAccountPreferencesActivity"
+ android:targetPackage="com.android.telecomm" />
+
</Preference>
- <PreferenceScreen
- android:key="button_voicemail_category_key"
- android:title="@string/voicemail"
- android:persistent="false">
- <ListPreference
- android:key="button_voicemail_provider_key"
- android:title="@string/voicemail_provider"
- android:summary="@string/sum_voicemail_choose_provider"
- android:defaultValue=""
- android:persistent="true" />
- <PreferenceScreen
- android:key="button_voicemail_setting_key"
- android:title="@string/voicemail_settings"
- android:persistent="false">
+ <PreferenceScreen
+ android:key="button_voicemail_category_key"
+ android:title="@string/voicemail"
+ android:persistent="false">
- <!-- Note for all com.android.phone.EditPhoneNumberPreference objects
+ <ListPreference
+ android:key="button_voicemail_provider_key"
+ android:title="@string/voicemail_provider"
+ android:summary="@string/sum_voicemail_choose_provider"
+ android:defaultValue=""
+ android:persistent="true" />
- The last several attributes are for use with the EditText field
- in the dialog. These attributes are forwarded to that field
- when the edittext is created. The attributes include:
- 1. android:singleLine
- 2. android:autoText
- 3. android:background -->
+ <PreferenceScreen
+ android:key="button_voicemail_setting_key"
+ android:title="@string/voicemail_settings"
+ android:persistent="false">
- <com.android.phone.EditPhoneNumberPreference
- android:key="button_voicemail_key"
- android:title="@string/voicemail_settings_number_label"
- android:persistent="false"
- android:dialogTitle="@string/voicemail"
- phone:confirmMode="confirm"
- android:singleLine="true"
- android:autoText="false" />
- </PreferenceScreen>
+ <!-- Note for all com.android.phone.EditPhoneNumberPreference objects
- <RingtonePreference
- android:key="button_voicemail_notification_ringtone_key"
- android:title="@string/voicemail_notification_ringtone_title"
- android:persistent="true"
- android:ringtoneType="notification"
- android:defaultValue="content://settings/system/notification_sound" />
- <CheckBoxPreference
- android:key="button_voicemail_notification_vibrate_key"
- android:title="@string/voicemail_notification_vibrate_when_title"
- android:persistent="true"
- />
- </PreferenceScreen>
+ The last several attributes are for use with the EditText field
+ in the dialog. These attributes are forwarded to that field
+ when the edittext is created. The attributes include:
+ 1. android:singleLine
+ 2. android:autoText
+ 3. android:background -->
- <CheckBoxPreference
- android:key="button_play_dtmf_tone"
- android:title="@string/dtmf_tone_enable_title"
- android:persistent="false"
- android:defaultValue="true" />
+ <com.android.phone.EditPhoneNumberPreference
+ android:key="button_voicemail_key"
+ android:title="@string/voicemail_settings_number_label"
+ android:persistent="false"
+ android:dialogTitle="@string/voicemail"
+ phone:confirmMode="confirm"
+ android:singleLine="true"
+ android:autoText="false" />
- <PreferenceScreen
- android:key="button_respond_via_sms_key"
- android:title="@string/respond_via_sms_setting_title"
- android:summary="@string/respond_via_sms_setting_summary"
- android:persistent="false">
- <intent
- android:action="android.intent.action.MAIN"
- android:targetPackage="com.android.telecomm"
- android:targetClass="com.android.telecomm.RespondViaSmsSettings$Settings" />
- </PreferenceScreen>
+ </PreferenceScreen>
- <PreferenceScreen
- android:key="button_fdn_key"
- android:title="@string/fdn"
- android:persistent="false">
- <intent android:action="android.intent.action.MAIN"
- android:targetPackage="com.android.phone"
- android:targetClass="com.android.phone.FdnSetting" />
- </PreferenceScreen>
+ <RingtonePreference
+ android:key="button_voicemail_notification_ringtone_key"
+ android:title="@string/voicemail_notification_ringtone_title"
+ android:persistent="true"
+ android:ringtoneType="notification"
+ android:defaultValue="content://settings/system/notification_sound" />
+
+ <CheckBoxPreference
+ android:key="button_voicemail_notification_vibrate_key"
+ android:title="@string/voicemail_notification_vibrate_when_title"
+ android:persistent="true" />
+
+ </PreferenceScreen>
+
+ <PreferenceScreen
+ android:key="button_fdn_key"
+ android:title="@string/fdn"
+ android:persistent="false">
+
+ <intent android:action="android.intent.action.MAIN"
+ android:targetPackage="com.android.phone"
+ android:targetClass="com.android.phone.FdnSetting" />
+
+ </PreferenceScreen>
<CheckBoxPreference
android:key="button_auto_retry_key"
@@ -136,7 +103,7 @@
android:entries="@array/tty_mode_entries"
android:entryValues="@array/tty_mode_values"/>
- <CheckBoxPreference
+ <CheckBoxPreference
android:key="button_hac_key"
android:title="@string/hac_mode_title"
android:persistent="true"
@@ -158,6 +125,7 @@
<intent android:action="android.intent.action.MAIN"
android:targetPackage="com.android.phone"
android:targetClass="com.android.phone.GsmUmtsCallOptions"/>
+
</PreferenceScreen>
<PreferenceScreen
@@ -169,6 +137,7 @@
<intent android:action="android.intent.action.MAIN"
android:targetPackage="com.android.phone"
android:targetClass="com.android.phone.CdmaCallOptions"/>
+
</PreferenceScreen>
<CheckBoxPreference
@@ -176,4 +145,5 @@
android:title="@string/enable_video_calling_title"
android:persistent="true"
android:defaultValue="true" />
+
</PreferenceScreen>
diff --git a/sip/res/xml/sip_settings_category.xml b/sip/res/xml/sip_settings_category.xml
index 17ee577..9527d6a 100644
--- a/sip/res/xml/sip_settings_category.xml
+++ b/sip/res/xml/sip_settings_category.xml
@@ -15,34 +15,38 @@
-->
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:phone="http://schemas.android.com/apk/res/com.android.phone">
- <PreferenceCategory
- android:key="sip_settings_category_key"
- android:title="@string/sip_settings"
+
+ <PreferenceScreen
+ android:key="sip_settings_preference_screen_key"
+ android:title="@string/sip_settings"
+ android:persistent="false" >
+
+ <PreferenceScreen
+ android:key="sip_account_settings_key"
+ android:title="@string/sip_accounts_title"
android:persistent="false">
- <PreferenceScreen
- android:key="sip_account_settings_key"
- android:title="@string/sip_accounts_title"
- android:persistent="false">
+ <intent android:action="android.intent.action.MAIN"
+ android:targetPackage="com.android.phone"
+ android:targetClass="com.android.services.telephony.sip.SipSettings" />
- <intent android:action="android.intent.action.MAIN"
- android:targetPackage="com.android.phone"
- android:targetClass="com.android.services.telephony.sip.SipSettings" />
- </PreferenceScreen>
+ </PreferenceScreen>
- <ListPreference
- android:key="sip_call_options_key"
- android:title="@string/sip_call_options_title"
- android:persistent="true"
- android:entries="@array/sip_call_options_entries"
- android:entryValues="@array/sip_call_options_values"/>
+ <ListPreference
+ android:key="sip_call_options_key"
+ android:title="@string/sip_call_options_title"
+ android:persistent="true"
+ android:entries="@array/sip_call_options_entries"
+ android:entryValues="@array/sip_call_options_values"/>
- <ListPreference
- android:key="sip_call_options_wifi_only_key"
- android:title="@string/sip_call_options_title"
- android:dialogTitle="@string/sip_call_options_wifi_only_title"
- android:persistent="true"
- android:entries="@array/sip_call_options_wifi_only_entries"
- android:entryValues="@array/sip_call_options_values"/>
- </PreferenceCategory>
+ <ListPreference
+ android:key="sip_call_options_wifi_only_key"
+ android:title="@string/sip_call_options_title"
+ android:dialogTitle="@string/sip_call_options_wifi_only_title"
+ android:persistent="true"
+ android:entries="@array/sip_call_options_wifi_only_entries"
+ android:entryValues="@array/sip_call_options_values"/>
+
+ </PreferenceScreen>
+
</PreferenceScreen>
diff --git a/sip/src/com/android/services/telephony/sip/SipConnection.java b/sip/src/com/android/services/telephony/sip/SipConnection.java
index 6ba2684..58db1f5 100644
--- a/sip/src/com/android/services/telephony/sip/SipConnection.java
+++ b/sip/src/com/android/services/telephony/sip/SipConnection.java
@@ -18,9 +18,9 @@
import android.os.Handler;
import android.os.Message;
-import android.telecomm.CallAudioState;
-import android.telecomm.CallCapabilities;
+import android.telecomm.AudioState;
import android.telecomm.Connection;
+import android.telecomm.PhoneCapabilities;
import android.util.Log;
import com.android.internal.telephony.Call;
@@ -65,7 +65,7 @@
}
@Override
- public void onSetAudioState(CallAudioState state) {
+ public void onSetAudioState(AudioState state) {
if (VERBOSE) log("onSetAudioState: " + state);
if (getPhone() != null) {
getPhone().setEchoSuppressionEnabled();
@@ -129,7 +129,7 @@
public void onHold() {
if (VERBOSE) log("onHold");
try {
- if (getPhone() != null && getState() == State.ACTIVE) {
+ if (getPhone() != null && getState() == STATE_ACTIVE) {
getPhone().switchHoldingAndActive();
}
} catch (CallStateException e) {
@@ -141,7 +141,7 @@
public void onUnhold() {
if (VERBOSE) log("onUnhold");
try {
- if (getPhone() != null && getState() == State.HOLDING) {
+ if (getPhone() != null && getState() == STATE_HOLDING) {
getPhone().switchHoldingAndActive();
}
} catch (CallStateException e) {
@@ -180,12 +180,6 @@
}
@Override
- public void onSwapWithBackgroundCall() {
- if (VERBOSE) log("onSwapWithBackgroundCall");
- // TODO: Implement swap.
- }
-
- @Override
public void onChildrenChanged(List<Connection> children) {
if (VERBOSE) log("onChildrenChanged, children: " + children);
}
@@ -254,9 +248,9 @@
}
private int buildCallCapabilities() {
- int capabilities = CallCapabilities.MUTE | CallCapabilities.SUPPORT_HOLD;
- if (getState() == State.ACTIVE || getState() == State.HOLDING) {
- capabilities |= CallCapabilities.HOLD;
+ int capabilities = PhoneCapabilities.MUTE | PhoneCapabilities.SUPPORT_HOLD;
+ if (getState() == STATE_ACTIVE || getState() == STATE_HOLDING) {
+ capabilities |= PhoneCapabilities.HOLD;
}
return capabilities;
}
diff --git a/sip/src/com/android/services/telephony/sip/SipConnectionService.java b/sip/src/com/android/services/telephony/sip/SipConnectionService.java
index 5aaa20c..bda564f 100644
--- a/sip/src/com/android/services/telephony/sip/SipConnectionService.java
+++ b/sip/src/com/android/services/telephony/sip/SipConnectionService.java
@@ -102,14 +102,14 @@
if (request.getExtras() == null) {
if (VERBOSE) log("onCreateIncomingConnection, no extras");
- return Connection.getFailedConnection(DisconnectCause.ERROR_UNSPECIFIED, null);
+ return Connection.createFailedConnection(DisconnectCause.ERROR_UNSPECIFIED, null);
}
Intent sipIntent = (Intent) request.getExtras().getParcelable(
SipUtil.EXTRA_INCOMING_CALL_INTENT);
if (sipIntent == null) {
if (VERBOSE) log("onCreateIncomingConnection, no SIP intent");
- return Connection.getFailedConnection(DisconnectCause.ERROR_UNSPECIFIED, null);
+ return Connection.createFailedConnection(DisconnectCause.ERROR_UNSPECIFIED, null);
}
SipAudioCall sipAudioCall;
@@ -117,7 +117,7 @@
sipAudioCall = SipManager.newInstance(this).takeAudioCall(sipIntent, null);
} catch (SipException e) {
log("onCreateIncomingConnection, takeAudioCall exception: " + e);
- return Connection.getCanceledConnection();
+ return Connection.createCanceledConnection();
}
SipPhone phone = findPhoneForProfile(sipAudioCall.getLocalProfile());
@@ -132,10 +132,10 @@
return new SipConnection();
} else {
if (VERBOSE) log("onCreateIncomingConnection, takingIncomingCall failed");
- return Connection.getCanceledConnection();
+ return Connection.createCanceledConnection();
}
}
- return Connection.getFailedConnection(DisconnectCause.ERROR_UNSPECIFIED, null);
+ return Connection.createFailedConnection(DisconnectCause.ERROR_UNSPECIFIED, null);
}
@Override
@@ -208,7 +208,7 @@
private ConnectionRequest getConnectionRequestForIncomingCall(ConnectionRequest request,
com.android.internal.telephony.Connection connection) {
Uri uri = Uri.fromParts(SipUtil.SCHEME_SIP, connection.getAddress(), null);
- return new ConnectionRequest(request.getAccountHandle(), request.getCallId(), uri,
+ return new ConnectionRequest(request.getAccountHandle(), uri,
connection.getNumberPresentation(), request.getExtras(), 0);
}
diff --git a/src/com/android/phone/CallFeaturesSetting.java b/src/com/android/phone/CallFeaturesSetting.java
index 9f0dad7..103606a 100644
--- a/src/com/android/phone/CallFeaturesSetting.java
+++ b/src/com/android/phone/CallFeaturesSetting.java
@@ -34,27 +34,21 @@
import android.content.pm.ResolveInfo;
import android.content.pm.ServiceInfo;
import android.database.Cursor;
-import android.database.sqlite.SQLiteException;
import android.media.AudioManager;
import android.media.RingtoneManager;
-import android.net.Uri;
import android.net.sip.SipManager;
import android.os.AsyncResult;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.os.UserHandle;
-import android.os.Vibrator;
import android.preference.CheckBoxPreference;
import android.preference.ListPreference;
import android.preference.Preference;
import android.preference.PreferenceActivity;
-import android.preference.PreferenceCategory;
-import android.preference.PreferenceGroup;
import android.preference.PreferenceManager;
import android.preference.PreferenceScreen;
import android.provider.ContactsContract.CommonDataKinds;
-import android.provider.MediaStore;
import android.provider.Settings;
import android.telecomm.ConnectionService;
import android.telecomm.TelecommManager;
@@ -69,9 +63,11 @@
import com.android.internal.telephony.CommandsInterface;
import com.android.internal.telephony.Phone;
import com.android.internal.telephony.PhoneConstants;
+import com.android.phone.common.util.SettingsUtil;
import com.android.services.telephony.sip.SipSharedPreferences;
import com.android.services.telephony.sip.SipUtil;
+import java.lang.String;
import java.util.Collection;
import java.util.HashMap;
import java.util.HashSet;
@@ -95,14 +91,16 @@
* For the "Mobile network settings" screen under the main Settings app,
* See {@link MobileNetworkSettings}.
*
+ * TODO: Settings should be split into PreferenceFragments where possible (ie. voicemail, SIP).
+ *
* @see com.android.phone.MobileNetworkSettings
*/
public class CallFeaturesSetting extends PreferenceActivity
implements DialogInterface.OnClickListener,
- Preference.OnPreferenceChangeListener,
- Preference.OnPreferenceClickListener,
- EditPhoneNumberPreference.OnDialogClosedListener,
- EditPhoneNumberPreference.GetDefaultNumberListener {
+ Preference.OnPreferenceChangeListener,
+ Preference.OnPreferenceClickListener,
+ EditPhoneNumberPreference.OnDialogClosedListener,
+ EditPhoneNumberPreference.GetDefaultNumberListener {
private static final String LOG_TAG = "CallFeaturesSetting";
private static final boolean DBG = (PhoneGlobals.DBG_LEVEL >= 2);
@@ -176,13 +174,7 @@
/* package */ static final String BUTTON_VOICEMAIL_NOTIFICATION_RINGTONE_KEY =
"button_voicemail_notification_ringtone_key";
private static final String BUTTON_FDN_KEY = "button_fdn_key";
- private static final String BUTTON_RESPOND_VIA_SMS_KEY = "button_respond_via_sms_key";
- private static final String BUTTON_RINGTONE_CATEGORY = "button_ringtone_category_key";
-
- private static final String BUTTON_RINGTONE_KEY = "button_ringtone_key";
- private static final String BUTTON_VIBRATE_ON_RING = "button_vibrate_on_ring";
- private static final String BUTTON_PLAY_DTMF_TONE = "button_play_dtmf_tone";
private static final String BUTTON_DTMF_KEY = "button_dtmf_settings";
private static final String BUTTON_RETRY_KEY = "button_auto_retry_key";
private static final String BUTTON_TTY_KEY = "button_tty_mode_key";
@@ -193,12 +185,11 @@
private static final String VM_NUMBERS_SHARED_PREFERENCES_NAME = "vm_numbers";
- private static final String BUTTON_SIP_CALL_OPTIONS =
- "sip_call_options_key";
+ private static final String BUTTON_SIP_CALL_OPTIONS = "sip_call_options_key";
private static final String BUTTON_SIP_CALL_OPTIONS_WIFI_ONLY =
"sip_call_options_wifi_only_key";
- private static final String SIP_SETTINGS_CATEGORY_KEY =
- "sip_settings_category_key";
+ private static final String SIP_SETTINGS_PREFERENCE_SCREEN_KEY =
+ "sip_settings_preference_screen_key";
private Intent mContactListIntent;
@@ -207,8 +198,7 @@
private static final int EVENT_FORWARDING_CHANGED = 501;
private static final int EVENT_FORWARDING_GET_COMPLETED = 502;
- private static final int MSG_UPDATE_RINGTONE_SUMMARY = 1;
- private static final int MSG_UPDATE_VOICEMAIL_RINGTONE_SUMMARY = 2;
+ private static final int MSG_UPDATE_VOICEMAIL_RINGTONE_SUMMARY = 1;
public static final String HAC_KEY = "HACSetting";
public static final String HAC_VAL_ON = "ON";
@@ -251,14 +241,11 @@
private EditPhoneNumberPreference mSubMenuVoicemailSettings;
- private Runnable mRingtoneLookupRunnable;
- private final Handler mRingtoneLookupComplete = new Handler() {
+ private Runnable mVoicemailRingtoneLookupRunnable;
+ private final Handler mVoicemailRingtoneLookupComplete = new Handler() {
@Override
public void handleMessage(Message msg) {
switch (msg.what) {
- case MSG_UPDATE_RINGTONE_SUMMARY:
- mRingtonePreference.setSummary((CharSequence) msg.obj);
- break;
case MSG_UPDATE_VOICEMAIL_RINGTONE_SUMMARY:
mVoicemailNotificationRingtone.setSummary((CharSequence) msg.obj);
break;
@@ -266,10 +253,7 @@
}
};
- private Preference mRingtonePreference;
- private CheckBoxPreference mVibrateWhenRinging;
/** Whether dialpad plays DTMF tone or not. */
- private CheckBoxPreference mPlayDtmfTone;
private CheckBoxPreference mButtonAutoRetry;
private CheckBoxPreference mButtonHAC;
private ListPreference mButtonDTMF;
@@ -489,9 +473,6 @@
public boolean onPreferenceTreeClick(PreferenceScreen preferenceScreen, Preference preference) {
if (preference == mSubMenuVoicemailSettings) {
return true;
- } else if (preference == mPlayDtmfTone) {
- Settings.System.putInt(getContentResolver(), Settings.System.DTMF_TONE_WHEN_DIALING,
- mPlayDtmfTone.isChecked() ? 1 : 0);
} else if (preference == mButtonDTMF) {
return true;
} else if (preference == mButtonTTY) {
@@ -553,11 +534,8 @@
log("onPreferenceChange(). preferenece: \"" + preference + "\""
+ ", value: \"" + objValue + "\"");
}
- if (preference == mVibrateWhenRinging) {
- boolean doVibrate = (Boolean) objValue;
- Settings.System.putInt(mPhone.getContext().getContentResolver(),
- Settings.System.VIBRATE_WHEN_RINGING, doVibrate ? 1 : 0);
- } else if (preference == mButtonDTMF) {
+
+ if (preference == mButtonDTMF) {
int index = mButtonDTMF.findIndexOfValue((String) objValue);
Settings.System.putInt(mPhone.getContext().getContentResolver(),
Settings.System.DTMF_TONE_TYPE_WHEN_DIALING, index);
@@ -1533,9 +1511,6 @@
mSubMenuVoicemailSettings.setDialogTitle(R.string.voicemail_settings_number_label);
}
- mRingtonePreference = findPreference(BUTTON_RINGTONE_KEY);
- mVibrateWhenRinging = (CheckBoxPreference) findPreference(BUTTON_VIBRATE_ON_RING);
- mPlayDtmfTone = (CheckBoxPreference) findPreference(BUTTON_PLAY_DTMF_TONE);
mButtonDTMF = (ListPreference) findPreference(BUTTON_DTMF_KEY);
mButtonAutoRetry = (CheckBoxPreference) findPreference(BUTTON_RETRY_KEY);
mButtonHAC = (CheckBoxPreference) findPreference(BUTTON_HAC_KEY);
@@ -1543,6 +1518,7 @@
mConnectionService = (ListPreference)
findPreference(BUTTON_DEFAULT_CONNECTION_SERVICE);
mVoicemailProviders = (ListPreference) findPreference(BUTTON_VOICEMAIL_PROVIDER_KEY);
+
if (mVoicemailProviders != null) {
mVoicemailProviders.setOnPreferenceChangeListener(this);
mVoicemailSettings = (PreferenceScreen)findPreference(BUTTON_VOICEMAIL_SETTING_KEY);
@@ -1553,24 +1529,8 @@
initVoiceMailProviders();
}
- if (mVibrateWhenRinging != null) {
- Vibrator vibrator = (Vibrator) getSystemService(Context.VIBRATOR_SERVICE);
- if (vibrator != null && vibrator.hasVibrator()) {
- mVibrateWhenRinging.setOnPreferenceChangeListener(this);
- } else {
- PreferenceCategory ringToneCategory = (PreferenceCategory)findPreference(BUTTON_RINGTONE_CATEGORY);
- ringToneCategory.removePreference(mVibrateWhenRinging);
- mVibrateWhenRinging = null;
- }
- }
-
final ContentResolver contentResolver = getContentResolver();
- if (mPlayDtmfTone != null) {
- mPlayDtmfTone.setChecked(Settings.System.getInt(contentResolver,
- Settings.System.DTMF_TONE_WHEN_DIALING, 1) != 0);
- }
-
if (mButtonDTMF != null) {
if (getResources().getBoolean(R.bool.dtmf_type_enabled)) {
mButtonDTMF.setOnPreferenceChangeListener(this);
@@ -1611,23 +1571,25 @@
if (!getResources().getBoolean(R.bool.world_phone)) {
Preference options = prefSet.findPreference(BUTTON_CDMA_OPTIONS);
- if (options != null)
+ if (options != null) {
prefSet.removePreference(options);
+ }
options = prefSet.findPreference(BUTTON_GSM_UMTS_OPTIONS);
- if (options != null)
+ if (options != null) {
prefSet.removePreference(options);
+ }
int phoneType = mPhone.getPhoneType();
if (phoneType == PhoneConstants.PHONE_TYPE_CDMA) {
Preference fdnButton = prefSet.findPreference(BUTTON_FDN_KEY);
- if (fdnButton != null)
+ if (fdnButton != null) {
prefSet.removePreference(fdnButton);
+ }
if (!getResources().getBoolean(R.bool.config_voice_privacy_disable)) {
addPreferencesFromResource(R.xml.cdma_call_privacy);
}
} else if (phoneType == PhoneConstants.PHONE_TYPE_GSM) {
- if (getResources().getBoolean(
- R.bool.config_additional_call_setting)) {
+ if (getResources().getBoolean(R.bool.config_additional_call_setting)) {
addPreferencesFromResource(R.xml.gsm_umts_call_options);
}
} else {
@@ -1663,16 +1625,16 @@
mVMProviderSettingsForced = false;
createSipCallSettings();
- mRingtoneLookupRunnable = new Runnable() {
+ mVoicemailRingtoneLookupRunnable = new Runnable() {
@Override
public void run() {
- if (mRingtonePreference != null) {
- updateRingtoneName(RingtoneManager.TYPE_RINGTONE, mRingtonePreference,
- MSG_UPDATE_RINGTONE_SUMMARY);
- }
if (mVoicemailNotificationRingtone != null) {
- updateRingtoneName(RingtoneManager.TYPE_NOTIFICATION,
- mVoicemailNotificationRingtone, MSG_UPDATE_VOICEMAIL_RINGTONE_SUMMARY);
+ SettingsUtil.updateRingtoneName(
+ mPhone.getContext(),
+ mVoicemailRingtoneLookupComplete,
+ RingtoneManager.TYPE_NOTIFICATION,
+ mVoicemailNotificationRingtone,
+ MSG_UPDATE_VOICEMAIL_RINGTONE_SUMMARY);
}
}
};
@@ -1692,65 +1654,6 @@
}
}
- /**
- * Updates ringtone name. This is a method copied from com.android.settings.SoundSettings
- *
- * @see com.android.settings.SoundSettings
- */
- private void updateRingtoneName(int type, Preference preference, int msg) {
- if (preference == null) return;
- final Uri ringtoneUri;
- boolean defaultRingtone = false;
- if (type == RingtoneManager.TYPE_RINGTONE) {
- // For ringtones, we can just lookup the system default because changing the settings
- // in Call Settings changes the system default.
- ringtoneUri = RingtoneManager.getActualDefaultRingtoneUri(this, type);
- } else {
- final SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(
- mPhone.getContext());
- // for voicemail notifications, we use the value saved in Phone's shared preferences.
- String uriString = prefs.getString(preference.getKey(), null);
- if (TextUtils.isEmpty(uriString)) {
- // silent ringtone
- ringtoneUri = null;
- } else {
- if (uriString.equals(Settings.System.DEFAULT_NOTIFICATION_URI.toString())) {
- // If it turns out that the voicemail notification is set to the system
- // default notification, we retrieve the actual URI to prevent it from showing
- // up as "Unknown Ringtone".
- defaultRingtone = true;
- ringtoneUri = RingtoneManager.getActualDefaultRingtoneUri(this, type);
- } else {
- ringtoneUri = Uri.parse(uriString);
- }
- }
- }
- CharSequence summary = getString(com.android.internal.R.string.ringtone_unknown);
- // Is it a silent ringtone?
- if (ringtoneUri == null) {
- summary = getString(com.android.internal.R.string.ringtone_silent);
- } else {
- // Fetch the ringtone title from the media provider
- try {
- Cursor cursor = getContentResolver().query(ringtoneUri,
- new String[] { MediaStore.Audio.Media.TITLE }, null, null, null);
- if (cursor != null) {
- if (cursor.moveToFirst()) {
- summary = cursor.getString(0);
- }
- cursor.close();
- }
- } catch (SQLiteException sqle) {
- // Unknown title for the ringtone
- }
- }
- if (defaultRingtone) {
- summary = mPhone.getContext().getString(
- R.string.default_notification_description, summary);
- }
- mRingtoneLookupComplete.sendMessage(mRingtoneLookupComplete.obtainMessage(msg, summary));
- }
-
private void createSipCallSettings() {
// Add Internet call settings.
if (SipUtil.isVoipSupported(this)) {
@@ -1779,8 +1682,8 @@
findPreference(BUTTON_SIP_CALL_OPTIONS);
ListPreference wifiOnly = (ListPreference)
findPreference(BUTTON_SIP_CALL_OPTIONS_WIFI_ONLY);
- PreferenceGroup sipSettings = (PreferenceGroup)
- findPreference(SIP_SETTINGS_CATEGORY_KEY);
+ PreferenceScreen sipSettings = (PreferenceScreen)
+ getPreferenceScreen().findPreference(SIP_SETTINGS_PREFERENCE_SCREEN_KEY);
if (SipManager.isSipWifiOnly(this)) {
sipSettings.removePreference(wifiAnd3G);
return wifiOnly;
@@ -1796,7 +1699,7 @@
mForeground = true;
if (isAirplaneModeOn()) {
- Preference sipSettings = findPreference(SIP_SETTINGS_CATEGORY_KEY);
+ Preference sipSettings = findPreference(SIP_SETTINGS_PREFERENCE_SCREEN_KEY);
PreferenceScreen screen = getPreferenceScreen();
int count = screen.getPreferenceCount();
for (int i = 0 ; i < count ; ++i) {
@@ -1806,10 +1709,6 @@
return;
}
- if (mVibrateWhenRinging != null) {
- mVibrateWhenRinging.setChecked(getVibrateWhenRinging(this));
- }
-
if (mButtonDTMF != null) {
int dtmf = Settings.System.getInt(getContentResolver(),
Settings.System.DTMF_TONE_TYPE_WHEN_DIALING, Constants.DTMF_TONE_TYPE_NORMAL);
@@ -1842,7 +1741,8 @@
BUTTON_VOICEMAIL_NOTIFICATION_VIBRATE_KEY, false));
}
- lookupRingtoneName();
+ // Look up the voicemail ringtone name asynchronously and update its preference.
+ new Thread(mVoicemailRingtoneLookupRunnable).start();
}
// Migrate settings from BUTTON_VOICEMAIL_NOTIFICATION_VIBRATE_WHEN_KEY to
@@ -1864,28 +1764,6 @@
return false;
}
- /**
- * Obtain the setting for "vibrate when ringing" setting.
- *
- * Watch out: if the setting is missing in the device, this will try obtaining the old
- * "vibrate on ring" setting from AudioManager, and save the previous setting to the new one.
- */
- public static boolean getVibrateWhenRinging(Context context) {
- Vibrator vibrator = (Vibrator) context.getSystemService(Context.VIBRATOR_SERVICE);
- if (vibrator == null || !vibrator.hasVibrator()) {
- return false;
- }
- return Settings.System.getInt(context.getContentResolver(),
- Settings.System.VIBRATE_WHEN_RINGING, 0) != 0;
- }
-
- /**
- * Lookups ringtone name asynchronously and updates the relevant Preference.
- */
- private void lookupRingtoneName() {
- new Thread(mRingtoneLookupRunnable).start();
- }
-
private boolean isAirplaneModeOn() {
return Settings.System.getInt(getContentResolver(),
Settings.System.AIRPLANE_MODE_ON, 0) != 0;
diff --git a/src/com/android/phone/DefaultRingtonePreference.java b/src/com/android/phone/DefaultRingtonePreference.java
deleted file mode 100644
index 8205fd0..0000000
--- a/src/com/android/phone/DefaultRingtonePreference.java
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
- * Copyright (C) 2012 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.android.phone;
-
-import android.content.Context;
-import android.content.Intent;
-import android.media.RingtoneManager;
-import android.net.Uri;
-import android.preference.RingtonePreference;
-import android.util.AttributeSet;
-
-/**
- * RingtonePreference which doesn't show default ringtone setting.
- *
- * @see com.android.settings.DefaultRingtonePreference
- */
-public class DefaultRingtonePreference extends RingtonePreference {
- public DefaultRingtonePreference(Context context, AttributeSet attrs) {
- super(context, attrs);
- }
-
- @Override
- protected void onPrepareRingtonePickerIntent(Intent ringtonePickerIntent) {
- super.onPrepareRingtonePickerIntent(ringtonePickerIntent);
-
- /*
- * Since this preference is for choosing the default ringtone, it
- * doesn't make sense to show a 'Default' item.
- */
- ringtonePickerIntent.putExtra(RingtoneManager.EXTRA_RINGTONE_SHOW_DEFAULT, false);
- }
-
- @Override
- protected void onSaveRingtone(Uri ringtoneUri) {
- RingtoneManager.setActualDefaultRingtoneUri(getContext(), getRingtoneType(), ringtoneUri);
- }
-
- @Override
- protected Uri onRestoreRingtone() {
- return RingtoneManager.getActualDefaultRingtoneUri(getContext(), getRingtoneType());
- }
-}
diff --git a/src/com/android/phone/EmergencyDialer.java b/src/com/android/phone/EmergencyDialer.java
index e84805f..bed49a9 100644
--- a/src/com/android/phone/EmergencyDialer.java
+++ b/src/com/android/phone/EmergencyDialer.java
@@ -44,6 +44,7 @@
import android.widget.EditText;
import com.android.phone.common.HapticFeedback;
+import com.android.phone.common.dialpad.DialpadKeyButton;
import com.android.phone.common.util.ViewUtil;
@@ -65,7 +66,8 @@
* also?
*/
public class EmergencyDialer extends Activity implements View.OnClickListener,
- View.OnLongClickListener, View.OnHoverListener, View.OnKeyListener, TextWatcher {
+ View.OnLongClickListener, View.OnKeyListener, TextWatcher,
+ DialpadKeyButton.OnPressedListener {
// Keys used with onSaveInstanceState().
private static final String LAST_NUMBER = "lastNumber";
@@ -287,9 +289,8 @@
private void setupKeypad() {
// Setup the listeners for the buttons
for (int id : DIALER_KEYS) {
- final View key = findViewById(id);
- key.setOnClickListener(this);
- key.setOnHoverListener(this);
+ final DialpadKeyButton key = (DialpadKeyButton) findViewById(id);
+ key.setOnPressedListener(this);
}
View view = findViewById(R.id.zero);
@@ -344,6 +345,30 @@
@Override
public void onClick(View view) {
switch (view.getId()) {
+ case R.id.deleteButton: {
+ keyPressed(KeyEvent.KEYCODE_DEL);
+ return;
+ }
+ case R.id.floating_action_button: {
+ mHaptic.vibrate(); // Vibrate here too, just like we do for the regular keys
+ placeCall();
+ return;
+ }
+ case R.id.digits: {
+ if (mDigits.length() != 0) {
+ mDigits.setCursorVisible(true);
+ }
+ return;
+ }
+ }
+ }
+
+ @Override
+ public void onPressed(View view, boolean pressed) {
+ if (!pressed) {
+ return;
+ }
+ switch (view.getId()) {
case R.id.one: {
playTone(ToneGenerator.TONE_DTMF_1);
keyPressed(KeyEvent.KEYCODE_1);
@@ -404,59 +429,10 @@
keyPressed(KeyEvent.KEYCODE_STAR);
return;
}
- case R.id.deleteButton: {
- keyPressed(KeyEvent.KEYCODE_DEL);
- return;
- }
- case R.id.floating_action_button: {
- mHaptic.vibrate(); // Vibrate here too, just like we do for the regular keys
- placeCall();
- return;
- }
- case R.id.digits: {
- if (mDigits.length() != 0) {
- mDigits.setCursorVisible(true);
- }
- return;
- }
}
}
/**
- * Implemented for {@link android.view.View.OnHoverListener}. Handles touch
- * events for accessibility when touch exploration is enabled.
- */
- @Override
- public boolean onHover(View v, MotionEvent event) {
- // When touch exploration is turned on, lifting a finger while inside
- // the button's hover target bounds should perform a click action.
- if (mAccessibilityManager.isEnabled()
- && mAccessibilityManager.isTouchExplorationEnabled()) {
-
- switch (event.getActionMasked()) {
- case MotionEvent.ACTION_HOVER_ENTER:
- // Lift-to-type temporarily disables double-tap activation.
- v.setClickable(false);
- break;
- case MotionEvent.ACTION_HOVER_EXIT:
- final int left = v.getPaddingLeft();
- final int right = (v.getWidth() - v.getPaddingRight());
- final int top = v.getPaddingTop();
- final int bottom = (v.getHeight() - v.getPaddingBottom());
- final int x = (int) event.getX();
- final int y = (int) event.getY();
- if ((x > left) && (x < right) && (y > top) && (y < bottom)) {
- v.performClick();
- }
- v.setClickable(true);
- break;
- }
- }
-
- return false;
- }
-
- /**
* called for long touch events
*/
@Override
diff --git a/src/com/android/phone/MobileNetworkSettings.java b/src/com/android/phone/MobileNetworkSettings.java
index f5f64af..29c7f8a 100644
--- a/src/com/android/phone/MobileNetworkSettings.java
+++ b/src/com/android/phone/MobileNetworkSettings.java
@@ -72,8 +72,6 @@
// debug data
private static final String LOG_TAG = "NetworkSettings";
private static final boolean DBG = true;
- private static final String IMS_SHARED_PREFERENCES = "IMS_PREFERENCES";
- private static final String KEY_IMS_ON = "IMS";
public static final int REQUEST_CODE_EXIT_ECM = 17;
//String keys for preference lookup
@@ -203,16 +201,16 @@
public boolean isIMSOn() {
SharedPreferences imsPref =
- getSharedPreferences(IMS_SHARED_PREFERENCES, Context.MODE_WORLD_READABLE);
+ getSharedPreferences(ImsManager.IMS_SHARED_PREFERENCES, Context.MODE_WORLD_READABLE);
- return imsPref.getBoolean(KEY_IMS_ON, true);
+ return imsPref.getBoolean(ImsManager.KEY_IMS_ON, ImsManager.IMS_DEFAULT_SETTING);
}
private void setIMS(boolean turnOn) {
SharedPreferences imsPref =
- getSharedPreferences(IMS_SHARED_PREFERENCES, Context.MODE_WORLD_READABLE);
+ getSharedPreferences(ImsManager.IMS_SHARED_PREFERENCES, Context.MODE_WORLD_READABLE);
- imsPref.edit().putBoolean(KEY_IMS_ON, turnOn).commit();
+ imsPref.edit().putBoolean(ImsManager.KEY_IMS_ON, turnOn).commit();
}
@Override
@@ -343,6 +341,16 @@
android.util.Log.d(LOG_TAG, "keep ltePref");
}
+ // Enable enhanced 4G LTE mode settings depending on the value in config.xml
+ final boolean isEnhanced4GLteModeEnabled = getResources().getBoolean(
+ R.bool.config_enhanced_4g_lte_mode_enable);
+ if (!isEnhanced4GLteModeEnabled) {
+ Preference pref = prefSet.findPreference(BUTTON_4G_LTE_KEY);
+ if (pref != null) {
+ prefSet.removePreference(pref);
+ }
+ }
+
ActionBar actionBar = getActionBar();
if (actionBar != null) {
// android.R.id.home will be triggered in onOptionsItemSelected()
diff --git a/src/com/android/phone/PhoneUtils.java b/src/com/android/phone/PhoneUtils.java
index bc9bf63..ae40087 100644
--- a/src/com/android/phone/PhoneUtils.java
+++ b/src/com/android/phone/PhoneUtils.java
@@ -25,10 +25,7 @@
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
-import android.content.pm.ApplicationInfo;
-import android.content.pm.PackageManager;
import android.content.res.Configuration;
-import android.graphics.drawable.Drawable;
import android.media.AudioManager;
import android.net.Uri;
import android.os.AsyncResult;
@@ -36,7 +33,7 @@
import android.os.Message;
import android.os.RemoteException;
import android.os.SystemProperties;
-import android.telecomm.VideoCallProfile;
+import android.telecomm.VideoProfile;
import android.telephony.PhoneNumberUtils;
import android.text.TextUtils;
import android.util.Log;
@@ -56,10 +53,8 @@
import com.android.internal.telephony.MmiCode;
import com.android.internal.telephony.Phone;
import com.android.internal.telephony.PhoneConstants;
-import com.android.internal.telephony.PhoneFactory;
import com.android.internal.telephony.TelephonyCapabilities;
import com.android.internal.telephony.TelephonyProperties;
-import com.android.internal.telephony.cdma.CdmaConnection;
import com.android.internal.telephony.sip.SipPhone;
import com.android.phone.CallGatewayManager.RawGatewayInfo;
@@ -643,7 +638,7 @@
final boolean initiallyIdle = app.mCM.getState() == PhoneConstants.State.IDLE;
try {
- connection = app.mCM.dial(phone, numberToDial, VideoCallProfile.VideoState.AUDIO_ONLY);
+ connection = app.mCM.dial(phone, numberToDial, VideoProfile.VideoState.AUDIO_ONLY);
} catch (CallStateException ex) {
// CallStateException means a new outgoing call is not currently
// possible: either no more call slots exist, or there's another
diff --git a/src/com/android/phone/Ringer.java b/src/com/android/phone/Ringer.java
index 668f8dc..b542ede 100644
--- a/src/com/android/phone/Ringer.java
+++ b/src/com/android/phone/Ringer.java
@@ -36,6 +36,8 @@
import android.util.Log;
import com.android.internal.telephony.Phone;
+import com.android.phone.common.util.SettingsUtil;
+
/**
* Ringer manager for the Phone app.
*/
@@ -210,7 +212,7 @@
boolean shouldVibrate() {
AudioManager audioManager = (AudioManager) mContext.getSystemService(Context.AUDIO_SERVICE);
int ringerMode = audioManager.getRingerMode();
- if (CallFeaturesSetting.getVibrateWhenRinging(mContext)) {
+ if (SettingsUtil.getVibrateWhenRingingSetting(mContext)) {
return ringerMode != AudioManager.RINGER_MODE_SILENT;
} else {
return ringerMode == AudioManager.RINGER_MODE_VIBRATE;
diff --git a/src/com/android/services/telephony/CdmaConnection.java b/src/com/android/services/telephony/CdmaConnection.java
index 668308a..f13676a 100644
--- a/src/com/android/services/telephony/CdmaConnection.java
+++ b/src/com/android/services/telephony/CdmaConnection.java
@@ -16,7 +16,7 @@
package com.android.services.telephony;
-import android.telecomm.CallCapabilities;
+import android.telecomm.PhoneCapabilities;
import com.android.internal.telephony.Connection;
@@ -49,7 +49,7 @@
@Override
protected int buildCallCapabilities() {
- int capabilities = CallCapabilities.MUTE;
+ int capabilities = PhoneCapabilities.MUTE;
return capabilities;
}
}
diff --git a/src/com/android/services/telephony/GsmConferenceController.java b/src/com/android/services/telephony/GsmConferenceController.java
index 127a575..a69d1e6 100644
--- a/src/com/android/services/telephony/GsmConferenceController.java
+++ b/src/com/android/services/telephony/GsmConferenceController.java
@@ -16,15 +16,10 @@
package com.android.services.telephony;
-import com.android.internal.telephony.Call;
-import com.android.internal.telephony.PhoneFactory;
-
import java.util.ArrayList;
import java.util.Collections;
-import java.util.HashSet;
import java.util.List;
-import java.util.Set;
import android.telecomm.Connection;
diff --git a/src/com/android/services/telephony/GsmConnection.java b/src/com/android/services/telephony/GsmConnection.java
index 298f3d9..5140574 100644
--- a/src/com/android/services/telephony/GsmConnection.java
+++ b/src/com/android/services/telephony/GsmConnection.java
@@ -16,7 +16,7 @@
package com.android.services.telephony;
-import android.telecomm.CallCapabilities;
+import android.telecomm.PhoneCapabilities;
import com.android.internal.telephony.CallStateException;
import com.android.internal.telephony.Connection;
@@ -68,12 +68,12 @@
@Override
protected int buildCallCapabilities() {
- int capabilities = CallCapabilities.MUTE | CallCapabilities.SUPPORT_HOLD;
- if (getState() == State.ACTIVE || getState() == State.HOLDING) {
- capabilities |= CallCapabilities.HOLD;
+ int capabilities = PhoneCapabilities.MUTE | PhoneCapabilities.SUPPORT_HOLD;
+ if (getState() == STATE_ACTIVE || getState() == STATE_HOLDING) {
+ capabilities |= PhoneCapabilities.HOLD;
}
if (mIsConferenceCapable) {
- capabilities |= CallCapabilities.MERGE_CALLS;
+ capabilities |= PhoneCapabilities.MERGE_CALLS;
}
return capabilities;
}
diff --git a/src/com/android/services/telephony/TelecommAccountRegistry.java b/src/com/android/services/telephony/TelecommAccountRegistry.java
index d40e9af..658d611 100644
--- a/src/com/android/services/telephony/TelecommAccountRegistry.java
+++ b/src/com/android/services/telephony/TelecommAccountRegistry.java
@@ -89,15 +89,16 @@
String description = isEmergency
? "Emergency calling only"
: dummyPrefix + "SIM card in slot " + slotId;
- PhoneAccount account = new PhoneAccount(
- phoneAccountHandle,
- Uri.fromParts(TEL_SCHEME, line1Number, null),
- subNumber,
- PhoneAccount.CAPABILITY_SIM_SUBSCRIPTION |
- PhoneAccount.CAPABILITY_CALL_PROVIDER,
- com.android.phone.R.mipmap.ic_launcher_phone,
- label,
- description);
+ PhoneAccount account = PhoneAccount.builder()
+ .withAccountHandle(phoneAccountHandle)
+ .withHandle(Uri.fromParts(TEL_SCHEME, line1Number, null))
+ .withSubscriptionNumber(subNumber)
+ .withCapabilities(PhoneAccount.CAPABILITY_SIM_SUBSCRIPTION |
+ PhoneAccount.CAPABILITY_CALL_PROVIDER)
+ .withIconResId(com.android.phone.R.mipmap.ic_launcher_phone)
+ .withLabel(label)
+ .withShortDescription(description)
+ .build();
// Register with Telecomm and put into the account entry.
mTelecommManager.registerPhoneAccount(account);
diff --git a/src/com/android/services/telephony/TelephonyConnection.java b/src/com/android/services/telephony/TelephonyConnection.java
index 7bd43b2..7ddb6d0 100644
--- a/src/com/android/services/telephony/TelephonyConnection.java
+++ b/src/com/android/services/telephony/TelephonyConnection.java
@@ -20,18 +20,15 @@
import android.os.AsyncResult;
import android.os.Handler;
import android.os.Message;
-import android.telecomm.CallAudioState;
-import android.telecomm.CallCapabilities;
+import android.telecomm.AudioState;
+import android.telecomm.Connection;
+import android.telecomm.PhoneCapabilities;
import android.telephony.DisconnectCause;
import com.android.internal.telephony.Call;
import com.android.internal.telephony.CallStateException;
import com.android.internal.telephony.Connection.PostDialListener;
import com.android.internal.telephony.Phone;
-import com.android.phone.R;
-
-import android.telecomm.Connection;
-import android.telecomm.ConnectionService;
import java.lang.Override;
import java.util.List;
@@ -113,12 +110,11 @@
* The {@link com.android.internal.telephony.Connection} has reported a change in the
* video call provider.
*
- * @param videoCallProvider The video call provider.
+ * @param videoProvider The video call provider.
*/
@Override
- public void onVideoCallProviderChanged(
- ConnectionService.VideoCallProvider videoCallProvider) {
- setVideoCallProvider(videoCallProvider);
+ public void onVideoProviderChanged(VideoProvider videoProvider) {
+ setVideoProvider(videoProvider);
}
/**
@@ -138,20 +134,20 @@
/**
* Determines if the {@link TelephonyConnection} has local video capabilities.
- * This is used when {@link TelephonyConnection#updateCallCapabilities}} is called,
- * ensuring the appropriate {@link CallCapabilities} are set. Since {@link CallCapabilities}
+ * This is used when {@link TelephonyConnection#updateCallCapabilities()}} is called,
+ * ensuring the appropriate {@link PhoneCapabilities} are set. Since {@link PhoneCapabilities}
* can be rebuilt at any time it is necessary to track the video capabilities between rebuild.
- * The {@link CallCapabilities} (including video capabilities) are communicated to the telecomm
+ * The {@link PhoneCapabilities} (including video capabilities) are communicated to the telecomm
* layer.
*/
private boolean mLocalVideoCapable;
/**
* Determines if the {@link TelephonyConnection} has remote video capabilities.
- * This is used when {@link TelephonyConnection#updateCallCapabilities}} is called,
- * ensuring the appropriate {@link CallCapabilities} are set. Since {@link CallCapabilities}
+ * This is used when {@link TelephonyConnection#updateCallCapabilities()}} is called,
+ * ensuring the appropriate {@link PhoneCapabilities} are set. Since {@link PhoneCapabilities}
* can be rebuilt at any time it is necessary to track the video capabilities between rebuild.
- * The {@link CallCapabilities} (including video capabilities) are communicated to the telecomm
+ * The {@link PhoneCapabilities} (including video capabilities) are communicated to the telecomm
* layer.
*/
private boolean mRemoteVideoCapable;
@@ -170,7 +166,7 @@
}
@Override
- public void onSetAudioState(CallAudioState audioState) {
+ public void onSetAudioState(AudioState audioState) {
// TODO: update TTY mode.
if (getPhone() != null) {
getPhone().setEchoSuppressionEnabled();
@@ -292,11 +288,6 @@
}
@Override
- public void onSwapWithBackgroundCall() {
- Log.v(this, "onSwapWithBackgroundCall");
- }
-
- @Override
public void onChildrenChanged(List<Connection> children) {
Log.v(this, "onChildrenChanged, children: " + children);
}
@@ -356,7 +347,7 @@
setVideoState(mOriginalConnection.getVideoState());
setLocalVideoCapable(mOriginalConnection.isLocalVideoCapable());
setRemoteVideoCapable(mOriginalConnection.isRemoteVideoCapable());
- setVideoCallProvider(mOriginalConnection.getVideoCallProvider());
+ setVideoProvider(mOriginalConnection.getVideoProvider());
setAudioQuality(mOriginalConnection.getAudioQuality());
updateHandle();
@@ -491,18 +482,18 @@
int currentCapabilities = capabilities;
if (mRemoteVideoCapable) {
currentCapabilities = applyCapability(currentCapabilities,
- CallCapabilities.SUPPORTS_VT_REMOTE);
+ PhoneCapabilities.SUPPORTS_VT_REMOTE);
} else {
currentCapabilities = removeCapability(currentCapabilities,
- CallCapabilities.SUPPORTS_VT_REMOTE);
+ PhoneCapabilities.SUPPORTS_VT_REMOTE);
}
if (mLocalVideoCapable) {
currentCapabilities = applyCapability(currentCapabilities,
- CallCapabilities.SUPPORTS_VT_LOCAL);
+ PhoneCapabilities.SUPPORTS_VT_LOCAL);
} else {
currentCapabilities = removeCapability(currentCapabilities,
- CallCapabilities.SUPPORTS_VT_LOCAL);
+ PhoneCapabilities.SUPPORTS_VT_LOCAL);
}
return currentCapabilities;
}
@@ -520,9 +511,9 @@
if (mAudioQuality ==
com.android.internal.telephony.Connection.AUDIO_QUALITY_HIGH_DEFINITION) {
- currentCapabilities = applyCapability(currentCapabilities, CallCapabilities.VoLTE);
+ currentCapabilities = applyCapability(currentCapabilities, PhoneCapabilities.VoLTE);
} else {
- currentCapabilities = removeCapability(currentCapabilities, CallCapabilities.VoLTE);
+ currentCapabilities = removeCapability(currentCapabilities, PhoneCapabilities.VoLTE);
}
return currentCapabilities;
@@ -548,7 +539,7 @@
/**
* Sets whether video capability is present locally. Used during rebuild of the
- * {@link CallCapabilities} to set the video call capabilities.
+ * {@link PhoneCapabilities} to set the video call capabilities.
*
* @param capable {@code True} if video capable.
*/
@@ -559,7 +550,7 @@
/**
* Sets whether video capability is present remotely. Used during rebuild of the
- * {@link CallCapabilities} to set the video call capabilities.
+ * {@link PhoneCapabilities} to set the video call capabilities.
*
* @param capable {@code True} if video capable.
*/
@@ -570,7 +561,7 @@
/**
* Sets the current call audio quality. Used during rebuild of the
- * {@link CallCapabilities} to set or unset the {@link CallCapabilities#VoLTE} capability.
+ * {@link PhoneCapabilities} to set or unset the {@link PhoneCapabilities#VoLTE} capability.
*
* @param audioQuality The audio quality.
*/
diff --git a/src/com/android/services/telephony/TelephonyConnectionService.java b/src/com/android/services/telephony/TelephonyConnectionService.java
index 7868c72..bfae89e 100644
--- a/src/com/android/services/telephony/TelephonyConnectionService.java
+++ b/src/com/android/services/telephony/TelephonyConnectionService.java
@@ -17,9 +17,10 @@
package com.android.services.telephony;
import android.content.ComponentName;
+import android.content.Intent;
import android.net.Uri;
-import android.telecomm.CallCapabilities;
import android.telecomm.Connection;
+import android.telecomm.PhoneCapabilities;
import android.telecomm.ConnectionRequest;
import android.telecomm.ConnectionService;
import android.telecomm.PhoneAccountHandle;
@@ -36,6 +37,7 @@
import com.android.internal.telephony.PhoneConstants;
import com.android.internal.telephony.PhoneFactory;
import com.android.internal.telephony.SubscriptionController;
+import com.android.phone.MMIDialogActivity;
import java.util.Objects;
@@ -63,21 +65,21 @@
Uri handle = request.getHandle();
if (handle == null) {
Log.d(this, "onCreateOutgoingConnection, handle is null");
- return Connection.getFailedConnection(DisconnectCause.NO_PHONE_NUMBER_SUPPLIED,
+ return Connection.createFailedConnection(DisconnectCause.NO_PHONE_NUMBER_SUPPLIED,
"Handle is null");
}
if (!SCHEME_TEL.equals(handle.getScheme())) {
Log.d(this, "onCreateOutgoingConnection, Handle %s is not type tel",
handle.getScheme());
- return Connection.getFailedConnection(DisconnectCause.INVALID_NUMBER,
+ return Connection.createFailedConnection(DisconnectCause.INVALID_NUMBER,
"Handle scheme is not type tel");
}
final String number = handle.getSchemeSpecificPart();
if (TextUtils.isEmpty(number)) {
Log.d(this, "onCreateOutgoingConnection, unable to parse number");
- return Connection.getFailedConnection(DisconnectCause.INVALID_NUMBER,
+ return Connection.createFailedConnection(DisconnectCause.INVALID_NUMBER,
"Unable to parse number");
}
@@ -87,7 +89,7 @@
final Phone phone = getPhoneForAccount(request.getAccountHandle(), isEmergencyNumber);
if (phone == null) {
Log.d(this, "onCreateOutgoingConnection, phone is null");
- return Connection.getFailedConnection(DisconnectCause.OUTGOING_FAILURE,
+ return Connection.createFailedConnection(DisconnectCause.OUTGOING_FAILURE,
"Phone is null");
}
@@ -98,21 +100,21 @@
case ServiceState.STATE_EMERGENCY_ONLY:
break;
case ServiceState.STATE_OUT_OF_SERVICE:
- return Connection.getFailedConnection(DisconnectCause.OUT_OF_SERVICE,
+ return Connection.createFailedConnection(DisconnectCause.OUT_OF_SERVICE,
"ServiceState.STATE_OUT_OF_SERVICE");
case ServiceState.STATE_POWER_OFF:
- return Connection.getFailedConnection(DisconnectCause.POWER_OFF,
+ return Connection.createFailedConnection(DisconnectCause.POWER_OFF,
"ServiceState.STATE_POWER_OFF");
default:
Log.d(this, "onCreateOutgoingConnection, unkown service state: %d", state);
- return Connection.getFailedConnection(DisconnectCause.OUTGOING_FAILURE,
+ return Connection.createFailedConnection(DisconnectCause.OUTGOING_FAILURE,
"Unknown service state " + state);
}
}
final TelephonyConnection connection = createConnectionFor(phone.getPhoneType(), null);
if (connection == null) {
- return Connection.getFailedConnection(
+ return Connection.createFailedConnection(
DisconnectCause.OUTGOING_FAILURE, "Invalid phone type");
}
connection.setHandle(handle, PhoneConstants.PRESENTATION_ALLOWED);
@@ -153,7 +155,7 @@
Response<String, Connection> response) {
Log.v(this, "onCreateConferenceConnection, connection: " + connection);
if (connection instanceof GsmConnection || connection instanceof ConferenceConnection) {
- if ((connection.getCallCapabilities() & CallCapabilities.MERGE_CALLS) != 0) {
+ if ((connection.getCallCapabilities() & PhoneCapabilities.MERGE_CALLS) != 0) {
response.onResult(token,
GsmConferenceController.createConferenceConnection(connection));
}
@@ -168,28 +170,29 @@
Phone phone = getPhoneForAccount(request.getAccountHandle(), false);
if (phone == null) {
- return Connection.getFailedConnection(DisconnectCause.ERROR_UNSPECIFIED, null);
+ return Connection.createFailedConnection(DisconnectCause.ERROR_UNSPECIFIED, null);
}
Call call = phone.getRingingCall();
if (!call.getState().isRinging()) {
Log.v(this, "onCreateIncomingConnection, no ringing call");
- return Connection.getFailedConnection(DisconnectCause.INCOMING_MISSED,
+ return Connection.createFailedConnection(DisconnectCause.INCOMING_MISSED,
"Found no ringing call");
}
com.android.internal.telephony.Connection originalConnection = call.getEarliestConnection();
if (isOriginalConnectionKnown(originalConnection)) {
Log.v(this, "onCreateIncomingConnection, original connection already registered");
- return Connection.getCanceledConnection();
+ return Connection.createCanceledConnection();
}
Connection connection = createConnectionFor(phone.getPhoneType(), originalConnection);
if (connection == null) {
- connection = Connection.getCanceledConnection();
+ connection = Connection.createCanceledConnection();
+ return Connection.createCanceledConnection();
+ } else {
+ return connection;
}
-
- return connection;
}
private void placeOutgoingConnection(
@@ -210,7 +213,12 @@
// On GSM phones, null connection means that we dialed an MMI code
if (phone.getPhoneType() == PhoneConstants.PHONE_TYPE_GSM) {
+ Log.d(this, "dialed MMI code");
disconnectCause = DisconnectCause.DIALED_MMI;
+ final Intent intent = new Intent(this, MMIDialogActivity.class);
+ intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK |
+ Intent.FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS);
+ startActivity(intent);
}
Log.d(this, "placeOutgoingConnection, phone.dial returned null");
connection.setFailed(disconnectCause, "Connection is null");