summaryrefslogtreecommitdiff
path: root/java/com/android/dialer/calllog/database/contract/AnnotatedCallLogContract.java
blob: 5aa62c2d10f9f5ae3e5aaf007f3d9903b1399406 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
/*
 * 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.calllog.database.contract;

import android.net.Uri;
import android.os.Build;
import android.provider.BaseColumns;
import com.android.dialer.compat.android.provider.VoicemailCompat;
import com.android.dialer.constants.Constants;

/** Contract for the AnnotatedCallLog content provider. */
public class AnnotatedCallLogContract {
  public static final String AUTHORITY = Constants.get().getAnnotatedCallLogProviderAuthority();

  public static final Uri CONTENT_URI = Uri.parse("content://" + AUTHORITY);

  /** Columns shared by {@link AnnotatedCallLog} and {@link CoalescedAnnotatedCallLog}. */
  interface CommonColumns extends BaseColumns {

    /**
     * Timestamp of the entry, in milliseconds.
     *
     * <p>Type: INTEGER (long)
     */
    String TIMESTAMP = "timestamp";

    /**
     * The phone number called or number the call came from, encoded as a {@link
     * com.android.dialer.DialerPhoneNumber} proto. The number may be empty if it was an incoming
     * call and the number was unknown.
     *
     * <p>Type: BLOB
     */
    String NUMBER = "number";

    /**
     * The number formatted as it should be displayed to the user. Note that it may not always be
     * displayed, for example if the number has a corresponding person or business name.
     *
     * <p>Type: TEXT
     */
    String FORMATTED_NUMBER = "formatted_number";

    /**
     * See {@link android.provider.CallLog.Calls#NUMBER_PRESENTATION}.
     *
     * <p>Type: INTEGER (int)
     */
    String NUMBER_PRESENTATION = "presentation";

    /**
     * See {@link android.provider.CallLog.Calls#IS_READ}.
     *
     * <p>TYPE: INTEGER (boolean)
     */
    String IS_READ = "is_read";

    /**
     * See {@link android.provider.CallLog.Calls#NEW}.
     *
     * <p>Type: INTEGER (boolean)
     */
    String NEW = "new";

    /**
     * See {@link android.provider.CallLog.Calls#GEOCODED_LOCATION}.
     *
     * <p>TYPE: TEXT
     */
    String GEOCODED_LOCATION = "geocoded_location";

    /**
     * See {@link android.provider.CallLog.Calls#PHONE_ACCOUNT_COMPONENT_NAME}.
     *
     * <p>TYPE: TEXT
     */
    String PHONE_ACCOUNT_COMPONENT_NAME = "phone_account_component_name";

    /**
     * See {@link android.provider.CallLog.Calls#PHONE_ACCOUNT_ID}.
     *
     * <p>TYPE: TEXT
     */
    String PHONE_ACCOUNT_ID = "phone_account_id";

    /**
     * See {@link android.provider.CallLog.Calls#FEATURES}.
     *
     * <p>TYPE: INTEGER (int)
     */
    String FEATURES = "features";

    /**
     * Additional attributes about the number.
     *
     * <p>TYPE: BLOB
     *
     * @see com.android.dialer.NumberAttributes
     */
    String NUMBER_ATTRIBUTES = "number_attributes";

    /**
     * Whether the call is to the voicemail inbox.
     *
     * <p>TYPE: INTEGER (boolean)
     *
     * @see android.telecom.TelecomManager#isVoiceMailNumber(android.telecom.PhoneAccountHandle,
     *     String)
     */
    String IS_VOICEMAIL_CALL = "is_voicemail_call";

    /**
     * The "name" of the voicemail inbox. This is provided by the SIM to show as the caller ID
     *
     * <p>TYPE: TEXT
     *
     * @see android.telephony.TelephonyManager#getVoiceMailAlphaTag()
     */
    String VOICEMAIL_CALL_TAG = "voicemail_call_tag";

    /**
     * Copied from {@link android.provider.CallLog.Calls#TYPE}.
     *
     * <p>Type: INTEGER (int)
     */
    String CALL_TYPE = "call_type";
  }

  /**
   * AnnotatedCallLog table.
   *
   * <p>This contains all of the non-coalesced call log entries.
   */
  public static final class AnnotatedCallLog implements CommonColumns {

    public static final String TABLE = "AnnotatedCallLog";
    public static final String DISTINCT_PHONE_NUMBERS = "DistinctPhoneNumbers";

    /** The content URI for this table. */
    public static final Uri CONTENT_URI =
        Uri.withAppendedPath(AnnotatedCallLogContract.CONTENT_URI, TABLE);

    /** Content URI for selecting the distinct phone numbers from the AnnotatedCallLog. */
    public static final Uri DISTINCT_NUMBERS_CONTENT_URI =
        Uri.withAppendedPath(AnnotatedCallLogContract.CONTENT_URI, DISTINCT_PHONE_NUMBERS);

    /** The MIME type of a {@link android.content.ContentProvider#getType(Uri)} single entry. */
    public static final String CONTENT_ITEM_TYPE = "vnd.android.cursor.item/annotated_call_log";

    /**
     * See {@link android.provider.CallLog.Calls#DATA_USAGE}.
     *
     * <p>Type: INTEGER (long)
     */
    public static final String DATA_USAGE = "data_usage";

    /**
     * See {@link android.provider.CallLog.Calls#DURATION}.
     *
     * <p>TYPE: INTEGER (long)
     */
    public static final String DURATION = "duration";

    /**
     * See {@link android.provider.CallLog.Calls#TRANSCRIPTION}.
     *
     * <p>TYPE: TEXT
     */
    public static final String TRANSCRIPTION = "transcription";

    /**
     * See {@link VoicemailCompat#TRANSCRIPTION_STATE}
     *
     * <p>Only populated in {@link Build.VERSION_CODES#O} and above
     *
     * <p>TYPE: INTEGER
     */
    public static final String TRANSCRIPTION_STATE = "transcription_state";

    /**
     * See {@link android.provider.CallLog.Calls#VOICEMAIL_URI}.
     *
     * <p>TYPE: TEXT
     */
    public static final String VOICEMAIL_URI = "voicemail_uri";

    /**
     * An unique id to associate this call log row to a {@link android.telecom.Call}.
     *
     * <p>For pre-Q device, this is same as {@link #TIMESTAMP}.
     *
     * <p>For Q+ device, this will be copied from {@link android.provider.CallLog.Calls}.
     *
     * <p>Type: TEXT
     */
    public static final String CALL_MAPPING_ID = "call_mapping_id";
  }

  /**
   * Coalesced view of the AnnotatedCallLog table.
   *
   * <p>This is an in-memory view of the {@link AnnotatedCallLog} with some adjacent entries
   * collapsed.
   */
  public static final class CoalescedAnnotatedCallLog implements CommonColumns {

    /**
     * IDs of rows in {@link AnnotatedCallLog} that are coalesced into one row in {@link
     * CoalescedAnnotatedCallLog}, encoded as a {@link com.android.dialer.CoalescedIds} proto.
     *
     * <p>Type: BLOB
     */
    public static final String COALESCED_IDS = "coalesced_ids";
  }
}