VoicemailContract.java revision 949a136dc65db24cba3d321ceac88c6b55825bcc
1/* 2 * Copyright (C) 2011 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 */ 16package android.provider; 17 18import android.content.Intent; 19import android.database.ContentObserver; 20import android.net.Uri; 21import android.provider.CallLog.Calls; 22 23/** 24 * The contract between the voicemail provider and applications. Contains 25 * definitions for the supported URIs and columns. 26 * 27 * <P>Voicemails are inserted by what is called as a "voicemail source" 28 * application, which is responsible for syncing voicemail data between a remote 29 * server and the local voicemail content provider. "voicemail source" 30 * application should use the source specific {@link #CONTENT_URI_SOURCE} URI 31 * to insert and retrieve voicemails. 32 * 33 * <P>In addition to the {@link ContentObserver} notifications the voicemail 34 * provider also generates broadcast intents to notify change for applications 35 * that are not active and therefore cannot listen to ContentObserver 36 * notifications. Broadcast intents with following actions are generated: 37 * <ul> 38 * <li> {@link #ACTION_NEW_VOICEMAIL} is generated for each new voicemail 39 * inserted. 40 * </li> 41 * <li> {@link Intent#ACTION_PROVIDER_CHANGED} is generated for any change 42 * made into the database, including new voicemail. 43 * </li> 44 * </ul> 45 * @hide 46 */ 47// TODO: unhide when the API is approved by android-api-council 48public class VoicemailContract { 49 /** Not instantiable. */ 50 private VoicemailContract() { 51 } 52 53 /** The authority used by the voicemail provider. */ 54 public static final String AUTHORITY = "com.android.voicemail"; 55 56 /** URI to insert/retrieve all voicemails. */ 57 public static final Uri CONTENT_URI = 58 Uri.parse("content://" + AUTHORITY + "/voicemail"); 59 /** URI to insert/retrieve voicemails by a given voicemail source. */ 60 public static final Uri CONTENT_URI_SOURCE = 61 Uri.parse("content://" + AUTHORITY + "/voicemail/source/"); 62 63 // TODO: Move ACTION_NEW_VOICEMAIL to the Intent class. 64 /** Broadcast intent when a new voicemail record is inserted. */ 65 public static final String ACTION_NEW_VOICEMAIL = "android.intent.action.NEW_VOICEMAIL"; 66 67 /** 68 * Extra included in {@value Intent#ACTION_PROVIDER_CHANGED} and 69 * {@value #ACTION_NEW_VOICEMAIL} broadcast intents to indicate if the receiving 70 * package made this change. 71 */ 72 public static final String EXTRA_SELF_CHANGE = "com.android.voicemail.extra.SELF_CHANGE"; 73 74 /** The mime type for a collection of voicemails. */ 75 public static final String DIR_TYPE = 76 "vnd.android.cursor.dir/voicemails"; 77 78 public static final class Voicemails implements BaseColumns { 79 /** Not instantiable. */ 80 private Voicemails() { 81 } 82 83 /** 84 * Phone number of the voicemail sender. 85 * <P>Type: TEXT</P> 86 */ 87 public static final String NUMBER = Calls.NUMBER; 88 /** 89 * The date the voicemail was sent, in milliseconds since the epoch 90 * <P>Type: INTEGER (long)</P> 91 */ 92 public static final String DATE = Calls.DATE; 93 /** 94 * The duration of the voicemail in seconds. 95 * <P>Type: INTEGER (long)</P> 96 */ 97 public static final String DURATION = Calls.DURATION; 98 /** 99 * Whether this is a new voicemail (i.e. has not been heard). 100 * <P>Type: INTEGER (boolean)</P> 101 */ 102 public static final String NEW = Calls.NEW; 103 /** 104 * The mail box state of the voicemail. 105 * <P> Possible values: {@link #STATE_INBOX}, {@link #STATE_DELETED}, 106 * {@link #STATE_UNDELETED}. 107 * <P>Type: INTEGER</P> 108 */ 109 public static final String STATE = "state"; 110 /** Value of {@link #STATE} when the voicemail is in inbox. */ 111 public static int STATE_INBOX = 0; 112 /** Value of {@link #STATE} when the voicemail has been marked as deleted. */ 113 public static int STATE_DELETED = 1; 114 /** Value of {@link #STATE} when the voicemail has marked as undeleted. */ 115 public static int STATE_UNDELETED = 2; 116 /** 117 * Package name of the source application that inserted the voicemail. 118 * <P>Type: TEXT</P> 119 */ 120 public static final String SOURCE_PACKAGE = "source_package"; 121 /** 122 * Application-specific data available to the source application that 123 * inserted the voicemail. This is typically used to store the source 124 * specific message id to identify this voicemail on the remote 125 * voicemail server. 126 * <P>Type: TEXT</P> 127 * <P> Note that this is NOT the voicemail media content data. 128 */ 129 public static final String SOURCE_DATA = "source_data"; 130 /** 131 * Whether the media content for this voicemail is available for 132 * consumption. 133 * <P>Type: INTEGER (boolean)</P> 134 */ 135 public static final String HAS_CONTENT = "has_content"; 136 /** 137 * MIME type of the media content for the voicemail. 138 * <P>Type: TEXT</P> 139 */ 140 public static final String MIME_TYPE = "mime_type"; 141 /** 142 * Path to the media content file. Internal only field. 143 * @hide 144 */ 145 public static final String _DATA = "_data"; 146 } 147} 148