diff options
author | Treehugger Robot <treehugger-gerrit@google.com> | 2018-05-15 19:31:05 +0000 |
---|---|---|
committer | Gerrit Code Review <noreply-gerritcodereview@google.com> | 2018-05-15 19:31:05 +0000 |
commit | 47636a2531e2a1d6c51b1cd3fb6e242f457b2f71 (patch) | |
tree | 2de3818a7fa2c123be648ee01d9e551596f09ae2 /java/com/android/dialer/phonelookup/consolidator/PhoneLookupInfoConsolidator.java | |
parent | 21f2f3e1d5eba2cc436b0f1c78d9e354f209287d (diff) | |
parent | 3e2c6b8c22b238c3f3b1d9786a045f0a20615fa0 (diff) |
Merge changes Id53c298a,I7df0ece7,I9f41b1a7,Iffbfa408,I2aac0df1, ...
* changes:
Don't use LoaderManager.getInstance() in dialer.
Implement PhoneNumberCacheLookup
Fix add call button behavior.
Use component for iconography
Move SpamStub to separate package.
Initialize dialpadFragment and searchFragment with FragmentManager when MainSearchController is created
Compress all of dialer's png files.
Delete unused check__SpamStatus methods
Refactor simulator menu and add portal package for adding simulator service later.
Add simulator component in generated root component.
Update DialerCall to use SpamStatus instead of booleans
Added contacts permission screen to speed dial fragment.
Don't crash when cp2 returns a null label.
Register system call log content observer if user enables Phone permission.
Exit multiselect mode when opening the dialpad.
Support missing phone permission in new call log.
Diffstat (limited to 'java/com/android/dialer/phonelookup/consolidator/PhoneLookupInfoConsolidator.java')
-rw-r--r-- | java/com/android/dialer/phonelookup/consolidator/PhoneLookupInfoConsolidator.java | 49 |
1 files changed, 45 insertions, 4 deletions
diff --git a/java/com/android/dialer/phonelookup/consolidator/PhoneLookupInfoConsolidator.java b/java/com/android/dialer/phonelookup/consolidator/PhoneLookupInfoConsolidator.java index 29a0de56b..efd7ae6f1 100644 --- a/java/com/android/dialer/phonelookup/consolidator/PhoneLookupInfoConsolidator.java +++ b/java/com/android/dialer/phonelookup/consolidator/PhoneLookupInfoConsolidator.java @@ -47,7 +47,8 @@ public final class PhoneLookupInfoConsolidator { NameSource.CP2_EXTENDED_DIRECTORY, NameSource.PEOPLE_API, NameSource.CEQUINT, - NameSource.CNAP + NameSource.CNAP, + NameSource.PHONE_NUMBER_CACHE }) @interface NameSource { int NONE = 0; // used when none of the other sources can provide the name @@ -56,6 +57,7 @@ public final class PhoneLookupInfoConsolidator { int PEOPLE_API = 3; int CEQUINT = 4; int CNAP = 5; + int PHONE_NUMBER_CACHE = 6; } /** @@ -81,7 +83,8 @@ public final class PhoneLookupInfoConsolidator { NameSource.CP2_EXTENDED_DIRECTORY, NameSource.PEOPLE_API, NameSource.CEQUINT, - NameSource.CNAP); + NameSource.CNAP, + NameSource.PHONE_NUMBER_CACHE); private final @NameSource int nameSource; private final PhoneLookupInfo phoneLookupInfo; @@ -113,6 +116,13 @@ public final class PhoneLookupInfoConsolidator { return ContactSource.Type.SOURCE_TYPE_CEQUINT_CALLER_ID; case NameSource.CNAP: return ContactSource.Type.SOURCE_TYPE_CNAP; + case NameSource.PHONE_NUMBER_CACHE: + ContactSource.Type sourceType = + ContactSource.Type.forNumber(phoneLookupInfo.getMigratedInfo().getSourceType()); + if (sourceType == null) { + sourceType = ContactSource.Type.UNKNOWN_SOURCE_TYPE; + } + return sourceType; case NameSource.NONE: return ContactSource.Type.UNKNOWN_SOURCE_TYPE; default: @@ -155,6 +165,8 @@ public final class PhoneLookupInfoConsolidator { return phoneLookupInfo.getCequintInfo().getName(); case NameSource.CNAP: return phoneLookupInfo.getCnapInfo().getName(); + case NameSource.PHONE_NUMBER_CACHE: + return phoneLookupInfo.getMigratedInfo().getName(); case NameSource.NONE: return ""; default: @@ -176,6 +188,8 @@ public final class PhoneLookupInfoConsolidator { return Assert.isNotNull(firstDefaultCp2Contact).getPhotoThumbnailUri(); case NameSource.CP2_EXTENDED_DIRECTORY: return Assert.isNotNull(firstExtendedCp2Contact).getPhotoThumbnailUri(); + case NameSource.PHONE_NUMBER_CACHE: + return phoneLookupInfo.getMigratedInfo().getPhotoUri(); case NameSource.PEOPLE_API: case NameSource.CEQUINT: case NameSource.CNAP: @@ -202,6 +216,8 @@ public final class PhoneLookupInfoConsolidator { return Assert.isNotNull(firstExtendedCp2Contact).getPhotoUri(); case NameSource.CEQUINT: return phoneLookupInfo.getCequintInfo().getPhotoUri(); + case NameSource.PHONE_NUMBER_CACHE: + return phoneLookupInfo.getMigratedInfo().getPhotoUri(); case NameSource.PEOPLE_API: case NameSource.CNAP: case NameSource.NONE: @@ -222,6 +238,7 @@ public final class PhoneLookupInfoConsolidator { return Math.max(Assert.isNotNull(firstDefaultCp2Contact).getPhotoId(), 0); case NameSource.CP2_EXTENDED_DIRECTORY: return Math.max(Assert.isNotNull(firstExtendedCp2Contact).getPhotoId(), 0); + case NameSource.PHONE_NUMBER_CACHE: case NameSource.PEOPLE_API: case NameSource.CEQUINT: case NameSource.CNAP: @@ -246,6 +263,7 @@ public final class PhoneLookupInfoConsolidator { return Assert.isNotNull(firstExtendedCp2Contact).getLookupUri(); case NameSource.PEOPLE_API: return Assert.isNotNull(phoneLookupInfo.getPeopleApiInfo().getLookupUri()); + case NameSource.PHONE_NUMBER_CACHE: case NameSource.CEQUINT: case NameSource.CNAP: case NameSource.NONE: @@ -270,6 +288,8 @@ public final class PhoneLookupInfoConsolidator { return Assert.isNotNull(firstDefaultCp2Contact).getLabel(); case NameSource.CP2_EXTENDED_DIRECTORY: return Assert.isNotNull(firstExtendedCp2Contact).getLabel(); + case NameSource.PHONE_NUMBER_CACHE: + return phoneLookupInfo.getMigratedInfo().getLabel(); case NameSource.PEOPLE_API: case NameSource.CEQUINT: case NameSource.CNAP: @@ -296,6 +316,7 @@ public final class PhoneLookupInfoConsolidator { case NameSource.CP2_EXTENDED_DIRECTORY: case NameSource.PEOPLE_API: case NameSource.CNAP: + case NameSource.PHONE_NUMBER_CACHE: case NameSource.NONE: return ""; default: @@ -309,8 +330,21 @@ public final class PhoneLookupInfoConsolidator { * returns whether the number belongs to a business place. */ public boolean isBusiness() { - return phoneLookupInfo.hasPeopleApiInfo() - && phoneLookupInfo.getPeopleApiInfo().getInfoType() == InfoType.NEARBY_BUSINESS; + switch (nameSource) { + case NameSource.PEOPLE_API: + return phoneLookupInfo.getPeopleApiInfo().getInfoType() == InfoType.NEARBY_BUSINESS; + case NameSource.PHONE_NUMBER_CACHE: + return phoneLookupInfo.getMigratedInfo().getIsBusiness(); + case NameSource.CP2_DEFAULT_DIRECTORY: + case NameSource.CP2_EXTENDED_DIRECTORY: + case NameSource.CEQUINT: + case NameSource.CNAP: + case NameSource.NONE: + return false; + default: + throw Assert.createUnsupportedOperationFailException( + String.format("Unsupported name source: %s", nameSource)); + } } /** @@ -366,6 +400,7 @@ public final class PhoneLookupInfoConsolidator { case NameSource.CP2_EXTENDED_DIRECTORY: case NameSource.CEQUINT: case NameSource.CNAP: + case NameSource.PHONE_NUMBER_CACHE: case NameSource.NONE: return false; case NameSource.PEOPLE_API: @@ -390,6 +425,7 @@ public final class PhoneLookupInfoConsolidator { case NameSource.PEOPLE_API: case NameSource.CEQUINT: case NameSource.CNAP: + case NameSource.PHONE_NUMBER_CACHE: case NameSource.NONE: return false; default: @@ -452,6 +488,11 @@ public final class PhoneLookupInfoConsolidator { return NameSource.CNAP; } break; + case NameSource.PHONE_NUMBER_CACHE: + if (!phoneLookupInfo.getMigratedInfo().getName().isEmpty()) { + return NameSource.PHONE_NUMBER_CACHE; + } + break; default: throw Assert.createUnsupportedOperationFailException( String.format("Unsupported name source: %s", nameSource)); |