1syntax = "proto2";
2
3option java_package = "com.android.dialer.phonelookup";
4option java_multiple_files = true;
5option optimize_for = LITE_RUNTIME;
6
7
8package com.android.dialer.phonelookup;
9
10// Contains information about a phone number, possibly from many sources.
11//
12// This message is organized into sub-message fields where each one corresponds
13// to an implementation of PhoneLookup. For example, field
14// "cp2_info_in_default_directory" corresponds to class
15// Cp2DefaultDirectoryPhoneLookup, and class Cp2DefaultDirectoryPhoneLookup
16// alone is responsible for populating it.
17// Next ID: 11
18message PhoneLookupInfo {
19  // Information about a PhoneNumber retrieved from CP2.
20  message Cp2Info {
21    // Information about a single contact.
22    // Next ID: 9
23    message Cp2ContactInfo {
24      // For a contact in the default directory:
25      //   android.provider.ContactsContract.CommonDataKinds.Phone.DISPLAY_NAME_PRIMARY
26      // For a contact in other directories:
27      //   android.provider.ContactsContract.PhoneLookup.DISPLAY_NAME_PRIMARY
28      optional string name = 1;
29
30      // For a contact in the default directory:
31      //   android.provider.ContactsContract.CommonDataKinds.Phone.PHOTO_THUMBNAIL_URI
32      // For a contact in other directories:
33      //   android.provider.ContactsContract.PhoneLookup.PHOTO_THUMBNAIL_URI
34      optional string photo_thumbnail_uri = 2;
35
36      // For a contact in the default directory:
37      //   android.provider.ContactsContract.CommonDataKinds.Phone.PHOTO_URI
38      // For a contact in other directories:
39      //   android.provider.ContactsContract.PhoneLookup.PHOTO_URI
40      optional string photo_uri = 3;
41
42      // For a contact in the default directory:
43      //   android.provider.ContactsContract.CommonDataKinds.Phone.PHOTO_ID
44      // For a contact in other directories:
45      //   android.provider.ContactsContract.PhoneLookup.PHOTO_ID
46      optional fixed64 photo_id = 4;
47
48      // For a contact in the default directory:
49      //   android.provider.ContactsContract.CommonDataKinds.Phone.LABEL
50      // For a contact in other directories:
51      //   android.provider.ContactsContract.PhoneLookup.LABEL
52      //
53      // The value can be "Home", "Mobile", ect.
54      optional string label = 5;
55
56      // For a contact in the default directory:
57      //   android.provider.ContactsContract.CommonDataKinds.Phone.CONTACT_ID
58      // For a contact in other directories:
59      //   android.provider.ContactsContract.PhoneLookup.CONTACT_ID
60      optional fixed64 contact_id = 6;
61
62      // For a contact in the default directory:
63      //   constructed based on
64      //   android.provider.ContactsContract.CommonDataKinds.Phone.LOOKUP_KEY
65      // For a contact in other directories:
66      //   constructed based on
67      //   android.provider.ContactsContract.PhoneLookup.LOOKUP_KEY
68      optional string lookup_uri = 7;
69
70      // For a contact in the default directory:
71      //    value set based on
72      //    android.provider.ContactsContract.CommonDataKinds.Phone.CARRIER_PRESENCE
73      // For a contact in other directories: always false.
74      //    This is because we lookup contacts in other directories via
75      //    android.provider.ContactsContract.PhoneLookup, to which carrier
76      //    presence info is not directly accessible.
77      optional bool can_support_carrier_video_call = 8;
78    }
79    // Repeated because one phone number can be associated with multiple CP2
80    // contacts.
81    //
82    // Empty if there is no CP2 contact information for the number.
83    repeated Cp2ContactInfo cp2_contact_info = 1;
84
85    // The information for this number is incomplete. This can happen when the
86    // call log is requested to be updated but there are many invalid numbers
87    // and the update cannot be performed efficiently. In this case, the call
88    // log needs to query for the CP2 information at render time.
89    optional bool is_incomplete = 2;
90  }
91
92  // Information about a contact in the default directory, retrieved via CP2.
93  // Cp2DefaultDirectoryPhoneLookup is responsible for populating this field.
94  optional Cp2Info default_cp2_info = 1;
95
96  // Information about a contact in other directories, retrieved via CP2.
97  // Cp2ExtendedDirectoryPhoneLookup is responsible for populating this field.
98  optional Cp2Info extended_cp2_info = 6;
99
100  // Message for spam info.
101  // SpamPhoneLookup is responsible for populating this message.
102  message SpamInfo {
103    optional bool is_spam = 1;
104  }
105  optional SpamInfo spam_info = 2;
106
107  // Message for PeopleApi, including G+ contacts and nearby places
108  message PeopleApiInfo {
109    // Best display name determined by people API if available, first display
110    // name otherwise.
111    optional string display_name = 1;
112
113    // The type of the number, for example "phone" or "home".
114    optional string number_type = 2;
115
116    // The number_type label in human readable string, for example "Phone".
117    // The UI should display known number_type with string resources if possible
118    // but if number_type is unrecognized formatted_number_type. For example
119    // if the user set an custom type label.
120    optional string formatted_number_type = 3;
121
122    // URL to the contact's full size photo.
123    optional string image_url = 4;
124
125    // The primary key of the contact in people API.
126    optional string person_id = 5;
127
128    enum InfoType {
129      UNKNOWN = 0;
130      CONTACT = 1;          // the result is a saved contact in people API
131      NEARBY_BUSINESS = 2;  // the result is found through nearby places
132    }
133    // The type of the lookup result, for example, a saved contact or a nearby
134    // business.
135    optional InfoType info_type = 6;
136
137    // A URI that contains encoded JSON about the number so contacts can
138    // populate the quick contact activity with name and numbers. This does not
139    // point to any real contact entry anywhere.
140    optional string lookup_uri = 7;
141  }
142  optional PeopleApiInfo people_api_info = 3;
143
144  // Whether a number is blocked or not. Used by both the system blacklist and
145  // dialer fallback
146  enum BlockedState {
147    UNKNOWN = 0;
148    BLOCKED = 1;
149    NOT_BLOCKED = 2;
150  }
151
152  // Message for the android system BlockedNumber lookup. Available starting in
153  // N.
154  message SystemBlockedNumberInfo {
155    optional BlockedState blocked_state = 1;
156  }
157  optional SystemBlockedNumberInfo system_blocked_number_info = 4;
158
159  // Information obtained via CNAP
160  // (https://en.wikipedia.org/wiki/Calling_Name_Presentation)
161  // Next ID: 2
162  message CnapInfo {
163    optional string name = 1;
164  }
165  optional CnapInfo cnap_info = 7;
166
167  // Information obtained via Cequint
168  // Next ID: 4
169  message CequintInfo {
170    optional string name = 1;
171
172    // Description of the geolocation (e.g., "Mountain View, CA")
173    optional string geolocation = 2;
174
175    optional string photo_uri = 3;
176  }
177  optional CequintInfo cequint_info = 8;
178
179  // Message indicating whether a number is an emergency number.
180  // Next ID: 2
181  message EmergencyInfo {
182    optional bool is_emergency_number = 1;
183  }
184  optional EmergencyInfo emergency_info = 9;
185
186  // Information cached in the old calllog
187  message MigratedInfo {
188    // The display name
189    optional string name = 1;
190    // Display label, i.e. "Home", "Mobile"
191    optional string label = 2;
192
193    optional string photo_uri = 3;
194
195    optional bool is_business = 4;
196    // ContactSource.Type
197    optional int32 source_type = 5;
198  }
199  optional MigratedInfo migrated_info = 10;
200}