Merge "Improve video calling setting visiblity behavior." into lmp-mr1-dev
diff --git a/res/values/strings.xml b/res/values/strings.xml
index 96291d0..5d9f835 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -134,8 +134,9 @@
<!-- Entry in dialog to "ask first" for accounts when making a call -->
<string name="phone_accounts_ask_every_time">Ask first</string>
- <!-- Label for heading of the accounts section in the phone accounts settings screen. -->
- <string name="phone_accounts_accounts_header">Accounts</string>
+ <!-- Label for heading of the per-account settings section in the phone accounts settings
+ screen. -->
+ <string name="phone_accounts_settings_header">Settings</string>
<!-- Label for invoking phone account selection screen -->
<string name="phone_accounts_choose_accounts">Choose accounts</string>
<!-- Label for heading in the phone account selection screen -->
diff --git a/res/xml/phone_account_settings.xml b/res/xml/phone_account_settings.xml
index abb4995..bf62ed0 100644
--- a/res/xml/phone_account_settings.xml
+++ b/res/xml/phone_account_settings.xml
@@ -18,6 +18,10 @@
xmlns:phone="http://schemas.android.com/apk/res/com.android.phone"
android:title="@string/phone_accounts">
+ <PreferenceCategory
+ android:key="phone_accounts_accounts_list_category_key"
+ android:title="@string/phone_accounts_settings_header" />
+
<com.android.phone.settings.AccountSelectionPreference
android:key="default_outgoing_account"
android:title="@string/phone_accounts_make_calls_with"
diff --git a/sip/src/com/android/services/telephony/sip/SipUtil.java b/sip/src/com/android/services/telephony/sip/SipUtil.java
index f93f02d..df1a03a 100644
--- a/sip/src/com/android/services/telephony/sip/SipUtil.java
+++ b/sip/src/com/android/services/telephony/sip/SipUtil.java
@@ -22,6 +22,7 @@
import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
+import android.graphics.BitmapFactory;
import android.net.Uri;
import android.net.sip.SipManager;
import android.net.sip.SipProfile;
@@ -118,7 +119,9 @@
.setCapabilities(PhoneAccount.CAPABILITY_CALL_PROVIDER)
.setAddress(Uri.parse(profile.getUriString()))
.setShortDescription(profile.getDisplayName())
- .setIconResId(R.drawable.ic_dialer_sip_black_24dp)
+ .setIconBitmap(BitmapFactory.decodeResource(
+ context.getResources(),
+ R.drawable.ic_dialer_sip_black_24dp))
.setSupportedUriSchemes(supportedUriSchemes);
return builder.build();
diff --git a/src/com/android/phone/CallFeaturesSetting.java b/src/com/android/phone/CallFeaturesSetting.java
index 5d4b023..5204500 100644
--- a/src/com/android/phone/CallFeaturesSetting.java
+++ b/src/com/android/phone/CallFeaturesSetting.java
@@ -115,6 +115,13 @@
// to trigger its configuration UI
public static final String ACTION_CONFIGURE_VOICEMAIL =
"com.android.phone.CallFeaturesSetting.CONFIGURE_VOICEMAIL";
+ // Extra on intent to Call Settings containing the id of the subscription to modify.
+ public static final String SUB_ID_EXTRA =
+ "com.android.phone.CallFeaturesSetting.SubscriptionId";
+ // Extra on intent to Call Settings containing the label of the subscription to modify.
+ public static final String SUB_LABEL_EXTRA =
+ "com.android.phone.CallFeaturesSetting.SubscriptionLabel";
+
// Extra put in the return from VM provider config containing voicemail number to set
public static final String VM_NUMBER_EXTRA = "com.android.phone.VoicemailNumber";
// Extra put in the return from VM provider config containing call forwarding number to set
@@ -124,10 +131,6 @@
// If the VM provider returns non null value in this extra we will force the user to
// choose another VM provider
public static final String SIGNOUT_EXTRA = "com.android.phone.Signout";
- //Information about logical "up" Activity
- private static final String UP_ACTIVITY_PACKAGE = "com.android.dialer";
- private static final String UP_ACTIVITY_CLASS =
- "com.android.dialer.DialtactsActivity";
// Suffix appended to provider key for storing vm number
public static final String VM_NUMBER_TAG = "#VMNumber";
@@ -831,7 +834,7 @@
mNewFwdSettings = VoicemailProviderSettings.NO_FORWARDING;
}
- //Throw a warning if the voicemail is the same and we did not change forwarding.
+ // Throw a warning if the voicemail is the same and we did not change forwarding.
if (mNewVMNumber.equals(mOldVmNumber)
&& mNewFwdSettings == VoicemailProviderSettings.NO_FORWARDING) {
showVMDialog(MSG_VM_NOCHANGE);
diff --git a/src/com/android/phone/settings/PhoneAccountSettingsFragment.java b/src/com/android/phone/settings/PhoneAccountSettingsFragment.java
index ba6871c..20fc108 100644
--- a/src/com/android/phone/settings/PhoneAccountSettingsFragment.java
+++ b/src/com/android/phone/settings/PhoneAccountSettingsFragment.java
@@ -8,12 +8,17 @@
import android.preference.CheckBoxPreference;
import android.preference.ListPreference;
import android.preference.Preference;
+import android.preference.PreferenceCategory;
import android.preference.PreferenceFragment;
import android.telecom.PhoneAccountHandle;
import android.telecom.TelecomManager;
+import android.telephony.SubInfoRecord;
+import android.telephony.SubscriptionManager;
+import android.telephony.TelephonyManager;
import android.util.Log;
import com.android.phone.R;
+import com.android.phone.CallFeaturesSetting;
import com.android.services.telephony.sip.SipAccountRegistry;
import com.android.services.telephony.sip.SipSharedPreferences;
import com.android.services.telephony.sip.SipUtil;
@@ -29,6 +34,9 @@
new Intent(TelecomManager.ACTION_CONNECTION_SERVICE_CONFIGURE)
.addCategory(Intent.CATEGORY_DEFAULT);
+ private static final String ACCOUNTS_LIST_CATEGORY_KEY =
+ "phone_accounts_accounts_list_category_key";
+
private static final String DEFAULT_OUTGOING_ACCOUNT_KEY = "default_outgoing_account";
private static final String CONFIGURE_CALL_ASSISTANT_PREF_KEY =
@@ -48,6 +56,8 @@
private TelecomManager mTelecomManager;
private Context mApplicationContext;
+ private PreferenceCategory mAccountList;
+
private AccountSelectionPreference mDefaultOutgoingAccount;
private AccountSelectionPreference mSelectCallAssistant;
private Preference mConfigureCallAssistant;
@@ -74,6 +84,16 @@
addPreferencesFromResource(com.android.phone.R.xml.phone_account_settings);
+ TelephonyManager telephonyManager =
+ (TelephonyManager) getActivity().getSystemService(Context.TELEPHONY_SERVICE);
+ mAccountList = (PreferenceCategory) getPreferenceScreen().findPreference(
+ ACCOUNTS_LIST_CATEGORY_KEY);
+ if (telephonyManager.getPhoneCount() > 1) {
+ initAccountList();
+ } else {
+ getPreferenceScreen().removePreference(mAccountList);
+ }
+
mDefaultOutgoingAccount = (AccountSelectionPreference)
getPreferenceScreen().findPreference(DEFAULT_OUTGOING_ACCOUNT_KEY);
if (mTelecomManager.getAllPhoneAccountsCount() > 1) {
@@ -269,4 +289,19 @@
mConfigureCallAssistant.setEnabled(true);
}
}
+
+ private void initAccountList() {
+ List<SubInfoRecord> subscriptions = SubscriptionManager.getActiveSubInfoList();
+ for (int i = 0; i < subscriptions.size(); i++) {
+ String label = subscriptions.get(i).getLabel();
+ Intent intent = new Intent(TelecomManager.ACTION_SHOW_CALL_SETTINGS);
+ intent.putExtra(CallFeaturesSetting.SUB_ID_EXTRA, subscriptions.get(i).subId);
+ intent.putExtra(CallFeaturesSetting.SUB_LABEL_EXTRA, label);
+
+ Preference accountPreference = new Preference(mApplicationContext);
+ accountPreference.setTitle(label);
+ accountPreference.setIntent(intent);
+ mAccountList.addPreference(accountPreference);
+ }
+ }
}
diff --git a/src/com/android/services/telephony/TelecomAccountRegistry.java b/src/com/android/services/telephony/TelecomAccountRegistry.java
index 5a480a5..f50db0c 100644
--- a/src/com/android/services/telephony/TelecomAccountRegistry.java
+++ b/src/com/android/services/telephony/TelecomAccountRegistry.java
@@ -21,6 +21,7 @@
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
+import android.graphics.BitmapFactory;
import android.net.Uri;
import android.telecom.PhoneAccount;
import android.telecom.PhoneAccountHandle;
@@ -35,7 +36,6 @@
import com.android.internal.telephony.Phone;
import com.android.internal.telephony.PhoneFactory;
import com.android.internal.telephony.PhoneProxy;
-import com.android.internal.telephony.SubscriptionController;
import com.android.internal.telephony.TelephonyIntents;
import com.android.phone.R;
@@ -123,8 +123,10 @@
if (record != null) {
subDisplayName = record.displayName;
slotId = record.slotId;
+
// Assign a "fake" color while the underlying Telephony stuff is refactored
- color = makeFakeColor(subId);
+ // Assign PhoneAccount.NO_COLOR to first slot so single-SIM phones are unchanged
+ color = slotId == 0? PhoneAccount.NO_COLOR : makeFakeColor(subId);
}
String slotIdString;
@@ -158,7 +160,9 @@
.setSubscriptionAddress(
Uri.fromParts(PhoneAccount.SCHEME_TEL, subNumber, null))
.setCapabilities(capabilities)
- .setIconResId(getPhoneAccountIcon(slotId))
+ .setIconBitmap(BitmapFactory.decodeResource(
+ mContext.getResources(),
+ getPhoneAccountIcon(slotId)))
.setColor(color)
.setShortDescription(description)
.setSupportedUriSchemes(Arrays.asList(