diff options
author | Treehugger Robot <treehugger-gerrit@google.com> | 2017-12-15 02:54:42 +0000 |
---|---|---|
committer | Gerrit Code Review <noreply-gerritcodereview@google.com> | 2017-12-15 02:54:42 +0000 |
commit | 8ad60ff93dd1318f633b305c09c822ba56f7caa5 (patch) | |
tree | 214f38d755e7f7fde9a85997af3e886d718c87f2 /java | |
parent | 77217824a09b4c93d0103c57acfa13368a7b8807 (diff) | |
parent | 937bd02d7cb045cea9aa21a76f3425a68468eeeb (diff) |
Merge "Implement PeopleApiPhoneLookup"
Diffstat (limited to 'java')
3 files changed, 59 insertions, 0 deletions
diff --git a/java/com/android/dialer/function/Consumer.java b/java/com/android/dialer/function/Consumer.java new file mode 100644 index 000000000..fafe3eede --- /dev/null +++ b/java/com/android/dialer/function/Consumer.java @@ -0,0 +1,24 @@ +/* + * Copyright (C) 2017 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.function; + +/** Functional interface for consuming generic values. */ +public interface Consumer<T> { + + /** Consumes a value. */ + void accept(T value); +} diff --git a/java/com/android/dialer/phonelookup/PhoneLookupSelector.java b/java/com/android/dialer/phonelookup/PhoneLookupSelector.java index af8b849e5..0fe989332 100644 --- a/java/com/android/dialer/phonelookup/PhoneLookupSelector.java +++ b/java/com/android/dialer/phonelookup/PhoneLookupSelector.java @@ -46,6 +46,9 @@ public final class PhoneLookupSelector { return firstLocalContact.getName(); } } + if (phoneLookupInfo.hasPeopleApiInfo()) { + return phoneLookupInfo.getPeopleApiInfo().getDisplayName(); + } return ""; } diff --git a/java/com/android/dialer/phonelookup/phone_lookup_info.proto b/java/com/android/dialer/phonelookup/phone_lookup_info.proto index 36596c1a2..4e62d67c1 100644 --- a/java/com/android/dialer/phonelookup/phone_lookup_info.proto +++ b/java/com/android/dialer/phonelookup/phone_lookup_info.proto @@ -50,4 +50,36 @@ message PhoneLookupInfo { optional bool is_spam = 1; } optional ApdlInfo apdl_info = 2; + + // Message for PeopleApi, including G+ contacts and nearby places + message PeopleApiInfo { + // Best display name determined by people API if available, first display + // name otherwise. + optional string display_name = 1; + + // The type of the number, for example "phone" or "home". + optional string number_type = 2; + + // The number_type label in human readable string, for example "Phone". + // The UI should display known number_type with string resources if possible + // but if number_type is unrecognized formatted_number_type. For example + // if the user set an custom type label. + optional string formatted_number_type = 3; + + // URL to the contact's full size photo. + optional string image_url = 4; + + // The primary key of the contact in people API. + optional string person_id = 5; + + enum InfoType { + UNKNOWN = 0; + CONTACT = 1; // the result is a saved contact in people API + NEARBY_BUSINESS = 2; // the result is found through nearby places + } + // The type of the lookup result, for example, a saved contact or a nearby + // business. + optional InfoType info_type = 6; + } + optional PeopleApiInfo people_api_info = 3; }
\ No newline at end of file |