VoicemailContract.java revision 4687cbc48d710069d65086c7e8b600edb01e1255
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 * Extra included in {@value Intent#ACTION_PROVIDER_CHANGED} and 68 * {@value #ACTION_NEW_VOICEMAIL} broadcast intents to indicate the package 69 * that caused the change in content provider. 70 * <p>Receivers of the broadcast can use this field to determine if this is 71 * a self change. 72 * @deprecated {@link #EXTRA_SELF_CHANGE} is now populated instead. 73 */ 74 public static final String EXTRA_CHANGED_BY = "com.android.voicemail.extra.CHANGED_BY"; 75 /** 76 * Extra included in {@value Intent#ACTION_PROVIDER_CHANGED} and 77 * {@value #ACTION_NEW_VOICEMAIL} broadcast intents to indicate if the receiving 78 * package made this change. 79 */ 80 public static final String EXTRA_SELF_CHANGE = "com.android.voicemail.extra.SELF_CHANGE"; 81 82 /** The mime type for a collection of voicemails. */ 83 public static final String DIR_TYPE = 84 "vnd.android.cursor.dir/voicemails"; 85 86 public static final class Voicemails implements BaseColumns { 87 /** Not instantiable. */ 88 private Voicemails() { 89 } 90 91 /** 92 * Phone number of the voicemail sender. 93 * <P>Type: TEXT</P> 94 */ 95 public static final String NUMBER = Calls.NUMBER; 96 /** 97 * The date the voicemail was sent, in milliseconds since the epoch 98 * <P>Type: INTEGER (long)</P> 99 */ 100 public static final String DATE = Calls.DATE; 101 /** 102 * The duration of the voicemail in seconds. 103 * <P>Type: INTEGER (long)</P> 104 */ 105 public static final String DURATION = Calls.DURATION; 106 /** 107 * Whether this is a new voicemail (i.e. has not been heard). 108 * <P>Type: INTEGER (boolean)</P> 109 */ 110 public static final String NEW = Calls.NEW; 111 /** 112 * The mail box state of the voicemail. 113 * <P> Possible values: {@link #STATE_INBOX}, {@link #STATE_DELETED}, 114 * {@link #STATE_UNDELETED}. 115 * <P>Type: INTEGER</P> 116 */ 117 public static final String STATE = "state"; 118 /** Value of {@link #STATE} when the voicemail is in inbox. */ 119 public static int STATE_INBOX = 0; 120 /** Value of {@link #STATE} when the voicemail has been marked as deleted. */ 121 public static int STATE_DELETED = 1; 122 /** Value of {@link #STATE} when the voicemail has marked as undeleted. */ 123 public static int STATE_UNDELETED = 2; 124 /** 125 * Package name of the source application that inserted the voicemail. 126 * <P>Type: TEXT</P> 127 */ 128 public static final String SOURCE_PACKAGE = "source_package"; 129 /** 130 * Application-specific data available to the source application that 131 * inserted the voicemail. This is typically used to store the source 132 * specific message id to identify this voicemail on the remote 133 * voicemail server. 134 * <P>Type: TEXT</P> 135 * <P> Note that this is NOT the voicemail media content data. 136 */ 137 public static final String SOURCE_DATA = "source_data"; 138 /** 139 * Whether the media content for this voicemail is available for 140 * consumption. 141 * <P>Type: INTEGER (boolean)</P> 142 */ 143 public static final String HAS_CONTENT = "has_content"; 144 /** 145 * MIME type of the media content for the voicemail. 146 * <P>Type: TEXT</P> 147 */ 148 public static final String MIME_TYPE = "mime_type"; 149 /** 150 * Path to the media content file. Internal only field. 151 * @hide 152 */ 153 public static final String _DATA = "_data"; 154 } 155} 156