am 552c2606: Merge "Get info from SubInfoRecord for color and icon." into lmp-mr1-dev automerge: 98bc4a6
* commit '552c26069a0a21e998668c7b77647aae747f5bf9':
Get info from SubInfoRecord for color and icon.
diff --git a/res/drawable-hdpi/ic_multi_sim1.png b/res/drawable-hdpi/ic_multi_sim1.png
deleted file mode 100644
index 12b800c..0000000
--- a/res/drawable-hdpi/ic_multi_sim1.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-hdpi/ic_multi_sim2.png b/res/drawable-hdpi/ic_multi_sim2.png
deleted file mode 100644
index d468081..0000000
--- a/res/drawable-hdpi/ic_multi_sim2.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-hdpi/ic_multi_sim3.png b/res/drawable-hdpi/ic_multi_sim3.png
deleted file mode 100644
index be17bd4..0000000
--- a/res/drawable-hdpi/ic_multi_sim3.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-hdpi/ic_multi_sim4.png b/res/drawable-hdpi/ic_multi_sim4.png
deleted file mode 100644
index fbff161..0000000
--- a/res/drawable-hdpi/ic_multi_sim4.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-mdpi/ic_multi_sim1.png b/res/drawable-mdpi/ic_multi_sim1.png
deleted file mode 100644
index ef350bf..0000000
--- a/res/drawable-mdpi/ic_multi_sim1.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-mdpi/ic_multi_sim2.png b/res/drawable-mdpi/ic_multi_sim2.png
deleted file mode 100644
index a265723..0000000
--- a/res/drawable-mdpi/ic_multi_sim2.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-mdpi/ic_multi_sim3.png b/res/drawable-mdpi/ic_multi_sim3.png
deleted file mode 100644
index cce2d3f..0000000
--- a/res/drawable-mdpi/ic_multi_sim3.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-mdpi/ic_multi_sim4.png b/res/drawable-mdpi/ic_multi_sim4.png
deleted file mode 100644
index 233c386..0000000
--- a/res/drawable-mdpi/ic_multi_sim4.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-xhdpi/ic_multi_sim1.png b/res/drawable-xhdpi/ic_multi_sim1.png
deleted file mode 100644
index 1ad3288..0000000
--- a/res/drawable-xhdpi/ic_multi_sim1.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-xhdpi/ic_multi_sim2.png b/res/drawable-xhdpi/ic_multi_sim2.png
deleted file mode 100644
index 3a4152e..0000000
--- a/res/drawable-xhdpi/ic_multi_sim2.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-xhdpi/ic_multi_sim3.png b/res/drawable-xhdpi/ic_multi_sim3.png
deleted file mode 100644
index 4c36a1c..0000000
--- a/res/drawable-xhdpi/ic_multi_sim3.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-xhdpi/ic_multi_sim4.png b/res/drawable-xhdpi/ic_multi_sim4.png
deleted file mode 100644
index 26db92c..0000000
--- a/res/drawable-xhdpi/ic_multi_sim4.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-xxhdpi/ic_multi_sim1.png b/res/drawable-xxhdpi/ic_multi_sim1.png
deleted file mode 100644
index 6d89d58..0000000
--- a/res/drawable-xxhdpi/ic_multi_sim1.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-xxhdpi/ic_multi_sim2.png b/res/drawable-xxhdpi/ic_multi_sim2.png
deleted file mode 100644
index b9f3351..0000000
--- a/res/drawable-xxhdpi/ic_multi_sim2.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-xxhdpi/ic_multi_sim3.png b/res/drawable-xxhdpi/ic_multi_sim3.png
deleted file mode 100644
index beef5c8..0000000
--- a/res/drawable-xxhdpi/ic_multi_sim3.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-xxhdpi/ic_multi_sim4.png b/res/drawable-xxhdpi/ic_multi_sim4.png
deleted file mode 100644
index b947e84..0000000
--- a/res/drawable-xxhdpi/ic_multi_sim4.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-xxxhdpi/ic_multi_sim1.png b/res/drawable-xxxhdpi/ic_multi_sim1.png
deleted file mode 100644
index a4ebf5c..0000000
--- a/res/drawable-xxxhdpi/ic_multi_sim1.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-xxxhdpi/ic_multi_sim2.png b/res/drawable-xxxhdpi/ic_multi_sim2.png
deleted file mode 100644
index 5835784..0000000
--- a/res/drawable-xxxhdpi/ic_multi_sim2.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-xxxhdpi/ic_multi_sim3.png b/res/drawable-xxxhdpi/ic_multi_sim3.png
deleted file mode 100644
index cc9ef41..0000000
--- a/res/drawable-xxxhdpi/ic_multi_sim3.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-xxxhdpi/ic_multi_sim4.png b/res/drawable-xxxhdpi/ic_multi_sim4.png
deleted file mode 100644
index 49f2c09..0000000
--- a/res/drawable-xxxhdpi/ic_multi_sim4.png
+++ /dev/null
Binary files differ
diff --git a/res/values/strings.xml b/res/values/strings.xml
index a97d7c4..fabb30b 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -126,7 +126,7 @@
<string name="settings_label">Network settings</string>
<!-- Label for settings screen for phone accounts. -->
- <string name="phone_accounts">Phone account settings</string>
+ <string name="phone_accounts">Calling accounts</string>
<!-- Label for list item which opens a dialog to select the default outgoing account -->
<string name="phone_accounts_make_calls_with">Make calls with</string>
<!-- Label for list item which opens a dialog to select the default outgoing account for SIP calls. -->
diff --git a/res/xml/call_feature_setting.xml b/res/xml/call_feature_setting.xml
index 0182ac0..2ad10f2 100644
--- a/res/xml/call_feature_setting.xml
+++ b/res/xml/call_feature_setting.xml
@@ -25,7 +25,7 @@
android:targetPackage="com.android.phone"
android:targetClass="com.android.phone.settings.PhoneAccountSettingsActivity"/>
- </PreferenceScreen>>
+ </PreferenceScreen>
<PreferenceScreen
android:key="button_voicemail_category_key"
diff --git a/src/com/android/services/telephony/TelecomAccountRegistry.java b/src/com/android/services/telephony/TelecomAccountRegistry.java
index 7bd396b..3523288 100644
--- a/src/com/android/services/telephony/TelecomAccountRegistry.java
+++ b/src/com/android/services/telephony/TelecomAccountRegistry.java
@@ -18,6 +18,7 @@
import android.content.ComponentName;
import android.content.Context;
+import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.net.Uri;
import android.telecom.PhoneAccount;
@@ -47,26 +48,6 @@
final class TelecomAccountRegistry {
private static final boolean DBG = false; /* STOP SHIP if true */
- // Slot IDs are zero based indices but the numbered icons represent the first, second,
- // etc... SIM in the device. So that means that index 0 is SIM 1, index 1 is SIM 2 and so on.
-
- private final static int[] phoneAccountIcons = {
- R.drawable.ic_multi_sim1,
- R.drawable.ic_multi_sim2,
- R.drawable.ic_multi_sim3,
- R.drawable.ic_multi_sim4
- };
-
- private final static int[] colors = {
- 0xff00796b,
- 0xff3367d6,
- 0xff303f9f,
- 0xff7b1fa2,
- 0xffc2185b,
- 0xffc53929
- };
-
-
// This icon is the one that is used when the Slot ID that we have for a particular SIM
// is not supported, i.e. SubscriptionManager.INVALID_SLOT_ID or the 5th SIM in a phone.
private final static int defaultPhoneAccountIcon = R.drawable.ic_multi_sim;
@@ -113,6 +94,7 @@
String label;
String description;
+ Bitmap iconBitmap = null;
if (isEmergency) {
label = mContext.getResources().getString(R.string.sim_label_emergency_calls);
@@ -129,10 +111,9 @@
SubscriptionInfo record = SubscriptionManager.getSubscriptionInfoForSubscriber(subId);
if (record != null) {
subDisplayName = record.getDisplayName();
- slotId = record.getSubscriptionId();
-
- // Assign a "fake" color while the underlying Telephony stuff is refactored.
- color = makeFakeColor(subId);
+ slotId = record.getSimSlotIndex();
+ color = record.getIconTint();
+ iconBitmap = record.createIconBitmap(mContext);
}
String slotIdString;
@@ -161,12 +142,19 @@
PhoneAccount.CAPABILITY_CALL_PROVIDER |
PhoneAccount.CAPABILITY_PLACE_EMERGENCY_CALLS;
+ if (iconBitmap == null) {
+ iconBitmap = BitmapFactory.decodeResource(
+ mContext.getResources(),
+ defaultPhoneAccountIcon);
+ }
+
PhoneAccount account = PhoneAccount.builder(phoneAccountHandle, label)
.setAddress(Uri.fromParts(PhoneAccount.SCHEME_TEL, line1Number, null))
.setSubscriptionAddress(
Uri.fromParts(PhoneAccount.SCHEME_TEL, subNumber, null))
.setCapabilities(capabilities)
- .setIcon(mContext, getPhoneAccountIcon(slotId), color)
+ .setIcon(iconBitmap)
+ .setHighlightColor(color)
.setShortDescription(description)
.setSupportedUriSchemes(Arrays.asList(
PhoneAccount.SCHEME_TEL, PhoneAccount.SCHEME_VOICEMAIL))
@@ -182,10 +170,6 @@
}
}
- private int makeFakeColor(long subId) {
- return colors[((int) subId) % colors.length];
- }
-
private final SubscriptionListener mSubscriptionListener = new SubscriptionListener() {
@Override
public void onSubscriptionInfoChanged() {
@@ -322,16 +306,6 @@
cleanupPhoneAccounts();
}
- private int getPhoneAccountIcon(int index) {
- // A valid slot id doesn't necessarily mean that we have an icon for it.
- if (SubscriptionManager.isValidSlotId(index) &&
- index < TelecomAccountRegistry.phoneAccountIcons.length) {
- return TelecomAccountRegistry.phoneAccountIcons[index];
- }
- // Invalid indices get the default icon that has no number associated with it.
- return defaultPhoneAccountIcon;
- }
-
private void tearDownAccounts() {
for (AccountEntry entry : mAccounts) {
entry.teardown();