summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorTyler Gunn <tgunn@google.com>2015-02-04 18:58:58 +0000
committerAndroid Git Automerger <android-git-automerger@android.com>2015-02-04 18:58:58 +0000
commit360aa1ce05dea7f0a18db4612accf43c7137b2c0 (patch)
tree10758f42fc70d902581a30eb78b4e04b22a99cc7 /src
parent0f010049bb2acb27e293022b8b3112f9f296138a (diff)
parentf4f09521c20134fb2690c6a58e4ce203e0055d9c (diff)
am f4f09521: am 2e7ea428: am 7aaf2414: Fixing issue where carrier name shows up in call log on single sim devices.
* commit 'f4f09521c20134fb2690c6a58e4ce203e0055d9c': Fixing issue where carrier name shows up in call log on single sim devices.
Diffstat (limited to 'src')
-rw-r--r--src/com/android/dialer/calllog/PhoneAccountUtils.java11
1 files changed, 9 insertions, 2 deletions
diff --git a/src/com/android/dialer/calllog/PhoneAccountUtils.java b/src/com/android/dialer/calllog/PhoneAccountUtils.java
index f9bd9ad4a..f80ffd089 100644
--- a/src/com/android/dialer/calllog/PhoneAccountUtils.java
+++ b/src/com/android/dialer/calllog/PhoneAccountUtils.java
@@ -74,20 +74,27 @@ public class PhoneAccountUtils {
* Extract account color from PhoneAccount object.
*/
public static int getAccountColor(Context context, PhoneAccountHandle accountHandle) {
- PhoneAccount account = getAccountOrNull(context, accountHandle);
+ TelecomManager telecomManager =
+ (TelecomManager) context.getSystemService(Context.TELECOM_SERVICE);
+ final PhoneAccount account = telecomManager.getPhoneAccount(accountHandle);
+
// For single-sim devices the PhoneAccount will be NO_HIGHLIGHT_COLOR by default, so it is
// safe to always use the account highlight color.
return account == null ? PhoneAccount.NO_HIGHLIGHT_COLOR : account.getHighlightColor();
}
/**
- * Retrieve the account metadata.
+ * Retrieve the account metadata, but if the account does not exist or the device has only a
+ * single registered and enabled account, return null.
*/
private static PhoneAccount getAccountOrNull(Context context,
PhoneAccountHandle accountHandle) {
TelecomManager telecomManager =
(TelecomManager) context.getSystemService(Context.TELECOM_SERVICE);
final PhoneAccount account = telecomManager.getPhoneAccount(accountHandle);
+ if (!telecomManager.hasMultipleCallCapableAccounts()) {
+ return null;
+ }
return account;
}
}