1 /*
2  * Copyright (C) 2016 The Android Open Source Project
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License
15  */
16 
17 package com.android.dialer.database;
18 
19 import android.net.Uri;
20 import android.provider.BaseColumns;
21 import android.provider.CallLog;
22 import android.provider.OpenableColumns;
23 
24 import com.android.dialerbind.ObjectFactory;
25 
26 /**
27  * Contains definitions for the supported URIs and columns for the voicemail archive table.
28  * All the fields excluding MIME_TYPE, _DATA, ARCHIVED, SERVER_ID, mirror the fields in the
29  * contract provided in {@link CallLog.Calls}.
30  */
31 public final class VoicemailArchiveContract {
32 
33     /** The authority used by the voicemail archive provider. */
34     public static final String AUTHORITY = ObjectFactory.getVoicemailArchiveProviderAuthority();
35 
36     /** A content:// style uri for the voicemail archive provider */
37     public static final Uri AUTHORITY_URI = Uri.parse("content://" + AUTHORITY);
38 
39     public static final class VoicemailArchive implements BaseColumns, OpenableColumns {
40 
41         public static final String VOICEMAIL_ARCHIVE_TABLE = "voicemail_archive_table";
42 
43         public static final Uri CONTENT_URI = Uri.withAppendedPath(
44                 AUTHORITY_URI,
45                 VOICEMAIL_ARCHIVE_TABLE);
46 
47         /**
48          * @see android.provider.CallLog.Calls#NUMBER
49          * TYPE: TEXT
50          */
51         public static final String NUMBER = CallLog.Calls.NUMBER;
52 
53         /**
54          * @see android.provider.CallLog.Calls#DATE
55          * TYPE: LONG
56          */
57         public static final String DATE = CallLog.Calls.DATE;
58 
59         /**
60          * @see android.provider.CallLog.Calls#DURATION
61          * TYPE: LONG
62          */
63         public static final String DURATION =  CallLog.Calls.DURATION;
64 
65         /**
66          * The mime type of the archived voicemail file.
67          * TYPE: TEXT
68          */
69         public static final String MIME_TYPE = "mime_type";
70 
71         /**
72          * @see android.provider.CallLog.Calls#COUNTRY_ISO
73          * TYPE: LONG
74          */
75         public static final String COUNTRY_ISO = CallLog.Calls.COUNTRY_ISO;
76 
77         /**
78          * The path of the archived voicemail file.
79          * TYPE: TEXT
80          */
81         public static final String _DATA = "_data";
82 
83         /**
84          * @see android.provider.CallLog.Calls#GEOCODED_LOCATION
85          * TYPE: TEXT
86          */
87         public static final String GEOCODED_LOCATION = CallLog.Calls.GEOCODED_LOCATION;
88 
89         /**
90          * @see android.provider.CallLog.Calls#CACHED_NAME
91          * TYPE: TEXT
92          */
93         public static final String CACHED_NAME = CallLog.Calls.CACHED_NAME;
94 
95         /**
96          * @see android.provider.CallLog.Calls#CACHED_NUMBER_TYPE
97          * TYPE: INTEGER
98          */
99         public static final String CACHED_NUMBER_TYPE = CallLog.Calls.CACHED_NUMBER_TYPE;
100 
101         /**
102          * @see android.provider.CallLog.Calls#CACHED_NUMBER_LABEL
103          * TYPE: TEXT
104          */
105         public static final String CACHED_NUMBER_LABEL = CallLog.Calls.CACHED_NUMBER_LABEL;
106 
107         /**
108          * @see android.provider.CallLog.Calls#CACHED_LOOKUP_URI
109          * TYPE: TEXT
110          */
111         public static final String CACHED_LOOKUP_URI = CallLog.Calls.CACHED_LOOKUP_URI;
112 
113         /**
114          * @see android.provider.CallLog.Calls#CACHED_MATCHED_NUMBER
115          * TYPE: TEXT
116          */
117         public static final String CACHED_MATCHED_NUMBER = CallLog.Calls.CACHED_MATCHED_NUMBER;
118 
119         /**
120          * @see android.provider.CallLog.Calls#CACHED_NORMALIZED_NUMBER
121          * TYPE: TEXT
122          */
123         public static final String CACHED_NORMALIZED_NUMBER =
124                 CallLog.Calls.CACHED_NORMALIZED_NUMBER;
125 
126         /**
127          * @see android.provider.CallLog.Calls#CACHED_PHOTO_ID
128          * TYPE: LONG
129          */
130         public static final String CACHED_PHOTO_ID = CallLog.Calls.CACHED_PHOTO_ID;
131 
132         /**
133          * @see android.provider.CallLog.Calls#CACHED_FORMATTED_NUMBER
134          * TYPE: TEXT
135          */
136         public static final String CACHED_FORMATTED_NUMBER = CallLog.Calls.CACHED_FORMATTED_NUMBER;
137 
138         /**
139          * If the voicemail was archived by the user by pressing the archive button, this is set to
140          * 1 (true). If the voicemail was archived for the purpose of forwarding to other
141          * applications, this is set to 0 (false).
142          * TYPE: INTEGER
143          */
144         public static final String ARCHIVED = "archived_by_user";
145 
146         /**
147          * @see android.provider.CallLog.Calls#NUMBER_PRESENTATION
148          * TYPE: INTEGER
149          */
150         public static final String NUMBER_PRESENTATION = CallLog.Calls.NUMBER_PRESENTATION;
151 
152         /**
153          * @see android.provider.CallLog.Calls#PHONE_ACCOUNT_COMPONENT_NAME
154          * TYPE: TEXT
155          */
156         public static final String ACCOUNT_COMPONENT_NAME =
157                 CallLog.Calls.PHONE_ACCOUNT_COMPONENT_NAME;
158 
159         /**
160          * @see android.provider.CallLog.Calls#PHONE_ACCOUNT_ID
161          * TYPE: TEXT
162          */
163         public static final String ACCOUNT_ID = CallLog.Calls.PHONE_ACCOUNT_ID;
164 
165         /**
166          * @see android.provider.CallLog.Calls#FEATURES
167          * TYPE: INTEGER
168          */
169         public static final String FEATURES = CallLog.Calls.FEATURES;
170 
171         /**
172          * The id of the voicemail on the server.
173          * TYPE: INTEGER
174          */
175         public static final String SERVER_ID = "server_id";
176 
177         /**
178          * @see android.provider.CallLog.Calls#TRANSCRIPTION
179          * TYPE: TEXT
180          */
181         public static final String TRANSCRIPTION = CallLog.Calls.TRANSCRIPTION;
182 
183         /**
184          * @see android.provider.CallLog.Calls#CACHED_PHOTO_URI
185          * TYPE: TEXT
186          */
187         public static final String CACHED_PHOTO_URI = CallLog.Calls.CACHED_PHOTO_URI;
188 
189         /**
190          * The MIME type of a {@link #CONTENT_URI} single voicemail.
191          */
192         public static final String CONTENT_ITEM_TYPE =
193                 "vnd.android.cursor.item/voicmail_archive_table";
194 
buildWithId(int id)195         public static final Uri buildWithId(int id) {
196             return Uri.withAppendedPath(CONTENT_URI, Integer.toString(id));
197         }
198 
199         /** Not instantiable. */
VoicemailArchive()200         private VoicemailArchive() {
201         }
202     }
203 }
204