From 05d17bda619dfdb7a729959dad098c10d67f84c8 Mon Sep 17 00:00:00 2001 From: linyuh Date: Tue, 24 Apr 2018 13:09:55 -0700 Subject: Add skeleton for CequintPhoneLookup Bug: 70989584 Test: CequintPhoneLookupTest PiperOrigin-RevId: 194133375 Change-Id: I10fb22c0c92b2d79f4d8287316e7a0373c09a72e --- .../dialer/phonelookup/PhoneLookupModule.java | 3 + .../phonelookup/cequint/CequintPhoneLookup.java | 90 ++++++++++++++++++++++ .../dialer/phonelookup/phone_lookup_info.proto | 14 +++- 3 files changed, 106 insertions(+), 1 deletion(-) create mode 100644 java/com/android/dialer/phonelookup/cequint/CequintPhoneLookup.java (limited to 'java/com/android/dialer/phonelookup') 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 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 { + + @Inject + CequintPhoneLookup() {} + + @Override + public ListenableFuture 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 lookup(DialerPhoneNumber dialerPhoneNumber) { + // TODO(a bug): Implement this method. + return Futures.immediateFuture(CequintInfo.getDefaultInstance()); + } + + @Override + public ListenableFuture isDirty(ImmutableSet phoneNumbers) { + return Futures.immediateFuture(false); + } + + @Override + public ListenableFuture> getMostRecentInfo( + ImmutableMap 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 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 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 -- cgit v1.2.3