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