diff options
author | Tyler Gunn <tgunn@google.com> | 2015-02-03 13:06:33 -0800 |
---|---|---|
committer | Tyler Gunn <tgunn@google.com> | 2015-02-03 13:06:33 -0800 |
commit | 7aaf24148e874e7a2f8565af49564fe272eff7f2 (patch) | |
tree | 8b7352420af462aee1a12929dce302c1752b9c8c /src | |
parent | 7c35a8e9d185b044b4913b548a6245d46a589be3 (diff) |
Fixing issue where carrier name shows up in call log on single sim devices.
Fixes a bug introduced in ag/608822. Reverts the code for the
getAccountOrNull method and modifies getAccountColor to have the
special-case cose which was in getAccountOrNull.
Bug: 19248327
Change-Id: I558cdbd8d9994a1f07f82073ba35e9ec69693a2a
Diffstat (limited to 'src')
-rw-r--r-- | src/com/android/dialer/calllog/PhoneAccountUtils.java | 11 |
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; } } |