diff --git a/AndroidManifest.xml b/AndroidManifest.xml
index c8362f0f1c2..d262651a2bf 100644
--- a/AndroidManifest.xml
+++ b/AndroidManifest.xml
@@ -1624,6 +1624,16 @@
+
+
+
+
+
+
+
Use %1$s instead of %2$s as your SMS app?
Use %s as your SMS app?
+
+ Default phone app
+
+ Change default phone app?
+
Active network scorer
diff --git a/res/xml/wireless_settings.xml b/res/xml/wireless_settings.xml
index bf1523e686b..bad7da66ec2 100644
--- a/res/xml/wireless_settings.xml
+++ b/res/xml/wireless_settings.xml
@@ -4,9 +4,9 @@
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.
@@ -29,6 +29,12 @@
android:summary="%s"
android:persistent="false" />
+
+
dialers =
+ PhoneApplication.getInstalledPhoneApplications(getActivity());
+
+ final int count = dialers.size();
+ final String[] packageNames = new String[count];
+ for (int i = 0; i < count; i++) {
+ packageNames[i] = dialers.get(i).getPackageName();
+ }
+ String defaultPackageName = null;
+ final ComponentName appName = PhoneApplication.getDefaultPhoneApplication(getActivity());
+ if (appName != null) {
+ defaultPackageName = appName.getPackageName();
+ }
+ mDialerApplicationPreference.setPackageNames(packageNames, defaultPackageName);
+ }
+
@Override
public Dialog onCreateDialog(int dialogId) {
log("onCreateDialog: dialogId=" + dialogId);
@@ -242,6 +263,10 @@ public class WirelessSettings extends RestrictedSettingsFragment
return mTm.isSmsCapable();
}
+ private boolean isVoiceCapable() {
+ return mTm.isVoiceCapable();
+ }
+
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
@@ -272,6 +297,10 @@ public class WirelessSettings extends RestrictedSettingsFragment
mSmsApplicationPreference.setOnPreferenceChangeListener(this);
initSmsApplicationSetting();
+ mDialerApplicationPreference = (AppListPreference) findPreference(KEY_PHONE_APPLICATION);
+ mDialerApplicationPreference.setOnPreferenceChangeListener(this);
+ initDialerApplicationSetting();
+
// Remove NSD checkbox by default
getPreferenceScreen().removePreference(nsd);
//mNsdEnabler = new NsdEnabler(activity, nsd);
@@ -346,6 +375,11 @@ public class WirelessSettings extends RestrictedSettingsFragment
removePreference(KEY_SMS_APPLICATION);
}
+ // Remove Dialer setting if the device does not support voice
+ if (!isVoiceCapable()) {
+ removePreference(KEY_PHONE_APPLICATION);
+ }
+
// Remove Airplane Mode settings if it's a stationary device such as a TV.
if (mPm.hasSystemFeature(PackageManager.FEATURE_TELEVISION)) {
removePreference(KEY_TOGGLE_AIRPLANE);
@@ -454,6 +488,9 @@ public class WirelessSettings extends RestrictedSettingsFragment
if (preference == mSmsApplicationPreference && newValue != null) {
SmsApplication.setDefaultApplication(newValue.toString(), getActivity());
return true;
+ } else if (preference == mDialerApplicationPreference && newValue != null) {
+ PhoneApplication.setDefaultPhoneApplication(newValue.toString(), getActivity());
+ return true;
}
return false;
}
@@ -513,12 +550,17 @@ public class WirelessSettings extends RestrictedSettingsFragment
}
// Remove SMS Application if the device does not support SMS
- TelephonyManager tm =
+ final TelephonyManager tm =
(TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE);
if (!tm.isSmsCapable()) {
result.add(KEY_SMS_APPLICATION);
}
+ // Remove Phone Application if the device is not voice capable
+ if (!tm.isVoiceCapable()) {
+ result.add(KEY_PHONE_APPLICATION);
+ }
+
final PackageManager pm = context.getPackageManager();
// Remove Airplane Mode settings if it's a stationary device such as a TV.
@@ -530,8 +572,8 @@ public class WirelessSettings extends RestrictedSettingsFragment
result.add(KEY_PROXY_SETTINGS);
// Disable Tethering if it's not allowed or if it's a wifi-only device
- ConnectivityManager cm =
- (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE);
+ final ConnectivityManager cm = (ConnectivityManager) context.getSystemService(
+ Context.CONNECTIVITY_SERVICE);
if (isSecondaryUser || !cm.isTetheringSupported()) {
result.add(KEY_TETHER_SETTINGS);
}