1// Copyright (C) 2017 The Android Open Source Project
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7//      http://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License
14
15syntax = "proto2";
16
17option java_package = "com.android.dialer";
18option java_multiple_files = true;
19option optimize_for = LITE_RUNTIME;
20
21
22package com.android.dialer;
23
24// A phone number for use in the dialer application in the context of a call. It
25// consists of a normalized number string and a two-letter country code.
26// The country is retrieved from CallLog.Calls#COUNTRY: "The ISO 3166-1 two
27// letters country code of the country where the user received or made the
28// call."
29message DialerPhoneNumber {
30  // A dialer-normalized version of the number. Here are some general rules:
31  //
32  // -Numbers containing "#" or starting with "*" are considered service numbers
33  // and are stored exactly as the user dialed them.
34  //
35  // -If a number is valid according to libphonenumber and can be parsed, this
36  //  is the E164 version of it, with post dial digits appended.
37  //
38  // -Otherwise, it is the network portion of the number as dialed with
39  //  non-digits removed, with post dial digits appended. An example invalid
40  //  number is a 7-digit US number (missing an area code) like "456-7890" which
41  //  would be stored as "4567890".
42  //
43  //  Note: Using this field without country_iso effectively loses country info
44  //  when the number is not valid and no country prefix was prepended. This may
45  //  cause numbers like {"456-7890", "US"} to be treated equivalently to
46  //  {"456-7890", "DE"}, when they are not in fact equivalent.
47  //
48  //  See DialerPhoneNumberUtil#parse.
49  optional string normalized_number = 1;
50
51  // The country in which the call to the number occurred, retrieved from
52  // CallLog.Calls#COUNTRY: "The ISO 3166-1 two letters country code of the
53  // country where the user received or made the call."
54  optional string country_iso = 2;
55
56  // True if the number is valid according to libphonenumber.
57  optional bool is_valid = 3;
58
59  // The post dial portion of the number as described by
60  // PhoneNumberUtils#extractPostDialPortion. Note that this is also part of
61  // normalized_number, but this information is duplicated here for convenience.
62  //
63  // This includes pause and wait characters, but strips other characters, so
64  // for example would be ",123;456" given the raw input of "456-7890,123; 456".
65  optional string post_dial_portion = 4;
66}
67