summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--java/com/android/dialer/phonelookup/PhoneLookupModule.java3
-rw-r--r--java/com/android/dialer/phonelookup/cequint/CequintPhoneLookup.java90
-rw-r--r--java/com/android/dialer/phonelookup/phone_lookup_info.proto14
3 files changed, 106 insertions, 1 deletions
diff --git a/java/com/android/dialer/phonelookup/PhoneLookupModule.java b/java/com/android/dialer/phonelookup/PhoneLookupModule.java
index 86e6991c1..c6e91c4a4 100644
--- a/java/com/android/dialer/phonelookup/PhoneLookupModule.java
+++ b/java/com/android/dialer/phonelookup/PhoneLookupModule.java
@@ -17,6 +17,7 @@
package com.android.dialer.phonelookup;
import com.android.dialer.phonelookup.blockednumber.SystemBlockedNumberPhoneLookup;
+import com.android.dialer.phonelookup.cequint.CequintPhoneLookup;
import com.android.dialer.phonelookup.cnap.CnapPhoneLookup;
import com.android.dialer.phonelookup.cp2.Cp2DefaultDirectoryPhoneLookup;
import com.android.dialer.phonelookup.cp2.Cp2ExtendedDirectoryPhoneLookup;
@@ -32,12 +33,14 @@ public abstract class PhoneLookupModule {
@Provides
@SuppressWarnings({"unchecked", "rawtype"})
static ImmutableList<PhoneLookup> providePhoneLookupList(
+ CequintPhoneLookup cequintPhoneLookup,
CnapPhoneLookup cnapPhoneLookup,
Cp2DefaultDirectoryPhoneLookup cp2DefaultDirectoryPhoneLookup,
Cp2ExtendedDirectoryPhoneLookup cp2ExtendedDirectoryPhoneLookup,
SystemBlockedNumberPhoneLookup systemBlockedNumberPhoneLookup,
SpamPhoneLookup spamPhoneLookup) {
return ImmutableList.of(
+ cequintPhoneLookup,
cnapPhoneLookup,
cp2DefaultDirectoryPhoneLookup,
cp2ExtendedDirectoryPhoneLookup,
diff --git a/java/com/android/dialer/phonelookup/cequint/CequintPhoneLookup.java b/java/com/android/dialer/phonelookup/cequint/CequintPhoneLookup.java
new file mode 100644
index 000000000..ce2cd18ad
--- /dev/null
+++ b/java/com/android/dialer/phonelookup/cequint/CequintPhoneLookup.java
@@ -0,0 +1,90 @@
+/*
+ * Copyright (C) 2018 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License
+ */
+
+package com.android.dialer.phonelookup.cequint;
+
+import android.content.Context;
+import android.telecom.Call;
+import com.android.dialer.DialerPhoneNumber;
+import com.android.dialer.phonelookup.PhoneLookup;
+import com.android.dialer.phonelookup.PhoneLookupInfo;
+import com.android.dialer.phonelookup.PhoneLookupInfo.CequintInfo;
+import com.google.common.collect.ImmutableMap;
+import com.google.common.collect.ImmutableSet;
+import com.google.common.util.concurrent.Futures;
+import com.google.common.util.concurrent.ListenableFuture;
+import javax.inject.Inject;
+
+/** PhoneLookup implementation for Cequint. */
+public class CequintPhoneLookup implements PhoneLookup<CequintInfo> {
+
+ @Inject
+ CequintPhoneLookup() {}
+
+ @Override
+ public ListenableFuture<CequintInfo> lookup(Context appContext, Call call) {
+ // TODO(a bug): Override the default implementation in the PhoneLookup interface
+ // as a Cequint lookup requires info in the provided call.
+ return Futures.immediateFuture(CequintInfo.getDefaultInstance());
+ }
+
+ @Override
+ public ListenableFuture<CequintInfo> lookup(DialerPhoneNumber dialerPhoneNumber) {
+ // TODO(a bug): Implement this method.
+ return Futures.immediateFuture(CequintInfo.getDefaultInstance());
+ }
+
+ @Override
+ public ListenableFuture<Boolean> isDirty(ImmutableSet<DialerPhoneNumber> phoneNumbers) {
+ return Futures.immediateFuture(false);
+ }
+
+ @Override
+ public ListenableFuture<ImmutableMap<DialerPhoneNumber, CequintInfo>> getMostRecentInfo(
+ ImmutableMap<DialerPhoneNumber, CequintInfo> existingInfoMap) {
+ return Futures.immediateFuture(existingInfoMap);
+ }
+
+ @Override
+ public void setSubMessage(PhoneLookupInfo.Builder destination, CequintInfo subMessage) {
+ destination.setCequintInfo(subMessage);
+ }
+
+ @Override
+ public CequintInfo getSubMessage(PhoneLookupInfo phoneLookupInfo) {
+ return phoneLookupInfo.getCequintInfo();
+ }
+
+ @Override
+ public ListenableFuture<Void> onSuccessfulBulkUpdate() {
+ return Futures.immediateFuture(null);
+ }
+
+ @Override
+ public void registerContentObservers() {
+ // No content observers for Cequint info.
+ }
+
+ @Override
+ public void unregisterContentObservers() {
+ // No content observers for Cequint info.
+ }
+
+ @Override
+ public ListenableFuture<Void> clearData() {
+ return Futures.immediateFuture(null);
+ }
+}
diff --git a/java/com/android/dialer/phonelookup/phone_lookup_info.proto b/java/com/android/dialer/phonelookup/phone_lookup_info.proto
index 1beff6ca9..50817c4e3 100644
--- a/java/com/android/dialer/phonelookup/phone_lookup_info.proto
+++ b/java/com/android/dialer/phonelookup/phone_lookup_info.proto
@@ -14,7 +14,7 @@ package com.android.dialer.phonelookup;
// "cp2_info_in_default_directory" corresponds to class
// Cp2DefaultDirectoryPhoneLookup, and class Cp2DefaultDirectoryPhoneLookup
// alone is responsible for populating it.
-// Next ID: 8
+// Next ID: 9
message PhoneLookupInfo {
// Information about a PhoneNumber retrieved from CP2.
message Cp2Info {
@@ -163,4 +163,16 @@ message PhoneLookupInfo {
optional string name = 1;
}
optional CnapInfo cnap_info = 7;
+
+ // Information obtained via Cequint
+ // Next ID: 4
+ message CequintInfo {
+ optional string name = 1;
+
+ // Description of the geolocation (e.g., "Mountain View, CA")
+ optional string geolocation = 2;
+
+ optional string photo_uri = 3;
+ }
+ optional CequintInfo cequint_info = 8;
} \ No newline at end of file