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;
19
20
21package com.android.dialer;
22
23// A phone number for use in the dialer application in the context of a call. It
24// consists of a normalized number string and a two-letter country code.
25// The country is retrieved from CallLog.Calls#COUNTRY: "The ISO 3166-1 two
26// letters country code of the country where the user received or made the
27// call."
28message DialerPhoneNumber {
29  // A dialer-normalized version of the number. Here are some general rules:
30  //
31  // -Numbers containing "#" or starting with "*" are considered service numbers
32  // and are stored exactly as the user dialed them.
33  //
34  // -If a number is valid according to libphonenumber and can be parsed, this
35  //  is the E164 version of it, with post dial digits appended.
36  //
37  // -Otherwise, it is the network portion of the number as dialed with
38  //  non-digits removed, with post dial digits appended. An example invalid
39  //  number is a 7-digit US number (missing an area code) like "456-7890" which
40  //  would be stored as "4567890".
41  //
42  //  Note: Using this field without country_iso effectively loses country info
43  //  when the number is not valid and no country prefix was prepended. This may
44  //  cause numbers like {"456-7890", "US"} to be treated equivalently to
45  //  {"456-7890", "DE"}, when they are not in fact equivalent.
46  //
47  //  See DialerPhoneNumberUtil#parse.
48  optional string normalized_number = 1;
49
50  // The country in which the call to the number occurred, retrieved from
51  // CallLog.Calls#COUNTRY: "The ISO 3166-1 two letters country code of the
52  // country where the user received or made the call."
53  optional string country_iso = 2;
54
55  // True if the number is valid according to libphonenumber.
56  optional bool is_valid = 3;
57
58  // The post dial portion of the number as described by
59  // PhoneNumberUtils#extractPostDialPortion. Note that this is also part of
60  // normalized_number, but this information is duplicated here for convenience.
61  //
62  // This includes pause and wait characters, but strips other characters, so
63  // for example would be ",123;456" given the raw input of "456-7890,123; 456".
64  optional string post_dial_portion = 4;
65}
66