Telephony.java 97.3 KB
Newer Older
Wink Saville's avatar
Wink Saville committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
/*
 * Copyright (C) 2006 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 android.provider;

import android.annotation.SdkConstant;
import android.annotation.SdkConstant.SdkConstantType;
21
import android.content.ComponentName;
Wink Saville's avatar
Wink Saville committed
22 23 24 25 26 27 28 29
import android.content.ContentResolver;
import android.content.ContentValues;
import android.content.Context;
import android.content.Intent;
import android.database.Cursor;
import android.database.sqlite.SqliteWrapper;
import android.net.Uri;
import android.telephony.SmsMessage;
Wink Saville's avatar
Wink Saville committed
30
import android.telephony.SubscriptionManager;
Wink Saville's avatar
Wink Saville committed
31
import android.text.TextUtils;
Wink Saville's avatar
Wink Saville committed
32
import android.telephony.Rlog;
Wink Saville's avatar
Wink Saville committed
33 34
import android.util.Patterns;

Wink Saville's avatar
Wink Saville committed
35
import com.android.internal.telephony.PhoneConstants;
36 37
import com.android.internal.telephony.SmsApplication;

Wink Saville's avatar
Wink Saville committed
38 39 40 41 42 43 44

import java.util.HashSet;
import java.util.Set;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

/**
45 46
 * The Telephony provider contains data related to phone operation, specifically SMS and MMS
 * messages and access to the APN list, including the MMSC to use.
Scott Main's avatar
Scott Main committed
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
 *
 * <p class="note"><strong>Note:</strong> These APIs are not available on all Android-powered
 * devices. If your app depends on telephony features such as for managing SMS messages, include
 * a <a href="{@docRoot}guide/topics/manifest/uses-feature-element.html">{@code &lt;uses-feature>}
 * </a> element in your manifest that declares the {@code "android.hardware.telephony"} hardware
 * feature. Alternatively, you can check for telephony availability at runtime using either
 * {@link android.content.pm.PackageManager#hasSystemFeature
 * hasSystemFeature(PackageManager.FEATURE_TELEPHONY)} or {@link
 * android.telephony.TelephonyManager#getPhoneType}.</p>
 *
 * <h3>Creating an SMS app</h3>
 *
 * <p>Only the default SMS app (selected by the user in system settings) is able to write to the
 * SMS Provider (the tables defined within the {@code Telephony} class) and only the default SMS
 * app receives the {@link android.provider.Telephony.Sms.Intents#SMS_DELIVER_ACTION} broadcast
 * when the user receives an SMS or the {@link
 * android.provider.Telephony.Sms.Intents#WAP_PUSH_DELIVER_ACTION} broadcast when the user
 * receives an MMS.</p>
 *
 * <p>Any app that wants to behave as the user's default SMS app must handle the following intents:
 * <ul>
 * <li>In a broadcast receiver, include an intent filter for {@link Sms.Intents#SMS_DELIVER_ACTION}
 * (<code>"android.provider.Telephony.SMS_DELIVER"</code>). The broadcast receiver must also
 * require the {@link android.Manifest.permission#BROADCAST_SMS} permission.
 * <p>This allows your app to directly receive incoming SMS messages.</p></li>
 * <li>In a broadcast receiver, include an intent filter for {@link
 * Sms.Intents#WAP_PUSH_DELIVER_ACTION}} ({@code "android.provider.Telephony.WAP_PUSH_DELIVER"})
 * with the MIME type <code>"application/vnd.wap.mms-message"</code>.
 * The broadcast receiver must also require the {@link
 * android.Manifest.permission#BROADCAST_WAP_PUSH} permission.
 * <p>This allows your app to directly receive incoming MMS messages.</p></li>
 * <li>In your activity that delivers new messages, include an intent filter for
 * {@link android.content.Intent#ACTION_SENDTO} (<code>"android.intent.action.SENDTO"
 * </code>) with schemas, <code>sms:</code>, <code>smsto:</code>, <code>mms:</code>, and
 * <code>mmsto:</code>.
 * <p>This allows your app to receive intents from other apps that want to deliver a
 * message.</p></li>
 * <li>In a service, include an intent filter for {@link
 * android.telephony.TelephonyManager#ACTION_RESPOND_VIA_MESSAGE}
 * (<code>"android.intent.action.RESPOND_VIA_MESSAGE"</code>) with schemas,
 * <code>sms:</code>, <code>smsto:</code>, <code>mms:</code>, and <code>mmsto:</code>.
 * This service must also require the {@link
 * android.Manifest.permission#SEND_RESPOND_VIA_MESSAGE} permission.
 * <p>This allows users to respond to incoming phone calls with an immediate text message
 * using your app.</p></li>
 * </ul>
 *
 * <p>Other apps that are not selected as the default SMS app can only <em>read</em> the SMS
 * Provider, but may also be notified when a new SMS arrives by listening for the {@link
 * Sms.Intents#SMS_RECEIVED_ACTION}
 * broadcast, which is a non-abortable broadcast that may be delivered to multiple apps. This
 * broadcast is intended for apps that&mdash;while not selected as the default SMS app&mdash;need to
 * read special incoming messages such as to perform phone number verification.</p>
 *
 * <p>For more information about building SMS apps, read the blog post, <a
 * href="http://android-developers.blogspot.com/2013/10/getting-your-sms-apps-ready-for-kitkat.html"
 * >Getting Your SMS Apps Ready for KitKat</a>.</p>
 *
Wink Saville's avatar
Wink Saville committed
105 106 107 108
 */
public final class Telephony {
    private static final String TAG = "Telephony";

109 110 111 112 113
    /**
     * Not instantiable.
     * @hide
     */
    private Telephony() {
Wink Saville's avatar
Wink Saville committed
114 115 116
    }

    /**
117
     * Base columns for tables that contain text-based SMSs.
Wink Saville's avatar
Wink Saville committed
118 119 120
     */
    public interface TextBasedSmsColumns {

121
        /** Message type: all messages. */
Wink Saville's avatar
Wink Saville committed
122
        public static final int MESSAGE_TYPE_ALL    = 0;
123 124

        /** Message type: inbox. */
Wink Saville's avatar
Wink Saville committed
125
        public static final int MESSAGE_TYPE_INBOX  = 1;
126 127

        /** Message type: sent messages. */
Wink Saville's avatar
Wink Saville committed
128
        public static final int MESSAGE_TYPE_SENT   = 2;
129 130

        /** Message type: drafts. */
Wink Saville's avatar
Wink Saville committed
131
        public static final int MESSAGE_TYPE_DRAFT  = 3;
132 133

        /** Message type: outbox. */
Wink Saville's avatar
Wink Saville committed
134
        public static final int MESSAGE_TYPE_OUTBOX = 4;
135 136 137 138 139 140

        /** Message type: failed outgoing message. */
        public static final int MESSAGE_TYPE_FAILED = 5;

        /** Message type: queued to send later. */
        public static final int MESSAGE_TYPE_QUEUED = 6;
Wink Saville's avatar
Wink Saville committed
141 142

        /**
143
         * The type of message.
Wink Saville's avatar
Wink Saville committed
144 145
         * <P>Type: INTEGER</P>
         */
146
        public static final String TYPE = "type";
Wink Saville's avatar
Wink Saville committed
147 148

        /**
149 150
         * The thread ID of the message.
         * <P>Type: INTEGER</P>
Wink Saville's avatar
Wink Saville committed
151
         */
152
        public static final String THREAD_ID = "thread_id";
Wink Saville's avatar
Wink Saville committed
153 154

        /**
155 156
         * The address of the other party.
         * <P>Type: TEXT</P>
Wink Saville's avatar
Wink Saville committed
157
         */
158
        public static final String ADDRESS = "address";
Wink Saville's avatar
Wink Saville committed
159 160

        /**
161
         * The date the message was received.
Wink Saville's avatar
Wink Saville committed
162 163 164 165 166
         * <P>Type: INTEGER (long)</P>
         */
        public static final String DATE = "date";

        /**
167
         * The date the message was sent.
Wink Saville's avatar
Wink Saville committed
168 169 170 171 172
         * <P>Type: INTEGER (long)</P>
         */
        public static final String DATE_SENT = "date_sent";

        /**
173
         * Has the message been read?
Wink Saville's avatar
Wink Saville committed
174 175 176 177 178
         * <P>Type: INTEGER (boolean)</P>
         */
        public static final String READ = "read";

        /**
179 180 181
         * Has the message been seen by the user? The "seen" flag determines
         * whether we need to show a notification.
         * <P>Type: INTEGER (boolean)</P>
Wink Saville's avatar
Wink Saville committed
182 183 184 185
         */
        public static final String SEEN = "seen";

        /**
186 187
         * {@code TP-Status} value for the message, or -1 if no status has been received.
         * <P>Type: INTEGER</P>
Wink Saville's avatar
Wink Saville committed
188 189 190
         */
        public static final String STATUS = "status";

191
        /** TP-Status: no status received. */
Wink Saville's avatar
Wink Saville committed
192
        public static final int STATUS_NONE = -1;
193
        /** TP-Status: complete. */
Wink Saville's avatar
Wink Saville committed
194
        public static final int STATUS_COMPLETE = 0;
195
        /** TP-Status: pending. */
Wink Saville's avatar
Wink Saville committed
196
        public static final int STATUS_PENDING = 32;
197
        /** TP-Status: failed. */
Wink Saville's avatar
Wink Saville committed
198 199 200
        public static final int STATUS_FAILED = 64;

        /**
201
         * The subject of the message, if present.
Wink Saville's avatar
Wink Saville committed
202 203 204 205 206
         * <P>Type: TEXT</P>
         */
        public static final String SUBJECT = "subject";

        /**
207
         * The body of the message.
Wink Saville's avatar
Wink Saville committed
208 209 210 211 212
         * <P>Type: TEXT</P>
         */
        public static final String BODY = "body";

        /**
213 214
         * The ID of the sender of the conversation, if present.
         * <P>Type: INTEGER (reference to item in {@code content://contacts/people})</P>
Wink Saville's avatar
Wink Saville committed
215 216 217 218
         */
        public static final String PERSON = "person";

        /**
219
         * The protocol identifier code.
Wink Saville's avatar
Wink Saville committed
220 221 222 223 224
         * <P>Type: INTEGER</P>
         */
        public static final String PROTOCOL = "protocol";

        /**
225
         * Is the {@code TP-Reply-Path} flag set?
Wink Saville's avatar
Wink Saville committed
226 227 228 229 230
         * <P>Type: BOOLEAN</P>
         */
        public static final String REPLY_PATH_PRESENT = "reply_path_present";

        /**
231
         * The service center (SC) through which to send the message, if present.
Wink Saville's avatar
Wink Saville committed
232 233 234 235 236
         * <P>Type: TEXT</P>
         */
        public static final String SERVICE_CENTER = "service_center";

        /**
237
         * Is the message locked?
Wink Saville's avatar
Wink Saville committed
238 239 240 241 242
         * <P>Type: INTEGER (boolean)</P>
         */
        public static final String LOCKED = "locked";

        /**
243
         * The subscription to which the message belongs to. Its value will be
244
         * < 0 if the sub id cannot be determined.
Wink Saville's avatar
Wink Saville committed
245 246
         * <p>Type: INTEGER (long) </p>
         */
247
        public static final String SUBSCRIPTION_ID = "sub_id";
Wink Saville's avatar
Wink Saville committed
248

249 250 251 252 253 254
        /**
         * The MTU size of the mobile interface to which the APN connected
         * @hide
         */
        public static final String MTU = "mtu";

Wink Saville's avatar
Wink Saville committed
255 256
        /**
         * Error code associated with sending or receiving this message
Wink Saville's avatar
Wink Saville committed
257 258 259
         * <P>Type: INTEGER</P>
         */
        public static final String ERROR_CODE = "error_code";
260 261

        /**
262 263
         * The identity of the sender of a sent message. It is
         * usually the package name of the app which sends the message.
264 265
         * <p class="note"><strong>Note:</strong>
         * This column is read-only. It is set by the provider and can not be changed by apps.
266
         * <p>Type: TEXT</p>
267 268
         */
        public static final String CREATOR = "creator";
Wink Saville's avatar
Wink Saville committed
269 270 271
    }

    /**
272
     * Contains all text-based SMS messages.
Wink Saville's avatar
Wink Saville committed
273 274
     */
    public static final class Sms implements BaseColumns, TextBasedSmsColumns {
275 276 277 278 279 280 281 282

        /**
         * Not instantiable.
         * @hide
         */
        private Sms() {
        }

283 284 285 286 287 288 289 290 291 292 293 294 295
        /**
         * Used to determine the currently configured default SMS package.
         * @param context context of the requesting application
         * @return package name for the default SMS package or null
         */
        public static String getDefaultSmsPackage(Context context) {
            ComponentName component = SmsApplication.getDefaultSmsApplication(context, false);
            if (component != null) {
                return component.getPackageName();
            }
            return null;
        }

296 297 298 299 300
        /**
         * Return cursor for table query.
         * @hide
         */
        public static Cursor query(ContentResolver cr, String[] projection) {
Wink Saville's avatar
Wink Saville committed
301 302 303
            return cr.query(CONTENT_URI, projection, null, null, DEFAULT_SORT_ORDER);
        }

304 305 306 307 308
        /**
         * Return cursor for table query.
         * @hide
         */
        public static Cursor query(ContentResolver cr, String[] projection,
Wink Saville's avatar
Wink Saville committed
309 310
                String where, String orderBy) {
            return cr.query(CONTENT_URI, projection, where,
311
                    null, orderBy == null ? DEFAULT_SORT_ORDER : orderBy);
Wink Saville's avatar
Wink Saville committed
312 313 314
        }

        /**
315
         * The {@code content://} style URL for this table.
Wink Saville's avatar
Wink Saville committed
316
         */
317
        public static final Uri CONTENT_URI = Uri.parse("content://sms");
Wink Saville's avatar
Wink Saville committed
318 319

        /**
320
         * The default sort order for this table.
Wink Saville's avatar
Wink Saville committed
321 322 323 324 325 326 327 328 329 330
         */
        public static final String DEFAULT_SORT_ORDER = "date DESC";

        /**
         * Add an SMS to the given URI.
         *
         * @param resolver the content resolver to use
         * @param uri the URI to add the message to
         * @param address the address of the sender
         * @param body the body of the message
331
         * @param subject the pseudo-subject of the message
Wink Saville's avatar
Wink Saville committed
332 333 334 335
         * @param date the timestamp for the message
         * @param read true if the message has been read, false if not
         * @param deliveryReport true if a delivery report was requested, false if not
         * @return the URI for the new message
336
         * @hide
Wink Saville's avatar
Wink Saville committed
337 338 339 340
         */
        public static Uri addMessageToUri(ContentResolver resolver,
                Uri uri, String address, String body, String subject,
                Long date, boolean read, boolean deliveryReport) {
341
            return addMessageToUri(SubscriptionManager.getDefaultSmsSubId(),
Wink Saville's avatar
Wink Saville committed
342 343 344 345 346 347 348 349 350 351 352 353 354 355
                    resolver, uri, address, body, subject, date, read, deliveryReport, -1L);
        }

        /**
         * Add an SMS to the given URI.
         *
         * @param resolver the content resolver to use
         * @param uri the URI to add the message to
         * @param address the address of the sender
         * @param body the body of the message
         * @param subject the psuedo-subject of the message
         * @param date the timestamp for the message
         * @param read true if the message has been read, false if not
         * @param deliveryReport true if a delivery report was requested, false if not
356
         * @param subId the subscription which the message belongs to
Wink Saville's avatar
Wink Saville committed
357 358 359
         * @return the URI for the new message
         * @hide
         */
Wink Saville's avatar
Wink Saville committed
360
        public static Uri addMessageToUri(int subId, ContentResolver resolver,
Wink Saville's avatar
Wink Saville committed
361 362 363
                Uri uri, String address, String body, String subject,
                Long date, boolean read, boolean deliveryReport) {
            return addMessageToUri(subId, resolver, uri, address, body, subject,
Wink Saville's avatar
Wink Saville committed
364 365 366 367
                    date, read, deliveryReport, -1L);
        }

        /**
368
         * Add an SMS to the given URI with the specified thread ID.
Wink Saville's avatar
Wink Saville committed
369 370 371 372 373
         *
         * @param resolver the content resolver to use
         * @param uri the URI to add the message to
         * @param address the address of the sender
         * @param body the body of the message
374
         * @param subject the pseudo-subject of the message
Wink Saville's avatar
Wink Saville committed
375 376 377 378 379
         * @param date the timestamp for the message
         * @param read true if the message has been read, false if not
         * @param deliveryReport true if a delivery report was requested, false if not
         * @param threadId the thread_id of the message
         * @return the URI for the new message
380
         * @hide
Wink Saville's avatar
Wink Saville committed
381 382 383 384
         */
        public static Uri addMessageToUri(ContentResolver resolver,
                Uri uri, String address, String body, String subject,
                Long date, boolean read, boolean deliveryReport, long threadId) {
385
            return addMessageToUri(SubscriptionManager.getDefaultSmsSubId(),
Wink Saville's avatar
Wink Saville committed
386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401
                    resolver, uri, address, body, subject,
                    date, read, deliveryReport, threadId);
        }

        /**
         * Add an SMS to the given URI with thread_id specified.
         *
         * @param resolver the content resolver to use
         * @param uri the URI to add the message to
         * @param address the address of the sender
         * @param body the body of the message
         * @param subject the psuedo-subject of the message
         * @param date the timestamp for the message
         * @param read true if the message has been read, false if not
         * @param deliveryReport true if a delivery report was requested, false if not
         * @param threadId the thread_id of the message
402
         * @param subId the subscription which the message belongs to
Wink Saville's avatar
Wink Saville committed
403 404 405
         * @return the URI for the new message
         * @hide
         */
Wink Saville's avatar
Wink Saville committed
406
        public static Uri addMessageToUri(int subId, ContentResolver resolver,
Wink Saville's avatar
Wink Saville committed
407 408 409 410
                Uri uri, String address, String body, String subject,
                Long date, boolean read, boolean deliveryReport, long threadId) {
            ContentValues values = new ContentValues(8);
            Rlog.v(TAG,"Telephony addMessageToUri sub id: " + subId);
Wink Saville's avatar
Wink Saville committed
411

412
            values.put(SUBSCRIPTION_ID, subId);
Wink Saville's avatar
Wink Saville committed
413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435
            values.put(ADDRESS, address);
            if (date != null) {
                values.put(DATE, date);
            }
            values.put(READ, read ? Integer.valueOf(1) : Integer.valueOf(0));
            values.put(SUBJECT, subject);
            values.put(BODY, body);
            if (deliveryReport) {
                values.put(STATUS, STATUS_PENDING);
            }
            if (threadId != -1L) {
                values.put(THREAD_ID, threadId);
            }
            return resolver.insert(uri, values);
        }

        /**
         * Move a message to the given folder.
         *
         * @param context the context to use
         * @param uri the message to move
         * @param folder the folder to move to
         * @return true if the operation succeeded
436
         * @hide
Wink Saville's avatar
Wink Saville committed
437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465
         */
        public static boolean moveMessageToFolder(Context context,
                Uri uri, int folder, int error) {
            if (uri == null) {
                return false;
            }

            boolean markAsUnread = false;
            boolean markAsRead = false;
            switch(folder) {
            case MESSAGE_TYPE_INBOX:
            case MESSAGE_TYPE_DRAFT:
                break;
            case MESSAGE_TYPE_OUTBOX:
            case MESSAGE_TYPE_SENT:
                markAsRead = true;
                break;
            case MESSAGE_TYPE_FAILED:
            case MESSAGE_TYPE_QUEUED:
                markAsUnread = true;
                break;
            default:
                return false;
            }

            ContentValues values = new ContentValues(3);

            values.put(TYPE, folder);
            if (markAsUnread) {
466
                values.put(READ, 0);
Wink Saville's avatar
Wink Saville committed
467
            } else if (markAsRead) {
468
                values.put(READ, 1);
Wink Saville's avatar
Wink Saville committed
469 470 471 472 473 474 475 476 477 478
            }
            values.put(ERROR_CODE, error);

            return 1 == SqliteWrapper.update(context, context.getContentResolver(),
                            uri, values, null, null);
        }

        /**
         * Returns true iff the folder (message type) identifies an
         * outgoing message.
479
         * @hide
Wink Saville's avatar
Wink Saville committed
480 481 482 483 484 485 486 487 488
         */
        public static boolean isOutgoingFolder(int messageType) {
            return  (messageType == MESSAGE_TYPE_FAILED)
                    || (messageType == MESSAGE_TYPE_OUTBOX)
                    || (messageType == MESSAGE_TYPE_SENT)
                    || (messageType == MESSAGE_TYPE_QUEUED);
        }

        /**
489
         * Contains all text-based SMS messages in the SMS app inbox.
Wink Saville's avatar
Wink Saville committed
490 491
         */
        public static final class Inbox implements BaseColumns, TextBasedSmsColumns {
492

Wink Saville's avatar
Wink Saville committed
493
            /**
494 495
             * Not instantiable.
             * @hide
Wink Saville's avatar
Wink Saville committed
496
             */
497 498
            private Inbox() {
            }
Wink Saville's avatar
Wink Saville committed
499 500

            /**
501 502 503 504 505 506
             * The {@code content://} style URL for this table.
             */
            public static final Uri CONTENT_URI = Uri.parse("content://sms/inbox");

            /**
             * The default sort order for this table.
Wink Saville's avatar
Wink Saville committed
507 508 509 510 511 512 513 514 515
             */
            public static final String DEFAULT_SORT_ORDER = "date DESC";

            /**
             * Add an SMS to the Draft box.
             *
             * @param resolver the content resolver to use
             * @param address the address of the sender
             * @param body the body of the message
516
             * @param subject the pseudo-subject of the message
Wink Saville's avatar
Wink Saville committed
517 518 519
             * @param date the timestamp for the message
             * @param read true if the message has been read, false if not
             * @return the URI for the new message
520
             * @hide
Wink Saville's avatar
Wink Saville committed
521 522 523 524
             */
            public static Uri addMessage(ContentResolver resolver,
                    String address, String body, String subject, Long date,
                    boolean read) {
525
                return addMessageToUri(SubscriptionManager.getDefaultSmsSubId(),
Wink Saville's avatar
Wink Saville committed
526 527 528 529 530 531 532 533 534 535 536 537
                        resolver, CONTENT_URI, address, body, subject, date, read, false);
            }

            /**
             * Add an SMS to the Draft box.
             *
             * @param resolver the content resolver to use
             * @param address the address of the sender
             * @param body the body of the message
             * @param subject the psuedo-subject of the message
             * @param date the timestamp for the message
             * @param read true if the message has been read, false if not
538
             * @param subId the subscription which the message belongs to
Wink Saville's avatar
Wink Saville committed
539 540 541
             * @return the URI for the new message
             * @hide
             */
Wink Saville's avatar
Wink Saville committed
542
            public static Uri addMessage(int subId, ContentResolver resolver,
Wink Saville's avatar
Wink Saville committed
543 544
                    String address, String body, String subject, Long date, boolean read) {
                return addMessageToUri(subId, resolver, CONTENT_URI, address, body,
Wink Saville's avatar
Wink Saville committed
545 546 547 548 549
                        subject, date, read, false);
            }
        }

        /**
550
         * Contains all sent text-based SMS messages in the SMS app.
Wink Saville's avatar
Wink Saville committed
551 552
         */
        public static final class Sent implements BaseColumns, TextBasedSmsColumns {
553 554 555 556 557 558 559 560

            /**
             * Not instantiable.
             * @hide
             */
            private Sent() {
            }

Wink Saville's avatar
Wink Saville committed
561
            /**
562
             * The {@code content://} style URL for this table.
Wink Saville's avatar
Wink Saville committed
563
             */
564
            public static final Uri CONTENT_URI = Uri.parse("content://sms/sent");
Wink Saville's avatar
Wink Saville committed
565 566

            /**
567
             * The default sort order for this table.
Wink Saville's avatar
Wink Saville committed
568 569 570 571 572 573 574 575 576
             */
            public static final String DEFAULT_SORT_ORDER = "date DESC";

            /**
             * Add an SMS to the Draft box.
             *
             * @param resolver the content resolver to use
             * @param address the address of the sender
             * @param body the body of the message
577
             * @param subject the pseudo-subject of the message
Wink Saville's avatar
Wink Saville committed
578 579
             * @param date the timestamp for the message
             * @return the URI for the new message
580
             * @hide
Wink Saville's avatar
Wink Saville committed
581 582 583
             */
            public static Uri addMessage(ContentResolver resolver,
                    String address, String body, String subject, Long date) {
584
                return addMessageToUri(SubscriptionManager.getDefaultSmsSubId(),
Wink Saville's avatar
Wink Saville committed
585 586 587 588 589 590 591 592 593 594 595
                        resolver, CONTENT_URI, address, body, subject, date, true, false);
            }

            /**
             * Add an SMS to the Draft box.
             *
             * @param resolver the content resolver to use
             * @param address the address of the sender
             * @param body the body of the message
             * @param subject the psuedo-subject of the message
             * @param date the timestamp for the message
596
             * @param subId the subscription which the message belongs to
Wink Saville's avatar
Wink Saville committed
597 598 599
             * @return the URI for the new message
             * @hide
             */
Wink Saville's avatar
Wink Saville committed
600
            public static Uri addMessage(int subId, ContentResolver resolver,
Wink Saville's avatar
Wink Saville committed
601 602
                    String address, String body, String subject, Long date) {
                return addMessageToUri(subId, resolver, CONTENT_URI, address, body,
Wink Saville's avatar
Wink Saville committed
603 604 605 606 607
                        subject, date, true, false);
            }
        }

        /**
608
         * Contains all sent text-based SMS messages in the SMS app.
Wink Saville's avatar
Wink Saville committed
609 610 611 612
         */
        public static final class Draft implements BaseColumns, TextBasedSmsColumns {

            /**
613 614
             * Not instantiable.
             * @hide
Wink Saville's avatar
Wink Saville committed
615
             */
616 617
            private Draft() {
            }
Wink Saville's avatar
Wink Saville committed
618 619

            /**
620
             * The {@code content://} style URL for this table.
Wink Saville's avatar
Wink Saville committed
621
             */
622
            public static final Uri CONTENT_URI = Uri.parse("content://sms/draft");
Wink Saville's avatar
Wink Saville committed
623

Wink Saville's avatar
Wink Saville committed
624 625 626 627 628
           /**
            * @hide
            */
            public static Uri addMessage(ContentResolver resolver,
                    String address, String body, String subject, Long date) {
629
                return addMessageToUri(SubscriptionManager.getDefaultSmsSubId(),
Wink Saville's avatar
Wink Saville committed
630 631 632 633 634 635 636 637 638 639 640
                        resolver, CONTENT_URI, address, body, subject, date, true, false);
            }

            /**
             * Add an SMS to the Draft box.
             *
             * @param resolver the content resolver to use
             * @param address the address of the sender
             * @param body the body of the message
             * @param subject the psuedo-subject of the message
             * @param date the timestamp for the message
641
             * @param subId the subscription which the message belongs to
Wink Saville's avatar
Wink Saville committed
642 643 644
             * @return the URI for the new message
             * @hide
             */
Wink Saville's avatar
Wink Saville committed
645
            public static Uri addMessage(int subId, ContentResolver resolver,
Wink Saville's avatar
Wink Saville committed
646 647 648 649 650
                    String address, String body, String subject, Long date) {
                return addMessageToUri(subId, resolver, CONTENT_URI, address, body,
                        subject, date, true, false);
            }

Wink Saville's avatar
Wink Saville committed
651
            /**
652 653 654
             * The default sort order for this table.
             */
            public static final String DEFAULT_SORT_ORDER = "date DESC";
Wink Saville's avatar
Wink Saville committed
655 656 657
        }

        /**
658
         * Contains all pending outgoing text-based SMS messages.
Wink Saville's avatar
Wink Saville committed
659 660
         */
        public static final class Outbox implements BaseColumns, TextBasedSmsColumns {
661 662 663 664 665 666 667 668

            /**
             * Not instantiable.
             * @hide
             */
            private Outbox() {
            }

Wink Saville's avatar
Wink Saville committed
669
            /**
670
             * The {@code content://} style URL for this table.
Wink Saville's avatar
Wink Saville committed
671
             */
672
            public static final Uri CONTENT_URI = Uri.parse("content://sms/outbox");
Wink Saville's avatar
Wink Saville committed
673 674

            /**
675
             * The default sort order for this table.
Wink Saville's avatar
Wink Saville committed
676 677 678 679
             */
            public static final String DEFAULT_SORT_ORDER = "date DESC";

            /**
680
             * Add an SMS to the outbox.
Wink Saville's avatar
Wink Saville committed
681 682 683 684
             *
             * @param resolver the content resolver to use
             * @param address the address of the sender
             * @param body the body of the message
685
             * @param subject the pseudo-subject of the message
Wink Saville's avatar
Wink Saville committed
686 687 688
             * @param date the timestamp for the message
             * @param deliveryReport whether a delivery report was requested for the message
             * @return the URI for the new message
689
             * @hide
Wink Saville's avatar
Wink Saville committed
690 691 692 693
             */
            public static Uri addMessage(ContentResolver resolver,
                    String address, String body, String subject, Long date,
                    boolean deliveryReport, long threadId) {
694
                return addMessageToUri(SubscriptionManager.getDefaultSmsSubId(),
Wink Saville's avatar
Wink Saville committed
695 696 697 698 699 700 701 702 703 704 705 706 707
                        resolver, CONTENT_URI, address, body, subject, date,
                        true, deliveryReport, threadId);
            }

            /**
             * Add an SMS to the Out box.
             *
             * @param resolver the content resolver to use
             * @param address the address of the sender
             * @param body the body of the message
             * @param subject the psuedo-subject of the message
             * @param date the timestamp for the message
             * @param deliveryReport whether a delivery report was requested for the message
708
             * @param subId the subscription which the message belongs to
Wink Saville's avatar
Wink Saville committed
709 710 711
             * @return the URI for the new message
             * @hide
             */
Wink Saville's avatar
Wink Saville committed
712
            public static Uri addMessage(int subId, ContentResolver resolver,
Wink Saville's avatar
Wink Saville committed
713 714 715
                    String address, String body, String subject, Long date,
                    boolean deliveryReport, long threadId) {
                return addMessageToUri(subId, resolver, CONTENT_URI, address, body,
Wink Saville's avatar
Wink Saville committed
716 717 718 719 720
                        subject, date, true, deliveryReport, threadId);
            }
        }

        /**
721
         * Contains all sent text-based SMS messages in the SMS app.
Wink Saville's avatar
Wink Saville committed
722 723 724
         */
        public static final class Conversations
                implements BaseColumns, TextBasedSmsColumns {
725

Wink Saville's avatar
Wink Saville committed
726
            /**
727 728
             * Not instantiable.
             * @hide
Wink Saville's avatar
Wink Saville committed
729
             */
730 731 732 733 734 735 736
            private Conversations() {
            }

            /**
             * The {@code content://} style URL for this table.
             */
            public static final Uri CONTENT_URI = Uri.parse("content://sms/conversations");
Wink Saville's avatar
Wink Saville committed
737 738

            /**
739
             * The default sort order for this table.
Wink Saville's avatar
Wink Saville committed
740 741 742 743
             */
            public static final String DEFAULT_SORT_ORDER = "date DESC";

            /**
744
             * The first 45 characters of the body of the message.
Wink Saville's avatar
Wink Saville committed
745 746 747 748 749
             * <P>Type: TEXT</P>
             */
            public static final String SNIPPET = "snippet";

            /**
750
             * The number of messages in the conversation.
Wink Saville's avatar
Wink Saville committed
751 752 753 754 755 756
             * <P>Type: INTEGER</P>
             */
            public static final String MESSAGE_COUNT = "msg_count";
        }

        /**
757
         * Contains constants for SMS related Intents that are broadcast.
Wink Saville's avatar
Wink Saville committed
758 759
         */
        public static final class Intents {
760

Wink Saville's avatar
Wink Saville committed
761
            /**
762 763 764 765 766 767 768 769
             * Not instantiable.
             * @hide
             */
            private Intents() {
            }

            /**
             * Set by BroadcastReceiver to indicate that the message was handled
Wink Saville's avatar
Wink Saville committed
770 771 772 773 774
             * successfully.
             */
            public static final int RESULT_SMS_HANDLED = 1;

            /**
775
             * Set by BroadcastReceiver to indicate a generic error while
Wink Saville's avatar
Wink Saville committed
776 777 778 779 780
             * processing the message.
             */
            public static final int RESULT_SMS_GENERIC_ERROR = 2;

            /**
781
             * Set by BroadcastReceiver to indicate insufficient memory to store
Wink Saville's avatar
Wink Saville committed
782 783 784 785 786
             * the message.
             */
            public static final int RESULT_SMS_OUT_OF_MEMORY = 3;

            /**
787
             * Set by BroadcastReceiver to indicate that the message, while
Wink Saville's avatar
Wink Saville committed
788 789 790 791 792
             * possibly valid, is of a format or encoding that is not
             * supported.
             */
            public static final int RESULT_SMS_UNSUPPORTED = 4;

793
            /**
794
             * Set by BroadcastReceiver to indicate a duplicate incoming message.
795 796 797
             */
            public static final int RESULT_SMS_DUPLICATED = 5;

798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817
            /**
             * Activity action: Ask the user to change the default
             * SMS application. This will show a dialog that asks the
             * user whether they want to replace the current default
             * SMS application with the one specified in
             * {@link #EXTRA_PACKAGE_NAME}.
             */
            @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
            public static final String ACTION_CHANGE_DEFAULT =
                    "android.provider.Telephony.ACTION_CHANGE_DEFAULT";

            /**
             * The PackageName string passed in as an
             * extra for {@link #ACTION_CHANGE_DEFAULT}
             *
             * @see #ACTION_CHANGE_DEFAULT
             */
            public static final String EXTRA_PACKAGE_NAME = "package";

            /**
818
             * Broadcast Action: A new text-based SMS message has been received
819 820 821 822 823
             * by the device. This intent will only be delivered to the default
             * sms app. That app is responsible for writing the message and notifying
             * the user. The intent will have the following extra values:</p>
             *
             * <ul>
Scott Main's avatar
Scott Main committed
824
             *   <li><em>"pdus"</em> - An Object[] of byte[]s containing the PDUs
825
             *   that make up the message.</li>
826 827 828 829 830 831 832 833 834 835
             *   <li><em>"format"</em> - A String describing the format of the PDUs. It can
             *   be either "3gpp" or "3gpp2".</li>
             *   <li><em>"subscription"</em> - An optional long value of the subscription id which
             *   received the message.</li>
             *   <li><em>"slot"</em> - An optional int value of the SIM slot containing the
             *   subscription.</li>
             *   <li><em>"phone"</em> - An optional int value of the phone id associated with the
             *   subscription.</li>
             *   <li><em>"errorCode"</em> - An optional int error code associated with receiving
             *   the message.</li>
836 837 838 839 840 841 842
             * </ul>
             *
             * <p>The extra values can be extracted using
             * {@link #getMessagesFromIntent(Intent)}.</p>
             *
             * <p>If a BroadcastReceiver encounters an error while processing
             * this intent it should set the result code appropriately.</p>
Scott Main's avatar
Scott Main committed
843 844 845 846 847 848
             *
             * <p class="note"><strong>Note:</strong>
             * The broadcast receiver that filters for this intent must declare
             * {@link android.Manifest.permission#BROADCAST_SMS} as a required permission in
             * the <a href="{@docRoot}guide/topics/manifest/receiver-element.html">{@code
             * &lt;receiver>}</a> tag.
849 850 851 852 853
             */
            @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION)
            public static final String SMS_DELIVER_ACTION =
                    "android.provider.Telephony.SMS_DELIVER";

Wink Saville's avatar
Wink Saville committed
854
            /**
855
             * Broadcast Action: A new text-based SMS message has been received
856 857 858
             * by the device. This intent will be delivered to all registered
             * receivers as a notification. These apps are not expected to write the
             * message or notify the user. The intent will have the following extra
Wink Saville's avatar
Wink Saville committed
859 860 861
             * values:</p>
             *
             * <ul>
Scott Main's avatar
Scott Main committed
862
             *   <li><em>"pdus"</em> - An Object[] of byte[]s containing the PDUs
Wink Saville's avatar
Wink Saville committed
863 864 865 866 867 868 869 870 871 872 873 874 875 876 877
             *   that make up the message.</li>
             * </ul>
             *
             * <p>The extra values can be extracted using
             * {@link #getMessagesFromIntent(Intent)}.</p>
             *
             * <p>If a BroadcastReceiver encounters an error while processing
             * this intent it should set the result code appropriately.</p>
             */
            @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION)
            public static final String SMS_RECEIVED_ACTION =
                    "android.provider.Telephony.SMS_RECEIVED";

            /**
             * Broadcast Action: A new data based SMS message has been received
878 879
             * by the device. This intent will be delivered to all registered
             * receivers as a notification. The intent will have the following extra
Wink Saville's avatar
Wink Saville committed
880 881 882
             * values:</p>
             *
             * <ul>
Scott Main's avatar
Scott Main committed
883
             *   <li><em>"pdus"</em> - An Object[] of byte[]s containing the PDUs
Wink Saville's avatar
Wink Saville committed
884 885 886 887 888 889 890 891 892 893 894 895 896 897 898
             *   that make up the message.</li>
             * </ul>
             *
             * <p>The extra values can be extracted using
             * {@link #getMessagesFromIntent(Intent)}.</p>
             *
             * <p>If a BroadcastReceiver encounters an error while processing
             * this intent it should set the result code appropriately.</p>
             */
            @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION)
            public static final String DATA_SMS_RECEIVED_ACTION =
                    "android.intent.action.DATA_SMS_RECEIVED";

            /**
             * Broadcast Action: A new WAP PUSH message has been received by the
899 900 901 902 903
             * device. This intent will only be delivered to the default
             * sms app. That app is responsible for writing the message and notifying
             * the user. The intent will have the following extra values:</p>
             *
             * <ul>
Scott Main's avatar
Scott Main committed
904 905 906 907 908 909
             *   <li><em>"transactionId"</em> - (Integer) The WAP transaction ID</li>
             *   <li><em>"pduType"</em> - (Integer) The WAP PDU type</li>
             *   <li><em>"header"</em> - (byte[]) The header of the message</li>
             *   <li><em>"data"</em> - (byte[]) The data payload of the message</li>
             *   <li><em>"contentTypeParameters" </em>
             *   -(HashMap&lt;String,String&gt;) Any parameters associated with the content type
910
             *   (decoded from the WSP Content-Type header)</li>
911 912 913 914 915 916
             *   <li><em>"subscription"</em> - An optional long value of the subscription id which
             *   received the message.</li>
             *   <li><em>"slot"</em> - An optional int value of the SIM slot containing the
             *   subscription.</li>
             *   <li><em>"phone"</em> - An optional int value of the phone id associated with the
             *   subscription.</li>
917 918 919 920 921 922 923 924 925 926 927
             * </ul>
             *
             * <p>If a BroadcastReceiver encounters an error while processing
             * this intent it should set the result code appropriately.</p>
             *
             * <p>The contentTypeParameters extra value is map of content parameters keyed by
             * their names.</p>
             *
             * <p>If any unassigned well-known parameters are encountered, the key of the map will
             * be 'unassigned/0x...', where '...' is the hex value of the unassigned parameter.  If
             * a parameter has No-Value the value in the map will be null.</p>
Scott Main's avatar
Scott Main committed
928 929 930 931 932 933
             *
             * <p class="note"><strong>Note:</strong>
             * The broadcast receiver that filters for this intent must declare
             * {@link android.Manifest.permission#BROADCAST_WAP_PUSH} as a required permission in
             * the <a href="{@docRoot}guide/topics/manifest/receiver-element.html">{@code
             * &lt;receiver>}</a> tag.
934 935 936 937 938 939 940 941 942 943
             */
            @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION)
            public static final String WAP_PUSH_DELIVER_ACTION =
                    "android.provider.Telephony.WAP_PUSH_DELIVER";

            /**
             * Broadcast Action: A new WAP PUSH message has been received by the
             * device. This intent will be delivered to all registered
             * receivers as a notification. These apps are not expected to write the
             * message or notify the user. The intent will have the following extra
Wink Saville's avatar
Wink Saville committed
944 945 946
             * values:</p>
             *
             * <ul>
Scott Main's avatar
Scott Main committed
947 948 949 950 951 952
             *   <li><em>"transactionId"</em> - (Integer) The WAP transaction ID</li>
             *   <li><em>"pduType"</em> - (Integer) The WAP PDU type</li>
             *   <li><em>"header"</em> - (byte[]) The header of the message</li>
             *   <li><em>"data"</em> - (byte[]) The data payload of the message</li>
             *   <li><em>"contentTypeParameters"</em>
             *   - (HashMap&lt;String,String&gt;) Any parameters associated with the content type
Wink Saville's avatar
Wink Saville committed
953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975
             *   (decoded from the WSP Content-Type header)</li>
             * </ul>
             *
             * <p>If a BroadcastReceiver encounters an error while processing
             * this intent it should set the result code appropriately.</p>
             *
             * <p>The contentTypeParameters extra value is map of content parameters keyed by
             * their names.</p>
             *
             * <p>If any unassigned well-known parameters are encountered, the key of the map will
             * be 'unassigned/0x...', where '...' is the hex value of the unassigned parameter.  If
             * a parameter has No-Value the value in the map will be null.</p>
             */
            @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION)
            public static final String WAP_PUSH_RECEIVED_ACTION =
                    "android.provider.Telephony.WAP_PUSH_RECEIVED";

            /**
             * Broadcast Action: A new Cell Broadcast message has been received
             * by the device. The intent will have the following extra
             * values:</p>
             *
             * <ul>
Scott Main's avatar
Scott Main committed
976
             *   <li><em>"message"</em> - An SmsCbMessage object containing the broadcast message
Wink Saville's avatar
Wink Saville committed
977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995
             *   data. This is not an emergency alert, so ETWS and CMAS data will be null.</li>
             * </ul>
             *
             * <p>The extra values can be extracted using
             * {@link #getMessagesFromIntent(Intent)}.</p>
             *
             * <p>If a BroadcastReceiver encounters an error while processing
             * this intent it should set the result code appropriately.</p>
             */
            @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION)
            public static final String SMS_CB_RECEIVED_ACTION =
                    "android.provider.Telephony.SMS_CB_RECEIVED";

            /**
             * Broadcast Action: A new Emergency Broadcast message has been received
             * by the device. The intent will have the following extra
             * values:</p>
             *
             * <ul>
Scott Main's avatar
Scott Main committed
996
             *   <li><em>"message"</em> - An SmsCbMessage object containing the broadcast message
Wink Saville's avatar
Wink Saville committed
997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015
             *   data, including ETWS or CMAS warning notification info if present.</li>
             * </ul>
             *
             * <p>The extra values can be extracted using
             * {@link #getMessagesFromIntent(Intent)}.</p>
             *
             * <p>If a BroadcastReceiver encounters an error while processing
             * this intent it should set the result code appropriately.</p>
             */
            @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION)
            public static final String SMS_EMERGENCY_CB_RECEIVED_ACTION =
                    "android.provider.Telephony.SMS_EMERGENCY_CB_RECEIVED";

            /**
             * Broadcast Action: A new CDMA SMS has been received containing Service Category
             * Program Data (updates the list of enabled broadcast channels). The intent will
             * have the following extra values:</p>
             *
             * <ul>
Scott Main's avatar
Scott Main committed
1016
             *   <li><em>"operations"</em> - An array of CdmaSmsCbProgramData objects containing
Wink Saville's avatar
Wink Saville committed
1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045
             *   the service category operations (add/delete/clear) to perform.</li>
             * </ul>
             *
             * <p>The extra values can be extracted using
             * {@link #getMessagesFromIntent(Intent)}.</p>
             *
             * <p>If a BroadcastReceiver encounters an error while processing
             * this intent it should set the result code appropriately.</p>
             */
            @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION)
            public static final String SMS_SERVICE_CATEGORY_PROGRAM_DATA_RECEIVED_ACTION =
                    "android.provider.Telephony.SMS_SERVICE_CATEGORY_PROGRAM_DATA_RECEIVED";

            /**
             * Broadcast Action: The SIM storage for SMS messages is full.  If
             * space is not freed, messages targeted for the SIM (class 2) may
             * not be saved.
             */
            @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION)
            public static final String SIM_FULL_ACTION =
                    "android.provider.Telephony.SIM_FULL";

            /**
             * Broadcast Action: An incoming SMS has been rejected by the
             * telephony framework.  This intent is sent in lieu of any
             * of the RECEIVED_ACTION intents.  The intent will have the
             * following extra value:</p>
             *
             * <ul>
Scott Main's avatar
Scott Main committed
1046
             *   <li><em>"result"</em> - An int result code, e.g. {@link #RESULT_SMS_OUT_OF_MEMORY}
Wink Saville's avatar
Wink Saville committed
1047 1048 1049 1050 1051 1052 1053
             *   indicating the error returned to the network.</li>
             * </ul>
             */
            @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION)
            public static final String SMS_REJECTED_ACTION =
                "android.provider.Telephony.SMS_REJECTED";

1054 1055 1056 1057 1058 1059 1060 1061 1062 1063
            /**
             * Broadcast Action: An incoming MMS has been downloaded. The intent is sent to all
             * users, except for secondary users where SMS has been disabled and to managed
             * profiles.
             * @hide
             */
            @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION)
            public static final String MMS_DOWNLOADED_ACTION =
                "android.provider.Telephony.MMS_DOWNLOADED";

Wink Saville's avatar
Wink Saville committed
1064 1065 1066 1067 1068 1069 1070
            /**
             * Read the PDUs out of an {@link #SMS_RECEIVED_ACTION} or a
             * {@link #DATA_SMS_RECEIVED_ACTION} intent.
             *
             * @param intent the intent to read from
             * @return an array of SmsMessages for the PDUs
             */
1071
            public static SmsMessage[] getMessagesFromIntent(Intent intent) {
Wink Saville's avatar
Wink Saville committed
1072 1073
                Object[] messages = (Object[]) intent.getSerializableExtra("pdus");
                String format = intent.getStringExtra("format");
Wink Saville's avatar
Wink Saville committed
1074
                int subId = intent.getIntExtra(PhoneConstants.SUBSCRIPTION_KEY,
1075
                        SubscriptionManager.getDefaultSmsSubId());
Wink Saville's avatar
Wink Saville committed
1076 1077

                Rlog.v(TAG, " getMessagesFromIntent sub_id : " + subId);
Wink Saville's avatar
Wink Saville committed
1078

1079
                int pduCount = messages.length;
Wink Saville's avatar
Wink Saville committed
1080
                SmsMessage[] msgs = new SmsMessage[pduCount];
1081

Wink Saville's avatar
Wink Saville committed
1082
                for (int i = 0; i < pduCount; i++) {
1083 1084
                    byte[] pdu = (byte[]) messages[i];
                    msgs[i] = SmsMessage.createFromPdu(pdu, format);
Wink Saville's avatar
Wink Saville committed
1085
                    msgs[i].setSubId(subId);
Wink Saville's avatar
Wink Saville committed
1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096
                }
                return msgs;
            }
        }
    }

    /**
     * Base columns for tables that contain MMSs.
     */
    public interface BaseMmsColumns extends BaseColumns {

1097
        /** Message box: all messages. */
Wink Saville's avatar
Wink Saville committed
1098
        public static final int MESSAGE_BOX_ALL    = 0;
1099
        /** Message box: inbox. */
Wink Saville's avatar
Wink Saville committed
1100
        public static final int MESSAGE_BOX_INBOX  = 1;
1101
        /** Message box: sent messages. */
Wink Saville's avatar
Wink Saville committed
1102
        public static final int MESSAGE_BOX_SENT   = 2;
1103
        /** Message box: drafts. */
Wink Saville's avatar
Wink Saville committed
1104
        public static final int MESSAGE_BOX_DRAFTS = 3;
1105
        /** Message box: outbox. */
Wink Saville's avatar
Wink Saville committed
1106
        public static final int MESSAGE_BOX_OUTBOX = 4;
Ye Wen's avatar
Ye Wen committed
1107 1108
        /** Message box: failed. */
        public static final int MESSAGE_BOX_FAILED = 5;
Wink Saville's avatar
Wink Saville committed
1109

1110 1111 1112 1113 1114 1115
        /**
         * The thread ID of the message.
         * <P>Type: INTEGER (long)</P>
         */
        public static final String THREAD_ID = "thread_id";

Wink Saville's avatar
Wink Saville committed
1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128
        /**
         * The date the message was received.
         * <P>Type: INTEGER (long)</P>
         */
        public static final String DATE = "date";

        /**
         * The date the message was sent.
         * <P>Type: INTEGER (long)</P>
         */
        public static final String DATE_SENT = "date_sent";

        /**
1129
         * The box which the message belongs to, e.g. {@link #MESSAGE_BOX_INBOX}.
Wink Saville's avatar
Wink Saville committed
1130 1131 1132 1133 1134
         * <P>Type: INTEGER</P>
         */
        public static final String MESSAGE_BOX = "msg_box";

        /**
1135
         * Has the message been read?
Wink Saville's avatar
Wink Saville committed
1136 1137 1138 1139 1140
         * <P>Type: INTEGER (boolean)</P>
         */
        public static final String READ = "read";

        /**
1141 1142 1143
         * Has the message been seen by the user? The "seen" flag determines
         * whether we need to show a new message notification.
         * <P>Type: INTEGER (boolean)</P>
Wink Saville's avatar
Wink Saville committed
1144 1145 1146
         */
        public static final String SEEN = "seen";

Tom Taylor's avatar
Tom Taylor committed
1147
        /**
1148 1149 1150
         * Does the message have only a text part (can also have a subject) with
         * no picture, slideshow, sound, etc. parts?
         * <P>Type: INTEGER (boolean)</P>
Tom Taylor's avatar
Tom Taylor committed
1151 1152 1153
         */
        public static final String TEXT_ONLY = "text_only";

Wink Saville's avatar
Wink Saville committed
1154
        /**
1155
         * The {@code Message-ID} of the message.
Wink Saville's avatar
Wink Saville committed
1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172
         * <P>Type: TEXT</P>
         */
        public static final String MESSAGE_ID = "m_id";

        /**
         * The subject of the message, if present.
         * <P>Type: TEXT</P>
         */
        public static final String SUBJECT = "sub";

        /**
         * The character set of the subject, if present.
         * <P>Type: INTEGER</P>
         */
        public static final String SUBJECT_CHARSET = "sub_cs";

        /**
1173
         * The {@code Content-Type} of the message.
Wink Saville's avatar
Wink Saville committed
1174 1175 1176 1177 1178
         * <P>Type: TEXT</P>
         */
        public static final String CONTENT_TYPE = "ct_t";

        /**
1179
         * The {@code Content-Location} of the message.
Wink Saville's avatar
Wink Saville committed
1180 1181 1182 1183 1184 1185
         * <P>Type: TEXT</P>
         */
        public static final String CONTENT_LOCATION = "ct_l";

        /**
         * The expiry time of the message.
1186
         * <P>Type: INTEGER (long)</P>
Wink Saville's avatar
Wink Saville committed
1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202
         */
        public static final String EXPIRY = "exp";

        /**
         * The class of the message.
         * <P>Type: TEXT</P>
         */
        public static final String MESSAGE_CLASS = "m_cls";

        /**
         * The type of the message defined by MMS spec.
         * <P>Type: INTEGER</P>
         */
        public static final String MESSAGE_TYPE = "m_type";

        /**
1203
         * The version of the specification that this message conforms to.
Wink Saville's avatar
Wink Saville committed
1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215
         * <P>Type: INTEGER</P>
         */
        public static final String MMS_VERSION = "v";

        /**
         * The size of the message.
         * <P>Type: INTEGER</P>
         */
        public static final String MESSAGE_SIZE = "m_size";

        /**
         * The priority of the message.
1216
         * <P>Type: INTEGER</P>
Wink Saville's avatar
Wink Saville committed
1217 1218 1219 1220
         */
        public static final String PRIORITY = "pri";

        /**
1221 1222
         * The {@code read-report} of the message.
         * <P>Type: INTEGER (boolean)</P>
Wink Saville's avatar
Wink Saville committed
1223 1224 1225 1226
         */
        public static final String READ_REPORT = "rr";

        /**
1227 1228
         * Is read report allowed?
         * <P>Type: INTEGER (boolean)</P>
Wink Saville's avatar
Wink Saville committed
1229 1230 1231 1232
         */
        public static final String REPORT_ALLOWED = "rpt_a";

        /**
1233
         * The {@code response-status} of the message.
Wink Saville's avatar
Wink Saville committed
1234 1235 1236 1237 1238
         * <P>Type: INTEGER</P>
         */
        public static final String RESPONSE_STATUS = "resp_st";

        /**
1239
         * The {@code status} of the message.
Wink Saville's avatar
Wink Saville committed
1240 1241 1242 1243 1244
         * <P>Type: INTEGER</P>
         */
        public static final String STATUS = "st";

        /**
1245
         * The {@code transaction-id} of the message.
Wink Saville's avatar
Wink Saville committed
1246 1247 1248 1249 1250
         * <P>Type: TEXT</P>
         */
        public static final String TRANSACTION_ID = "tr_id";

        /**
1251
         * The {@code retrieve-status} of the message.
Wink Saville's avatar
Wink Saville committed
1252 1253 1254 1255 1256
         * <P>Type: INTEGER</P>
         */
        public static final String RETRIEVE_STATUS = "retr_st";

        /**
1257
         * The {@code retrieve-text} of the message.
Wink Saville's avatar
Wink Saville committed
1258 1259 1260 1261 1262 1263
         * <P>Type: TEXT</P>
         */
        public static final String RETRIEVE_TEXT = "retr_txt";

        /**
         * The character set of the retrieve-text.
1264
         * <P>Type: INTEGER</P>
Wink Saville's avatar
Wink Saville committed
1265 1266 1267 1268
         */
        public static final String RETRIEVE_TEXT_CHARSET = "retr_txt_cs";

        /**
1269
         * The {@code read-status} of the message.
Wink Saville's avatar
Wink Saville committed
1270 1271 1272 1273 1274
         * <P>Type: INTEGER</P>
         */
        public static final String READ_STATUS = "read_status";

        /**
1275
         * The {@code content-class} of the message.
Wink Saville's avatar
Wink Saville committed
1276 1277 1278 1279 1280
         * <P>Type: INTEGER</P>
         */
        public static final String CONTENT_CLASS = "ct_cls";

        /**
1281
         * The {@code delivery-report} of the message.
Wink Saville's avatar
Wink Saville committed
1282 1283 1284 1285 1286
         * <P>Type: INTEGER</P>
         */
        public static final String DELIVERY_REPORT = "d_rpt";

        /**
1287
         * The {@code delivery-time-token} of the message.
Wink Saville's avatar
Wink Saville committed
1288
         * <P>Type: INTEGER</P>
1289 1290
         * @deprecated this column is no longer supported.
         * @hide
Wink Saville's avatar
Wink Saville committed
1291
         */
1292
        @Deprecated
Wink Saville's avatar
Wink Saville committed
1293 1294 1295
        public static final String DELIVERY_TIME_TOKEN = "d_tm_tok";

        /**
1296
         * The {@code delivery-time} of the message.
Wink Saville's avatar
Wink Saville committed
1297 1298 1299 1300 1301
         * <P>Type: INTEGER</P>
         */
        public static final String DELIVERY_TIME = "d_tm";

        /**
1302
         * The {@code response-text} of the message.
Wink Saville's avatar
Wink Saville committed
1303 1304 1305 1306 1307
         * <P>Type: TEXT</P>
         */
        public static final String RESPONSE_TEXT = "resp_txt";

        /**
1308
         * The {@code sender-visibility} of the message.
Wink Saville's avatar
Wink Saville committed
1309
         * <P>Type: TEXT</P>
1310 1311
         * @deprecated this column is no longer supported.
         * @hide
Wink Saville's avatar
Wink Saville committed
1312
         */
1313
        @Deprecated
Wink Saville's avatar
Wink Saville committed
1314 1315 1316
        public static final String SENDER_VISIBILITY = "s_vis";

        /**
1317
         * The {@code reply-charging} of the message.
Wink Saville's avatar
Wink Saville committed
1318
         * <P>Type: INTEGER</P>
1319 1320
         * @deprecated this column is no longer supported.
         * @hide
Wink Saville's avatar
Wink Saville committed
1321
         */
1322
        @Deprecated
Wink Saville's avatar
Wink Saville committed
1323 1324 1325
        public static final String REPLY_CHARGING = "r_chg";

        /**
1326
         * The {@code reply-charging-deadline-token} of the message.
Wink Saville's avatar
Wink Saville committed
1327
         * <P>Type: INTEGER</P>
1328 1329
         * @deprecated this column is no longer supported.
         * @hide
Wink Saville's avatar
Wink Saville committed
1330
         */
1331
        @Deprecated
Wink Saville's avatar
Wink Saville committed
1332 1333 1334
        public static final String REPLY_CHARGING_DEADLINE_TOKEN = "r_chg_dl_tok";

        /**
1335
         * The {@code reply-charging-deadline} of the message.
Wink Saville's avatar
Wink Saville committed
1336
         * <P>Type: INTEGER</P>
1337 1338
         * @deprecated this column is no longer supported.
         * @hide
Wink Saville's avatar
Wink Saville committed
1339
         */
1340
        @Deprecated
Wink Saville's avatar
Wink Saville committed
1341 1342 1343
        public static final String REPLY_CHARGING_DEADLINE = "r_chg_dl";

        /**
1344
         * The {@code reply-charging-id} of the message.
Wink Saville's avatar
Wink Saville committed
1345
         * <P>Type: TEXT</P>
1346 1347
         * @deprecated this column is no longer supported.
         * @hide
Wink Saville's avatar
Wink Saville committed
1348
         */
1349
        @Deprecated
Wink Saville's avatar
Wink Saville committed
1350 1351 1352
        public static final String REPLY_CHARGING_ID = "r_chg_id";

        /**
1353
         * The {@code reply-charging-size} of the message.
Wink Saville's avatar
Wink Saville committed
1354
         * <P>Type: INTEGER</P>
1355 1356
         * @deprecated this column is no longer supported.
         * @hide
Wink Saville's avatar
Wink Saville committed
1357
         */
1358
        @Deprecated
Wink Saville's avatar
Wink Saville committed
1359 1360 1361
        public static final String REPLY_CHARGING_SIZE = "r_chg_sz";

        /**
1362
         * The {@code previously-sent-by} of the message.
Wink Saville's avatar
Wink Saville committed
1363
         * <P>Type: TEXT</P>
1364 1365
         * @deprecated this column is no longer supported.
         * @hide
Wink Saville's avatar
Wink Saville committed
1366
         */
1367
        @Deprecated
Wink Saville's avatar
Wink Saville committed
1368 1369 1370
        public static final String PREVIOUSLY_SENT_BY = "p_s_by";

        /**
1371
         * The {@code previously-sent-date} of the message.
Wink Saville's avatar
Wink Saville committed
1372
         * <P>Type: INTEGER</P>
1373 1374
         * @deprecated this column is no longer supported.
         * @hide
Wink Saville's avatar
Wink Saville committed
1375
         */
1376
        @Deprecated
Wink Saville's avatar
Wink Saville committed
1377 1378 1379
        public static final String PREVIOUSLY_SENT_DATE = "p_s_d";

        /**
1380
         * The {@code store} of the message.
Wink Saville's avatar
Wink Saville committed
1381
         * <P>Type: TEXT</P>
1382 1383
         * @deprecated this column is no longer supported.
         * @hide
Wink Saville's avatar
Wink Saville committed
1384
         */
1385
        @Deprecated
Wink Saville's avatar
Wink Saville committed
1386 1387 1388
        public static final String STORE = "store";

        /**
1389
         * The {@code mm-state} of the message.
Wink Saville's avatar
Wink Saville committed
1390
         * <P>Type: INTEGER</P>
1391 1392
         * @deprecated this column is no longer supported.
         * @hide
Wink Saville's avatar
Wink Saville committed
1393
         */
1394
        @Deprecated
Wink Saville's avatar
Wink Saville committed
1395 1396 1397
        public static final String MM_STATE = "mm_st";

        /**
1398
         * The {@code mm-flags-token} of the message.
Wink Saville's avatar
Wink Saville committed
1399
         * <P>Type: INTEGER</P>
1400 1401
         * @deprecated this column is no longer supported.
         * @hide
Wink Saville's avatar
Wink Saville committed
1402
         */
1403
        @Deprecated
Wink Saville's avatar
Wink Saville committed
1404 1405 1406
        public static final String MM_FLAGS_TOKEN = "mm_flg_tok";

        /**
1407
         * The {@code mm-flags} of the message.
Wink Saville's avatar
Wink Saville committed
1408
         * <P>Type: TEXT</P>
1409 1410
         * @deprecated this column is no longer supported.
         * @hide
Wink Saville's avatar
Wink Saville committed
1411
         */
1412
        @Deprecated
Wink Saville's avatar
Wink Saville committed
1413 1414 1415
        public static final String MM_FLAGS = "mm_flg";

        /**
1416
         * The {@code store-status} of the message.
Wink Saville's avatar
Wink Saville committed
1417
         * <P>Type: TEXT</P>
1418 1419
         * @deprecated this column is no longer supported.
         * @hide
Wink Saville's avatar
Wink Saville committed
1420
         */
1421
        @Deprecated
Wink Saville's avatar
Wink Saville committed
1422 1423 1424
        public static final String STORE_STATUS = "store_st";

        /**
1425
         * The {@code store-status-text} of the message.
Wink Saville's avatar
Wink Saville committed
1426
         * <P>Type: TEXT</P>
1427 1428
         * @deprecated this column is no longer supported.
         * @hide
Wink Saville's avatar
Wink Saville committed
1429
         */
1430
        @Deprecated
Wink Saville's avatar
Wink Saville committed
1431 1432 1433
        public static final String STORE_STATUS_TEXT = "store_st_txt";

        /**
1434
         * The {@code stored} of the message.
Wink Saville's avatar
Wink Saville committed
1435
         * <P>Type: TEXT</P>
1436 1437
         * @deprecated this column is no longer supported.
         * @hide
Wink Saville's avatar
Wink Saville committed
1438
         */
1439
        @Deprecated
Wink Saville's avatar
Wink Saville committed
1440 1441 1442
        public static final String STORED = "stored";

        /**
1443
         * The {@code totals} of the message.
Wink Saville's avatar
Wink Saville committed
1444
         * <P>Type: TEXT</P>
1445 1446
         * @deprecated this column is no longer supported.
         * @hide
Wink Saville's avatar
Wink Saville committed
1447
         */
1448
        @Deprecated
Wink Saville's avatar
Wink Saville committed
1449 1450 1451
        public static final String TOTALS = "totals";

        /**
1452
         * The {@code mbox-totals} of the message.
Wink Saville's avatar
Wink Saville committed
1453
         * <P>Type: TEXT</P>
1454 1455
         * @deprecated this column is no longer supported.
         * @hide
Wink Saville's avatar
Wink Saville committed
1456
         */
1457
        @Deprecated
Wink Saville's avatar
Wink Saville committed
1458 1459 1460
        public static final String MBOX_TOTALS = "mb_t";

        /**
1461
         * The {@code mbox-totals-token} of the message.
Wink Saville's avatar
Wink Saville committed
1462
         * <P>Type: INTEGER</P>
1463 1464
         * @deprecated this column is no longer supported.
         * @hide
Wink Saville's avatar
Wink Saville committed
1465
         */
1466
        @Deprecated
Wink Saville's avatar
Wink Saville committed
1467 1468 1469
        public static final String MBOX_TOTALS_TOKEN = "mb_t_tok";

        /**
1470
         * The {@code quotas} of the message.
Wink Saville's avatar
Wink Saville committed
1471
         * <P>Type: TEXT</P>
1472 1473
         * @deprecated this column is no longer supported.
         * @hide
Wink Saville's avatar
Wink Saville committed
1474
         */
1475
        @Deprecated
Wink Saville's avatar
Wink Saville committed
1476 1477 1478
        public static final String QUOTAS = "qt";

        /**
1479
         * The {@code mbox-quotas} of the message.
Wink Saville's avatar
Wink Saville committed
1480
         * <P>Type: TEXT</P>
1481 1482
         * @deprecated this column is no longer supported.
         * @hide
Wink Saville's avatar
Wink Saville committed
1483
         */
1484
        @Deprecated
Wink Saville's avatar
Wink Saville committed
1485 1486 1487
        public static final String MBOX_QUOTAS = "mb_qt";

        /**
1488
         * The {@code mbox-quotas-token} of the message.
Wink Saville's avatar
Wink Saville committed
1489
         * <P>Type: INTEGER</P>
1490 1491
         * @deprecated this column is no longer supported.
         * @hide
Wink Saville's avatar
Wink Saville committed
1492
         */
1493
        @Deprecated
Wink Saville's avatar
Wink Saville committed
1494 1495 1496
        public static final String MBOX_QUOTAS_TOKEN = "mb_qt_tok";

        /**
1497
         * The {@code message-count} of the message.
Wink Saville's avatar
Wink Saville committed
1498
         * <P>Type: INTEGER</P>
1499 1500
         * @deprecated this column is no longer supported.
         * @hide
Wink Saville's avatar
Wink Saville committed
1501
         */
1502
        @Deprecated
Wink Saville's avatar
Wink Saville committed
1503 1504 1505
        public static final String MESSAGE_COUNT = "m_cnt";

        /**
1506
         * The {@code start} of the message.
Wink Saville's avatar
Wink Saville committed
1507
         * <P>Type: INTEGER</P>
1508 1509
         * @deprecated this column is no longer supported.
         * @hide
Wink Saville's avatar
Wink Saville committed
1510
         */
1511
        @Deprecated
Wink Saville's avatar
Wink Saville committed
1512 1513 1514
        public static final String START = "start";

        /**
1515
         * The {@code distribution-indicator} of the message.
Wink Saville's avatar
Wink Saville committed
1516
         * <P>Type: TEXT</P>
1517 1518
         * @deprecated this column is no longer supported.
         * @hide
Wink Saville's avatar
Wink Saville committed
1519
         */
1520
        @Deprecated
Wink Saville's avatar
Wink Saville committed
1521 1522 1523
        public static final String DISTRIBUTION_INDICATOR = "d_ind";

        /**
1524
         * The {@code element-descriptor} of the message.
Wink Saville's avatar
Wink Saville committed
1525
         * <P>Type: TEXT</P>
1526 1527
         * @deprecated this column is no longer supported.
         * @hide
Wink Saville's avatar
Wink Saville committed
1528
         */
1529
        @Deprecated
Wink Saville's avatar
Wink Saville committed
1530 1531 1532
        public static final String ELEMENT_DESCRIPTOR = "e_des";

        /**
1533
         * The {@code limit} of the message.
Wink Saville's avatar
Wink Saville committed
1534
         * <P>Type: INTEGER</P>
1535 1536
         * @deprecated this column is no longer supported.
         * @hide
Wink Saville's avatar
Wink Saville committed
1537
         */
1538
        @Deprecated
Wink Saville's avatar
Wink Saville committed
1539 1540 1541
        public static final String LIMIT = "limit";

        /**
1542
         * The {@code recommended-retrieval-mode} of the message.
Wink Saville's avatar
Wink Saville committed
1543
         * <P>Type: INTEGER</P>
1544 1545
         * @deprecated this column is no longer supported.
         * @hide
Wink Saville's avatar
Wink Saville committed
1546
         */
1547
        @Deprecated
Wink Saville's avatar
Wink Saville committed
1548 1549 1550
        public static final String RECOMMENDED_RETRIEVAL_MODE = "r_r_mod";

        /**
1551
         * The {@code recommended-retrieval-mode-text} of the message.
Wink Saville's avatar
Wink Saville committed
1552
         * <P>Type: TEXT</P>
1553 1554
         * @deprecated this column is no longer supported.
         * @hide
Wink Saville's avatar
Wink Saville committed
1555
         */
1556
        @Deprecated
Wink Saville's avatar
Wink Saville committed
1557 1558 1559
        public static final String RECOMMENDED_RETRIEVAL_MODE_TEXT = "r_r_mod_txt";

        /**
1560
         * The {@code status-text} of the message.
Wink Saville's avatar
Wink Saville committed
1561
         * <P>Type: TEXT</P>
1562 1563
         * @deprecated this column is no longer supported.
         * @hide
Wink Saville's avatar
Wink Saville committed
1564
         */
1565
        @Deprecated
Wink Saville's avatar
Wink Saville committed
1566 1567 1568
        public static final String STATUS_TEXT = "st_txt";

        /**
1569
         * The {@code applic-id} of the message.
Wink Saville's avatar
Wink Saville committed
1570
         * <P>Type: TEXT</P>
1571 1572
         * @deprecated this column is no longer supported.
         * @hide
Wink Saville's avatar
Wink Saville committed
1573
         */
1574
        @Deprecated
Wink Saville's avatar
Wink Saville committed
1575 1576 1577
        public static final String APPLIC_ID = "apl_id";

        /**
1578
         * The {@code reply-applic-id} of the message.
Wink Saville's avatar
Wink Saville committed
1579
         * <P>Type: TEXT</P>
1580 1581
         * @deprecated this column is no longer supported.
         * @hide
Wink Saville's avatar
Wink Saville committed
1582
         */
1583
        @Deprecated
Wink Saville's avatar
Wink Saville committed
1584 1585 1586
        public static final String REPLY_APPLIC_ID = "r_apl_id";

        /**
1587
         * The {@code aux-applic-id} of the message.
Wink Saville's avatar
Wink Saville committed
1588
         * <P>Type: TEXT</P>
1589 1590
         * @deprecated this column is no longer supported.
         * @hide
Wink Saville's avatar
Wink Saville committed
1591
         */
1592
        @Deprecated
Wink Saville's avatar
Wink Saville committed
1593 1594 1595
        public static final String AUX_APPLIC_ID = "aux_apl_id";

        /**
1596
         * The {@code drm-content} of the message.
Wink Saville's avatar
Wink Saville committed
1597
         * <P>Type: TEXT</P>
1598 1599
         * @deprecated this column is no longer supported.
         * @hide
Wink Saville's avatar
Wink Saville committed
1600
         */
1601
        @Deprecated
Wink Saville's avatar
Wink Saville committed
1602 1603 1604
        public static final String DRM_CONTENT = "drm_c";

        /**
1605
         * The {@code adaptation-allowed} of the message.
Wink Saville's avatar
Wink Saville committed
1606
         * <P>Type: TEXT</P>
1607 1608
         * @deprecated this column is no longer supported.
         * @hide
Wink Saville's avatar
Wink Saville committed
1609
         */
1610
        @Deprecated
Wink Saville's avatar
Wink Saville committed
1611 1612 1613
        public static final String ADAPTATION_ALLOWED = "adp_a";

        /**
1614
         * The {@code replace-id} of the message.
Wink Saville's avatar
Wink Saville committed
1615
         * <P>Type: TEXT</P>
1616 1617
         * @deprecated this column is no longer supported.
         * @hide
Wink Saville's avatar
Wink Saville committed
1618
         */
1619
        @Deprecated
Wink Saville's avatar
Wink Saville committed
1620 1621 1622
        public static final String REPLACE_ID = "repl_id";

        /**
1623
         * The {@code cancel-id} of the message.
Wink Saville's avatar
Wink Saville committed
1624
         * <P>Type: TEXT</P>
1625 1626
         * @deprecated this column is no longer supported.
         * @hide
Wink Saville's avatar
Wink Saville committed
1627
         */
1628
        @Deprecated
Wink Saville's avatar
Wink Saville committed
1629 1630 1631
        public static final String CANCEL_ID = "cl_id";

        /**
1632
         * The {@code cancel-status} of the message.
Wink Saville's avatar
Wink Saville committed
1633
         * <P>Type: INTEGER</P>
1634 1635
         * @deprecated this column is no longer supported.
         * @hide
Wink Saville's avatar
Wink Saville committed
1636
         */
1637
        @Deprecated
Wink Saville's avatar
Wink Saville committed
1638 1639 1640
        public static final String CANCEL_STATUS = "cl_st";

        /**
1641
         * Is the message locked?
Wink Saville's avatar
Wink Saville committed
1642 1643 1644
         * <P>Type: INTEGER (boolean)</P>
         */
        public static final String LOCKED = "locked";
Wink Saville's avatar
Wink Saville committed
1645 1646

        /**
1647
         * The subscription to which the message belongs to. Its value will be
1648
         * < 0 if the sub id cannot be determined.
1649
         * <p>Type: INTEGER (long)</p>
Wink Saville's avatar
Wink Saville committed
1650
         */
1651
        public static final String SUBSCRIPTION_ID = "sub_id";
Wink Saville's avatar
Wink Saville committed
1652

1653
        /**
1654 1655
         * The identity of the sender of a sent message. It is
         * usually the package name of the app which sends the message.
1656 1657
         * <p class="note"><strong>Note:</strong>
         * This column is read-only. It is set by the provider and can not be changed by apps.
1658
         * <p>Type: TEXT</p>
1659 1660
         */
        public static final String CREATOR = "creator";
Wink Saville's avatar
Wink Saville committed
1661 1662 1663
    }

    /**
1664
     * Columns for the "canonical_addresses" table used by MMS and SMS.
Wink Saville's avatar
Wink Saville committed
1665 1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 1680
     */
    public interface CanonicalAddressesColumns extends BaseColumns {
        /**
         * An address used in MMS or SMS.  Email addresses are
         * converted to lower case and are compared by string
         * equality.  Other addresses are compared using
         * PHONE_NUMBERS_EQUAL.
         * <P>Type: TEXT</P>
         */
        public static final String ADDRESS = "address";
    }

    /**
     * Columns for the "threads" table used by MMS and SMS.
     */
    public interface ThreadsColumns extends BaseColumns {
1681

Wink Saville's avatar
Wink Saville committed
1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 1692 1693 1694 1695 1696 1697 1698 1699
        /**
         * The date at which the thread was created.
         * <P>Type: INTEGER (long)</P>
         */
        public static final String DATE = "date";

        /**
         * A string encoding of the recipient IDs of the recipients of
         * the message, in numerical order and separated by spaces.
         * <P>Type: TEXT</P>
         */
        public static final String RECIPIENT_IDS = "recipient_ids";

        /**
         * The message count of the thread.
         * <P>Type: INTEGER</P>
         */
        public static final String MESSAGE_COUNT = "message_count";
1700

Wink Saville's avatar
Wink Saville committed
1701 1702 1703 1704 1705 1706 1707 1708 1709 1710 1711
        /**
         * Indicates whether all messages of the thread have been read.
         * <P>Type: INTEGER</P>
         */
        public static final String READ = "read";

        /**
         * The snippet of the latest message in the thread.
         * <P>Type: TEXT</P>
         */
        public static final String SNIPPET = "snippet";
1712

Wink Saville's avatar
Wink Saville committed
1713 1714 1715 1716 1717
        /**
         * The charset of the snippet.
         * <P>Type: INTEGER</P>
         */
        public static final String SNIPPET_CHARSET = "snippet_cs";
1718

Wink Saville's avatar
Wink Saville committed
1719
        /**
1720 1721
         * Type of the thread, either {@link Threads#COMMON_THREAD} or
         * {@link Threads#BROADCAST_THREAD}.
Wink Saville's avatar
Wink Saville committed
1722 1723 1724
         * <P>Type: INTEGER</P>
         */
        public static final String TYPE = "type";
1725

Wink Saville's avatar
Wink Saville committed
1726 1727 1728 1729 1730
        /**
         * Indicates whether there is a transmission error in the thread.
         * <P>Type: INTEGER</P>
         */
        public static final String ERROR = "error";
1731

Wink Saville's avatar
Wink Saville committed
1732 1733 1734 1735 1736
        /**
         * Indicates whether this thread contains any attachments.
         * <P>Type: INTEGER</P>
         */
        public static final String HAS_ATTACHMENT = "has_attachment";
1737 1738 1739

        /**
         * If the thread is archived
1740
         * <P>Type: INTEGER (boolean)</P>
1741 1742
         */
        public static final String ARCHIVED = "archived";
Wink Saville's avatar
Wink Saville committed
1743 1744 1745 1746 1747 1748
    }

    /**
     * Helper functions for the "threads" table used by MMS and SMS.
     */
    public static final class Threads implements ThreadsColumns {
1749

Wink Saville's avatar
Wink Saville committed
1750
        private static final String[] ID_PROJECTION = { BaseColumns._ID };
1751 1752 1753 1754 1755

        /**
         * Private {@code content://} style URL for this table. Used by
         * {@link #getOrCreateThreadId(android.content.Context, java.util.Set)}.
         */
Wink Saville's avatar
Wink Saville committed
1756 1757
        private static final Uri THREAD_ID_CONTENT_URI = Uri.parse(
                "content://mms-sms/threadID");
1758 1759 1760 1761

        /**
         * The {@code content://} style URL for this table, by conversation.
         */
Wink Saville's avatar
Wink Saville committed
1762 1763
        public static final Uri CONTENT_URI = Uri.withAppendedPath(
                MmsSms.CONTENT_URI, "conversations");
1764 1765 1766 1767

        /**
         * The {@code content://} style URL for this table, for obsolete threads.
         */
Wink Saville's avatar
Wink Saville committed
1768 1769 1770
        public static final Uri OBSOLETE_THREADS_URI = Uri.withAppendedPath(
                CONTENT_URI, "obsolete");

1771
        /** Thread type: common thread. */
Wink Saville's avatar
Wink Saville committed
1772
        public static final int COMMON_THREAD    = 0;
1773 1774

        /** Thread type: broadcast thread. */
Wink Saville's avatar
Wink Saville committed
1775 1776
        public static final int BROADCAST_THREAD = 1;

1777 1778 1779 1780
        /**
         * Not instantiable.
         * @hide
         */
Wink Saville's avatar
Wink Saville committed
1781 1782 1783 1784
        private Threads() {
        }

        /**
1785 1786 1787 1788
         * This is a single-recipient version of {@code getOrCreateThreadId}.
         * It's convenient for use with SMS messages.
         * @param context the context object to use.
         * @param recipient the recipient to send to.
Wink Saville's avatar
Wink Saville committed
1789 1790 1791 1792 1793 1794 1795 1796 1797 1798 1799 1800 1801 1802
         */
        public static long getOrCreateThreadId(Context context, String recipient) {
            Set<String> recipients = new HashSet<String>();

            recipients.add(recipient);
            return getOrCreateThreadId(context, recipients);
        }

        /**
         * Given the recipients list and subject of an unsaved message,
         * return its thread ID.  If the message starts a new thread,
         * allocate a new thread ID.  Otherwise, use the appropriate
         * existing thread ID.
         *
1803 1804 1805
         * <p>Find the thread ID of the same set of recipients (in any order,
         * without any additions). If one is found, return it. Otherwise,
         * return a unique thread ID.</p>
Wink Saville's avatar
Wink Saville committed
1806 1807 1808 1809 1810 1811 1812 1813 1814 1815 1816 1817 1818 1819
         */
        public static long getOrCreateThreadId(
                Context context, Set<String> recipients) {
            Uri.Builder uriBuilder = THREAD_ID_CONTENT_URI.buildUpon();

            for (String recipient : recipients) {
                if (Mms.isEmailAddress(recipient)) {
                    recipient = Mms.extractAddrSpec(recipient);
                }

                uriBuilder.appendQueryParameter("recipient", recipient);
            }

            Uri uri = uriBuilder.build();
Wink Saville's avatar
Wink Saville committed
1820
            //if (DEBUG) Rlog.v(TAG, "getOrCreateThreadId uri: " + uri);
Wink Saville's avatar
Wink Saville committed
1821 1822 1823 1824 1825 1826 1827 1828

            Cursor cursor = SqliteWrapper.query(context, context.getContentResolver(),
                    uri, ID_PROJECTION, null, null, null);
            if (cursor != null) {
                try {
                    if (cursor.moveToFirst()) {
                        return cursor.getLong(0);
                    } else {
Wink Saville's avatar
Wink Saville committed
1829
                        Rlog.e(TAG, "getOrCreateThreadId returned no rows!");
Wink Saville's avatar
Wink Saville committed
1830 1831 1832 1833 1834 1835
                    }
                } finally {
                    cursor.close();
                }
            }

1836
            Rlog.e(TAG, "getOrCreateThreadId failed with " + recipients.size() + " recipients");
Wink Saville's avatar
Wink Saville committed
1837 1838 1839 1840 1841 1842 1843 1844
            throw new IllegalArgumentException("Unable to find or allocate a thread ID.");
        }
    }

    /**
     * Contains all MMS messages.
     */
    public static final class Mms implements BaseMmsColumns {
1845

Wink Saville's avatar
Wink Saville committed
1846
        /**
1847 1848 1849 1850 1851 1852 1853 1854
         * Not instantiable.
         * @hide
         */
        private Mms() {
        }

        /**
         * The {@code content://} URI for this table.
Wink Saville's avatar
Wink Saville committed
1855 1856 1857
         */
        public static final Uri CONTENT_URI = Uri.parse("content://mms");

1858 1859 1860
        /**
         * Content URI for getting MMS report requests.
         */
Wink Saville's avatar
Wink Saville committed
1861 1862 1863
        public static final Uri REPORT_REQUEST_URI = Uri.withAppendedPath(
                                            CONTENT_URI, "report-request");

1864 1865 1866
        /**
         * Content URI for getting MMS report status.
         */
Wink Saville's avatar
Wink Saville committed
1867 1868 1869 1870
        public static final Uri REPORT_STATUS_URI = Uri.withAppendedPath(
                                            CONTENT_URI, "report-status");

        /**
1871
         * The default sort order for this table.
Wink Saville's avatar
Wink Saville committed
1872 1873 1874 1875
         */
        public static final String DEFAULT_SORT_ORDER = "date DESC";

        /**
1876 1877 1878 1879 1880 1881 1882
         * Regex pattern for names and email addresses.
         * <ul>
         *     <li><em>mailbox</em> = {@code name-addr}</li>
         *     <li><em>name-addr</em> = {@code [display-name] angle-addr}</li>
         *     <li><em>angle-addr</em> = {@code [CFWS] "<" addr-spec ">" [CFWS]}</li>
         * </ul>
         * @hide
Wink Saville's avatar
Wink Saville committed
1883 1884 1885 1886 1887
         */
        public static final Pattern NAME_ADDR_EMAIL_PATTERN =
                Pattern.compile("\\s*(\"[^\"]*\"|[^<>\"]+)\\s*<([^<>]+)>\\s*");

        /**
1888 1889
         * Helper method to query this table.
         * @hide
Wink Saville's avatar
Wink Saville committed
1890
         */
1891
        public static Cursor query(
Wink Saville's avatar
Wink Saville committed
1892 1893 1894 1895
                ContentResolver cr, String[] projection) {
            return cr.query(CONTENT_URI, projection, null, null, DEFAULT_SORT_ORDER);
        }

1896 1897 1898 1899 1900
        /**
         * Helper method to query this table.
         * @hide
         */
        public static Cursor query(
Wink Saville's avatar
Wink Saville committed
1901 1902 1903 1904 1905 1906
                ContentResolver cr, String[] projection,
                String where, String orderBy) {
            return cr.query(CONTENT_URI, projection,
                    where, null, orderBy == null ? DEFAULT_SORT_ORDER : orderBy);
        }

1907 1908 1909 1910
        /**
         * Helper method to extract email address from address string.
         * @hide
         */
Wink Saville's avatar
Wink Saville committed
1911 1912 1913 1914 1915 1916 1917 1918 1919 1920
        public static String extractAddrSpec(String address) {
            Matcher match = NAME_ADDR_EMAIL_PATTERN.matcher(address);

            if (match.matches()) {
                return match.group(2);
            }
            return address;
        }

        /**
1921
         * Is the specified address an email address?
Wink Saville's avatar
Wink Saville committed
1922
         *
1923 1924 1925
         * @param address the input address to test
         * @return true if address is an email address; false otherwise.
         * @hide
Wink Saville's avatar
Wink Saville committed
1926 1927 1928 1929 1930 1931 1932 1933 1934 1935 1936 1937
         */
        public static boolean isEmailAddress(String address) {
            if (TextUtils.isEmpty(address)) {
                return false;
            }

            String s = extractAddrSpec(address);
            Matcher match = Patterns.EMAIL_ADDRESS.matcher(s);
            return match.matches();
        }

        /**
1938
         * Is the specified number a phone number?
Wink Saville's avatar
Wink Saville committed
1939
         *
1940 1941 1942
         * @param number the input number to test
         * @return true if number is a phone number; false otherwise.
         * @hide
Wink Saville's avatar
Wink Saville committed
1943 1944 1945 1946 1947 1948 1949 1950 1951 1952 1953
         */
        public static boolean isPhoneNumber(String number) {
            if (TextUtils.isEmpty(number)) {
                return false;
            }

            Matcher match = Patterns.PHONE.matcher(number);
            return match.matches();
        }

        /**
1954
         * Contains all MMS messages in the MMS app inbox.
Wink Saville's avatar
Wink Saville committed
1955 1956
         */
        public static final class Inbox implements BaseMmsColumns {
1957 1958 1959 1960 1961 1962 1963 1964

            /**
             * Not instantiable.
             * @hide
             */
            private Inbox() {
            }

Wink Saville's avatar
Wink Saville committed
1965
            /**
1966
             * The {@code content://} style URL for this table.
Wink Saville's avatar
Wink Saville committed
1967 1968 1969 1970 1971
             */
            public static final Uri
                    CONTENT_URI = Uri.parse("content://mms/inbox");

            /**
1972
             * The default sort order for this table.
Wink Saville's avatar
Wink Saville committed
1973 1974 1975 1976 1977
             */
            public static final String DEFAULT_SORT_ORDER = "date DESC";
        }

        /**
1978
         * Contains all MMS messages in the MMS app sent folder.
Wink Saville's avatar
Wink Saville committed
1979 1980
         */
        public static final class Sent implements BaseMmsColumns {
1981

Wink Saville's avatar
Wink Saville committed
1982
            /**
1983 1984 1985 1986 1987 1988 1989 1990
             * Not instantiable.
             * @hide
             */
            private Sent() {
            }

            /**
             * The {@code content://} style URL for this table.
Wink Saville's avatar
Wink Saville committed
1991 1992 1993 1994 1995
             */
            public static final Uri
                    CONTENT_URI = Uri.parse("content://mms/sent");

            /**
1996
             * The default sort order for this table.
Wink Saville's avatar
Wink Saville committed
1997 1998 1999 2000 2001
             */
            public static final String DEFAULT_SORT_ORDER = "date DESC";
        }

        /**
2002
         * Contains all MMS messages in the MMS app drafts folder.
Wink Saville's avatar
Wink Saville committed
2003 2004
         */
        public static final class Draft implements BaseMmsColumns {
2005

Wink Saville's avatar
Wink Saville committed
2006
            /**
2007 2008 2009 2010 2011 2012 2013 2014
             * Not instantiable.
             * @hide
             */
            private Draft() {
            }

            /**
             * The {@code content://} style URL for this table.
Wink Saville's avatar
Wink Saville committed
2015 2016 2017 2018 2019
             */
            public static final Uri
                    CONTENT_URI = Uri.parse("content://mms/drafts");

            /**
2020
             * The default sort order for this table.
Wink Saville's avatar
Wink Saville committed
2021 2022 2023 2024 2025
             */
            public static final String DEFAULT_SORT_ORDER = "date DESC";
        }

        /**
2026
         * Contains all MMS messages in the MMS app outbox.
Wink Saville's avatar
Wink Saville committed
2027 2028
         */
        public static final class Outbox implements BaseMmsColumns {
2029

Wink Saville's avatar
Wink Saville committed
2030
            /**
2031 2032 2033 2034 2035 2036 2037 2038
             * Not instantiable.
             * @hide
             */
            private Outbox() {
            }

            /**
             * The {@code content://} style URL for this table.
Wink Saville's avatar
Wink Saville committed
2039 2040 2041 2042 2043
             */
            public static final Uri
                    CONTENT_URI = Uri.parse("content://mms/outbox");

            /**
2044
             * The default sort order for this table.
Wink Saville's avatar
Wink Saville committed
2045 2046 2047 2048
             */
            public static final String DEFAULT_SORT_ORDER = "date DESC";
        }

2049 2050 2051
        /**
         * Contains address information for an MMS message.
         */
Wink Saville's avatar
Wink Saville committed
2052
        public static final class Addr implements BaseColumns {
2053 2054 2055 2056 2057 2058 2059 2060

            /**
             * Not instantiable.
             * @hide
             */
            private Addr() {
            }

Wink Saville's avatar
Wink Saville committed
2061 2062
            /**
             * The ID of MM which this address entry belongs to.
2063
             * <P>Type: INTEGER (long)</P>
Wink Saville's avatar
Wink Saville committed
2064 2065 2066 2067 2068
             */
            public static final String MSG_ID = "msg_id";

            /**
             * The ID of contact entry in Phone Book.
2069
             * <P>Type: INTEGER (long)</P>
Wink Saville's avatar
Wink Saville committed
2070 2071 2072 2073 2074
             */
            public static final String CONTACT_ID = "contact_id";

            /**
             * The address text.
2075
             * <P>Type: TEXT</P>
Wink Saville's avatar
Wink Saville committed
2076 2077 2078 2079
             */
            public static final String ADDRESS = "address";

            /**
2080 2081 2082
             * Type of address: must be one of {@code PduHeaders.BCC},
             * {@code PduHeaders.CC}, {@code PduHeaders.FROM}, {@code PduHeaders.TO}.
             * <P>Type: INTEGER</P>
Wink Saville's avatar
Wink Saville committed
2083 2084 2085 2086
             */
            public static final String TYPE = "type";

            /**
2087 2088
             * Character set of this entry (MMS charset value).
             * <P>Type: INTEGER</P>
Wink Saville's avatar
Wink Saville committed
2089 2090 2091 2092
             */
            public static final String CHARSET = "charset";
        }

2093 2094 2095
        /**
         * Contains message parts.
         */
Wink Saville's avatar
Wink Saville committed
2096
        public static final class Part implements BaseColumns {
2097 2098 2099 2100 2101 2102 2103 2104

            /**
             * Not instantiable.
             * @hide
             */
            private Part() {
            }

Wink Saville's avatar
Wink Saville committed
2105 2106 2107 2108 2109 2110 2111 2112 2113 2114 2115 2116 2117 2118 2119 2120 2121 2122 2123 2124 2125 2126 2127 2128 2129 2130 2131 2132 2133 2134 2135 2136 2137 2138 2139 2140 2141 2142 2143 2144 2145 2146 2147 2148 2149 2150 2151 2152 2153 2154 2155 2156 2157 2158 2159 2160 2161 2162 2163 2164 2165 2166 2167 2168 2169 2170 2171
            /**
             * The identifier of the message which this part belongs to.
             * <P>Type: INTEGER</P>
             */
            public static final String MSG_ID = "mid";

            /**
             * The order of the part.
             * <P>Type: INTEGER</P>
             */
            public static final String SEQ = "seq";

            /**
             * The content type of the part.
             * <P>Type: TEXT</P>
             */
            public static final String CONTENT_TYPE = "ct";

            /**
             * The name of the part.
             * <P>Type: TEXT</P>
             */
            public static final String NAME = "name";

            /**
             * The charset of the part.
             * <P>Type: TEXT</P>
             */
            public static final String CHARSET = "chset";

            /**
             * The file name of the part.
             * <P>Type: TEXT</P>
             */
            public static final String FILENAME = "fn";

            /**
             * The content disposition of the part.
             * <P>Type: TEXT</P>
             */
            public static final String CONTENT_DISPOSITION = "cd";

            /**
             * The content ID of the part.
             * <P>Type: INTEGER</P>
             */
            public static final String CONTENT_ID = "cid";

            /**
             * The content location of the part.
             * <P>Type: INTEGER</P>
             */
            public static final String CONTENT_LOCATION = "cl";

            /**
             * The start of content-type of the message.
             * <P>Type: INTEGER</P>
             */
            public static final String CT_START = "ctt_s";

            /**
             * The type of content-type of the message.
             * <P>Type: TEXT</P>
             */
            public static final String CT_TYPE = "ctt_t";

            /**
2172
             * The location (on filesystem) of the binary data of the part.
Wink Saville's avatar
Wink Saville committed
2173 2174 2175 2176
             * <P>Type: INTEGER</P>
             */
            public static final String _DATA = "_data";

2177 2178 2179 2180
            /**
             * The message text.
             * <P>Type: TEXT</P>
             */
Wink Saville's avatar
Wink Saville committed
2181 2182 2183
            public static final String TEXT = "text";
        }

2184 2185 2186
        /**
         * Message send rate table.
         */
Wink Saville's avatar
Wink Saville committed
2187
        public static final class Rate {
2188 2189 2190 2191 2192 2193 2194 2195 2196 2197 2198

            /**
             * Not instantiable.
             * @hide
             */
            private Rate() {
            }

            /**
             * The {@code content://} style URL for this table.
             */
Wink Saville's avatar
Wink Saville committed
2199 2200
            public static final Uri CONTENT_URI = Uri.withAppendedPath(
                    Mms.CONTENT_URI, "rate");
2201

Wink Saville's avatar
Wink Saville committed
2202 2203
            /**
             * When a message was successfully sent.
2204
             * <P>Type: INTEGER (long)</P>
Wink Saville's avatar
Wink Saville committed
2205 2206 2207 2208
             */
            public static final String SENT_TIME = "sent_time";
        }

2209 2210 2211
        /**
         * Intents class.
         */
Wink Saville's avatar
Wink Saville committed
2212 2213 2214
        public static final class Intents {

            /**
2215 2216
             * Not instantiable.
             * @hide
Wink Saville's avatar
Wink Saville committed
2217
             */
2218 2219 2220
            private Intents() {
            }

Wink Saville's avatar
Wink Saville committed
2221 2222 2223 2224 2225
            /**
             * Indicates that the contents of specified URIs were changed.
             * The application which is showing or caching these contents
             * should be updated.
             */
2226 2227 2228 2229
            @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION)
            public static final String CONTENT_CHANGED_ACTION
                    = "android.intent.action.CONTENT_CHANGED";

Wink Saville's avatar
Wink Saville committed
2230 2231 2232 2233 2234 2235 2236 2237 2238 2239 2240
            /**
             * An extra field which stores the URI of deleted contents.
             */
            public static final String DELETED_CONTENTS = "deleted_contents";
        }
    }

    /**
     * Contains all MMS and SMS messages.
     */
    public static final class MmsSms implements BaseColumns {
2241 2242 2243 2244 2245 2246 2247 2248

        /**
         * Not instantiable.
         * @hide
         */
        private MmsSms() {
        }

Wink Saville's avatar
Wink Saville committed
2249
        /**
2250
         * The column to distinguish SMS and MMS messages in query results.
Wink Saville's avatar
Wink Saville committed
2251 2252 2253 2254
         */
        public static final String TYPE_DISCRIMINATOR_COLUMN =
                "transport_type";

2255 2256 2257
        /**
         * The {@code content://} style URL for this table.
         */
Wink Saville's avatar
Wink Saville committed
2258 2259
        public static final Uri CONTENT_URI = Uri.parse("content://mms-sms/");

2260 2261 2262
        /**
         * The {@code content://} style URL for this table, by conversation.
         */
Wink Saville's avatar
Wink Saville committed
2263 2264 2265
        public static final Uri CONTENT_CONVERSATIONS_URI = Uri.parse(
                "content://mms-sms/conversations");

2266 2267 2268
        /**
         * The {@code content://} style URL for this table, by phone number.
         */
Wink Saville's avatar
Wink Saville committed
2269 2270 2271
        public static final Uri CONTENT_FILTER_BYPHONE_URI = Uri.parse(
                "content://mms-sms/messages/byphone");

2272 2273 2274
        /**
         * The {@code content://} style URL for undelivered messages in this table.
         */
Wink Saville's avatar
Wink Saville committed
2275 2276 2277
        public static final Uri CONTENT_UNDELIVERED_URI = Uri.parse(
                "content://mms-sms/undelivered");

2278 2279 2280
        /**
         * The {@code content://} style URL for draft messages in this table.
         */
Wink Saville's avatar
Wink Saville committed
2281 2282 2283
        public static final Uri CONTENT_DRAFT_URI = Uri.parse(
                "content://mms-sms/draft");

2284 2285 2286
        /**
         * The {@code content://} style URL for locked messages in this table.
         */
Wink Saville's avatar
Wink Saville committed
2287 2288 2289
        public static final Uri CONTENT_LOCKED_URI = Uri.parse(
                "content://mms-sms/locked");

2290 2291 2292
        /**
         * Pass in a query parameter called "pattern" which is the text to search for.
         * The sort order is fixed to be: {@code thread_id ASC, date DESC}.
Wink Saville's avatar
Wink Saville committed
2293 2294 2295 2296 2297
         */
        public static final Uri SEARCH_URI = Uri.parse(
                "content://mms-sms/search");

        // Constants for message protocol types.
2298 2299

        /** SMS protocol type. */
Wink Saville's avatar
Wink Saville committed
2300
        public static final int SMS_PROTO = 0;
2301 2302

        /** MMS protocol type. */
Wink Saville's avatar
Wink Saville committed
2303 2304 2305
        public static final int MMS_PROTO = 1;

        // Constants for error types of pending messages.
2306 2307

        /** Error type: no error. */
Wink Saville's avatar
Wink Saville committed
2308
        public static final int NO_ERROR                      = 0;
2309 2310

        /** Error type: generic transient error. */
Wink Saville's avatar
Wink Saville committed
2311
        public static final int ERR_TYPE_GENERIC              = 1;
2312 2313

        /** Error type: SMS protocol transient error. */
Wink Saville's avatar
Wink Saville committed
2314
        public static final int ERR_TYPE_SMS_PROTO_TRANSIENT  = 2;
2315 2316

        /** Error type: MMS protocol transient error. */
Wink Saville's avatar
Wink Saville committed
2317
        public static final int ERR_TYPE_MMS_PROTO_TRANSIENT  = 3;
2318 2319

        /** Error type: transport failure. */
Wink Saville's avatar
Wink Saville committed
2320
        public static final int ERR_TYPE_TRANSPORT_FAILURE    = 4;
2321 2322

        /** Error type: permanent error (along with all higher error values). */
Wink Saville's avatar
Wink Saville committed
2323
        public static final int ERR_TYPE_GENERIC_PERMANENT    = 10;
2324 2325

        /** Error type: SMS protocol permanent error. */
Wink Saville's avatar
Wink Saville committed
2326
        public static final int ERR_TYPE_SMS_PROTO_PERMANENT  = 11;
2327 2328

        /** Error type: MMS protocol permanent error. */
Wink Saville's avatar
Wink Saville committed
2329 2330
        public static final int ERR_TYPE_MMS_PROTO_PERMANENT  = 12;

2331 2332 2333
        /**
         * Contains pending messages info.
         */
Wink Saville's avatar
Wink Saville committed
2334
        public static final class PendingMessages implements BaseColumns {
2335 2336 2337 2338 2339 2340 2341 2342

            /**
             * Not instantiable.
             * @hide
             */
            private PendingMessages() {
            }

Wink Saville's avatar
Wink Saville committed
2343 2344
            public static final Uri CONTENT_URI = Uri.withAppendedPath(
                    MmsSms.CONTENT_URI, "pending");
2345

Wink Saville's avatar
Wink Saville committed
2346
            /**
2347
             * The type of transport protocol (MMS or SMS).
Wink Saville's avatar
Wink Saville committed
2348 2349 2350
             * <P>Type: INTEGER</P>
             */
            public static final String PROTO_TYPE = "proto_type";
2351

Wink Saville's avatar
Wink Saville committed
2352 2353
            /**
             * The ID of the message to be sent or downloaded.
2354
             * <P>Type: INTEGER (long)</P>
Wink Saville's avatar
Wink Saville committed
2355 2356
             */
            public static final String MSG_ID = "msg_id";
2357

Wink Saville's avatar
Wink Saville committed
2358 2359
            /**
             * The type of the message to be sent or downloaded.
2360 2361
             * This field is only valid for MM. For SM, its value is always set to 0.
             * <P>Type: INTEGER</P>
Wink Saville's avatar
Wink Saville committed
2362 2363
             */
            public static final String MSG_TYPE = "msg_type";
2364

Wink Saville's avatar
Wink Saville committed
2365 2366 2367 2368 2369
            /**
             * The type of the error code.
             * <P>Type: INTEGER</P>
             */
            public static final String ERROR_TYPE = "err_type";
2370

Wink Saville's avatar
Wink Saville committed
2371 2372
            /**
             * The error code of sending/retrieving process.
2373
             * <P>Type: INTEGER</P>
Wink Saville's avatar
Wink Saville committed
2374 2375
             */
            public static final String ERROR_CODE = "err_code";
2376

Wink Saville's avatar
Wink Saville committed
2377 2378
            /**
             * How many times we tried to send or download the message.
2379
             * <P>Type: INTEGER</P>
Wink Saville's avatar
Wink Saville committed
2380 2381
             */
            public static final String RETRY_INDEX = "retry_index";
2382

Wink Saville's avatar
Wink Saville committed
2383 2384
            /**
             * The time to do next retry.
2385
             * <P>Type: INTEGER (long)</P>
Wink Saville's avatar
Wink Saville committed
2386 2387
             */
            public static final String DUE_TIME = "due_time";
2388

Wink Saville's avatar
Wink Saville committed
2389 2390
            /**
             * The time we last tried to send or download the message.
2391
             * <P>Type: INTEGER (long)</P>
Wink Saville's avatar
Wink Saville committed
2392 2393
             */
            public static final String LAST_TRY = "last_try";
Wink Saville's avatar
Wink Saville committed
2394 2395

            /**
2396
             * The subscription to which the message belongs to. Its value will be
2397
             * < 0 if the sub id cannot be determined.
Wink Saville's avatar
Wink Saville committed
2398 2399
             * <p>Type: INTEGER (long) </p>
             */
2400
            public static final String SUBSCRIPTION_ID = "pending_sub_id";
Wink Saville's avatar
Wink Saville committed
2401 2402
        }

2403 2404 2405 2406
        /**
         * Words table used by provider for full-text searches.
         * @hide
         */
Wink Saville's avatar
Wink Saville committed
2407
        public static final class WordsTable {
2408 2409 2410 2411 2412 2413 2414 2415 2416 2417 2418

            /**
             * Not instantiable.
             * @hide
             */
            private WordsTable() {}

            /**
             * Primary key.
             * <P>Type: INTEGER (long)</P>
             */
Wink Saville's avatar
Wink Saville committed
2419
            public static final String ID = "_id";
2420 2421 2422 2423 2424

            /**
             * Source row ID.
             * <P>Type: INTEGER (long)</P>
             */
Wink Saville's avatar
Wink Saville committed
2425
            public static final String SOURCE_ROW_ID = "source_id";
2426 2427 2428 2429 2430

            /**
             * Table ID (either 1 or 2).
             * <P>Type: INTEGER</P>
             */
Wink Saville's avatar
Wink Saville committed
2431
            public static final String TABLE_ID = "table_to_use";
2432 2433 2434 2435 2436

            /**
             * The words to index.
             * <P>Type: TEXT</P>
             */
Wink Saville's avatar
Wink Saville committed
2437 2438 2439 2440
            public static final String INDEXED_TEXT = "index_text";
        }
    }

2441 2442 2443
    /**
     * Carriers class contains information about APNs, including MMSC information.
     */
Wink Saville's avatar
Wink Saville committed
2444
    public static final class Carriers implements BaseColumns {
2445 2446 2447 2448 2449 2450 2451

        /**
         * Not instantiable.
         * @hide
         */
        private Carriers() {}

Wink Saville's avatar
Wink Saville committed
2452
        /**
2453
         * The {@code content://} style URL for this table.
Wink Saville's avatar
Wink Saville committed
2454
         */
2455
        public static final Uri CONTENT_URI = Uri.parse("content://telephony/carriers");
Wink Saville's avatar
Wink Saville committed
2456 2457

        /**
2458
         * The default sort order for this table.
Wink Saville's avatar
Wink Saville committed
2459 2460 2461
         */
        public static final String DEFAULT_SORT_ORDER = "name ASC";

2462 2463 2464 2465
        /**
         * Entry name.
         * <P>Type: TEXT</P>
         */
Wink Saville's avatar
Wink Saville committed
2466 2467
        public static final String NAME = "name";

2468 2469 2470 2471
        /**
         * APN name.
         * <P>Type: TEXT</P>
         */
Wink Saville's avatar
Wink Saville committed
2472 2473
        public static final String APN = "apn";

2474 2475 2476 2477
        /**
         * Proxy address.
         * <P>Type: TEXT</P>
         */
Wink Saville's avatar
Wink Saville committed
2478 2479
        public static final String PROXY = "proxy";

2480 2481 2482 2483
        /**
         * Proxy port.
         * <P>Type: TEXT</P>
         */
Wink Saville's avatar
Wink Saville committed
2484 2485
        public static final String PORT = "port";

2486 2487 2488 2489
        /**
         * MMS proxy address.
         * <P>Type: TEXT</P>
         */
Wink Saville's avatar
Wink Saville committed
2490 2491
        public static final String MMSPROXY = "mmsproxy";

2492 2493 2494 2495
        /**
         * MMS proxy port.
         * <P>Type: TEXT</P>
         */
Wink Saville's avatar
Wink Saville committed
2496 2497
        public static final String MMSPORT = "mmsport";

2498 2499 2500 2501
        /**
         * Server address.
         * <P>Type: TEXT</P>
         */
Wink Saville's avatar
Wink Saville committed
2502 2503
        public static final String SERVER = "server";

2504 2505 2506 2507
        /**
         * APN username.
         * <P>Type: TEXT</P>
         */
Wink Saville's avatar
Wink Saville committed
2508 2509
        public static final String USER = "user";

2510 2511 2512 2513
        /**
         * APN password.
         * <P>Type: TEXT</P>
         */
Wink Saville's avatar
Wink Saville committed
2514 2515
        public static final String PASSWORD = "password";

2516 2517 2518 2519
        /**
         * MMSC URL.
         * <P>Type: TEXT</P>
         */
Wink Saville's avatar
Wink Saville committed
2520 2521
        public static final String MMSC = "mmsc";

2522 2523 2524 2525
        /**
         * Mobile Country Code (MCC).
         * <P>Type: TEXT</P>
         */
Wink Saville's avatar
Wink Saville committed
2526 2527
        public static final String MCC = "mcc";

2528 2529 2530 2531
        /**
         * Mobile Network Code (MNC).
         * <P>Type: TEXT</P>
         */
Wink Saville's avatar
Wink Saville committed
2532 2533
        public static final String MNC = "mnc";

2534 2535 2536 2537
        /**
         * Numeric operator ID (as String). Usually {@code MCC + MNC}.
         * <P>Type: TEXT</P>
         */
Wink Saville's avatar
Wink Saville committed
2538 2539
        public static final String NUMERIC = "numeric";

2540 2541 2542 2543
        /**
         * Authentication type.
         * <P>Type:  INTEGER</P>
         */
Wink Saville's avatar
Wink Saville committed
2544 2545
        public static final String AUTH_TYPE = "authtype";

2546 2547 2548 2549
        /**
         * Comma-delimited list of APN types.
         * <P>Type: TEXT</P>
         */
Wink Saville's avatar
Wink Saville committed
2550 2551 2552
        public static final String TYPE = "type";

        /**
2553
         * The protocol to use to connect to this APN.
Wink Saville's avatar
Wink Saville committed
2554
         *
2555 2556 2557
         * One of the {@code PDP_type} values in TS 27.007 section 10.1.1.
         * For example: {@code IP}, {@code IPV6}, {@code IPV4V6}, or {@code PPP}.
         * <P>Type: TEXT</P>
Wink Saville's avatar
Wink Saville committed
2558 2559 2560 2561
         */
        public static final String PROTOCOL = "protocol";

        /**
2562 2563 2564 2565
         * The protocol to use to connect to this APN when roaming.
         * The syntax is the same as protocol.
         * <P>Type: TEXT</P>
         */
Wink Saville's avatar
Wink Saville committed
2566 2567
        public static final String ROAMING_PROTOCOL = "roaming_protocol";

2568 2569 2570 2571
        /**
         * Is this the current APN?
         * <P>Type: INTEGER (boolean)</P>
         */
Wink Saville's avatar
Wink Saville committed
2572 2573 2574
        public static final String CURRENT = "current";

        /**
2575 2576 2577
         * Is this APN enabled?
         * <P>Type: INTEGER (boolean)</P>
         */
Wink Saville's avatar
Wink Saville committed
2578 2579 2580
        public static final String CARRIER_ENABLED = "carrier_enabled";

        /**
2581 2582 2583 2584 2585 2586
         * Radio Access Technology info.
         * To check what values are allowed, refer to {@link android.telephony.ServiceState}.
         * This should be spread to other technologies,
         * but is currently only used for LTE (14) and eHRPD (13).
         * <P>Type: INTEGER</P>
         */
Wink Saville's avatar
Wink Saville committed
2587
        public static final String BEARER = "bearer";
2588

Amit Mahajan's avatar
Amit Mahajan committed
2589 2590 2591 2592 2593 2594 2595
        /**
         * Radio Access Technology bitmask.
         * To check what values can be contained, refer to {@link android.telephony.ServiceState}.
         * 0 indicates all techs otherwise first bit refers to RAT/bearer 1, second bit refers to
         * RAT/bearer 2 and so on.
         * Bitmask for a radio tech R is (1 << (R - 1))
         * <P>Type: INTEGER</P>
Amit Mahajan's avatar
Amit Mahajan committed
2596
         * @hide
Amit Mahajan's avatar
Amit Mahajan committed
2597 2598 2599
         */
        public static final String BEARER_BITMASK = "bearer_bitmask";

2600
        /**
2601 2602 2603 2604
         * MVNO type:
         * {@code SPN (Service Provider Name), IMSI, GID (Group Identifier Level 1)}.
         * <P>Type: TEXT</P>
         */
2605 2606 2607
        public static final String MVNO_TYPE = "mvno_type";

        /**
2608 2609 2610 2611 2612 2613 2614 2615 2616
         * MVNO data.
         * Use the following examples.
         * <ul>
         *     <li>SPN: A MOBILE, BEN NL, ...</li>
         *     <li>IMSI: 302720x94, 2060188, ...</li>
         *     <li>GID: 4E, 33, ...</li>
         * </ul>
         * <P>Type: TEXT</P>
         */
2617
        public static final String MVNO_MATCH_DATA = "mvno_match_data";
Wink Saville's avatar
Wink Saville committed
2618 2619

        /**
2620
         * The subscription to which the APN belongs to
Wink Saville's avatar
Wink Saville committed
2621 2622
         * <p>Type: INTEGER (long) </p>
         */
2623
        public static final String SUBSCRIPTION_ID = "sub_id";
Wink Saville's avatar
Wink Saville committed
2624

2625 2626 2627 2628 2629 2630 2631 2632 2633 2634 2635 2636 2637 2638 2639 2640 2641 2642 2643 2644 2645 2646 2647 2648 2649 2650 2651 2652 2653 2654 2655 2656 2657 2658 2659
        /**
         * The profile_id to which the APN saved in modem
         * <p>Type: INTEGER</p>
         *@hide
         */
        public static final String PROFILE_ID = "profile_id";

        /**
         * Is the apn setting to be set in modem
         * <P>Type: INTEGER (boolean)</P>
         *@hide
         */
        public static final String MODEM_COGNITIVE = "modem_cognitive";

        /**
         * The max connections of this apn
         * <p>Type: INTEGER</p>
         *@hide
         */
        public static final String MAX_CONNS = "max_conns";

        /**
         * The wait time for retry of the apn
         * <p>Type: INTEGER</p>
         *@hide
         */
        public static final String WAIT_TIME = "wait_time";

        /**
         * The time to limit max connection for the apn
         * <p>Type: INTEGER</p>
         *@hide
         */
        public static final String MAX_CONNS_TIME = "max_conns_time";

2660 2661 2662 2663 2664 2665
        /**
         * The MTU size of the mobile interface to  which the APN connected
         * <p>Type: INTEGER </p>
         * @hide
         */
        public static final String MTU = "mtu";
2666 2667

        /**
2668
         * Is this APN added/edited/deleted by a user or carrier?
2669 2670 2671
         * <p>Type: INTEGER </p>
         * @hide
         */
Amit Mahajan's avatar
Amit Mahajan committed
2672
        public static final String EDITED = "edited";
2673 2674 2675 2676 2677 2678 2679 2680 2681 2682 2683 2684 2685 2686 2687 2688 2689 2690 2691 2692 2693 2694 2695 2696 2697 2698 2699 2700 2701 2702 2703 2704 2705 2706 2707

        /**
         * Following are possible values for the EDITED field
         * @hide
         */
        public static final int UNEDITED = 0;
        /**
         *  @hide
         */
        public static final int USER_EDITED = 1;
        /**
         *  @hide
         */
        public static final int USER_DELETED = 2;
        /**
         * DELETED_BUT_PRESENT is an intermediate value used to indicate that an entry deleted
         * by the user is still present in the new APN database and therefore must remain tagged
         * as user deleted rather than completely removed from the database
         * @hide
         */
        public static final int USER_DELETED_BUT_PRESENT_IN_XML = 3;
        /**
         *  @hide
         */
        public static final int CARRIER_EDITED = 4;
        /**
         * CARRIER_DELETED values are currently not used as there is no usecase. If they are used,
         * delete() will have to change accordingly. Currently it is hardcoded to USER_DELETED.
         * @hide
         */
        public static final int CARRIER_DELETED = 5;
        /**
         *  @hide
         */
        public static final int CARRIER_DELETED_BUT_PRESENT_IN_XML = 6;
Wink Saville's avatar
Wink Saville committed
2708 2709 2710 2711
    }

    /**
     * Contains received SMS cell broadcast messages.
2712
     * @hide
Wink Saville's avatar
Wink Saville committed
2713 2714 2715
     */
    public static final class CellBroadcasts implements BaseColumns {

2716 2717 2718 2719
        /**
         * Not instantiable.
         * @hide
         */
Wink Saville's avatar
Wink Saville committed
2720 2721 2722
        private CellBroadcasts() {}

        /**
2723
         * The {@code content://} URI for this table.
Wink Saville's avatar
Wink Saville committed
2724
         */
2725
        public static final Uri CONTENT_URI = Uri.parse("content://cellbroadcasts");
Wink Saville's avatar
Wink Saville committed
2726 2727 2728 2729 2730 2731 2732 2733 2734 2735 2736 2737 2738 2739

        /**
         * Message geographical scope.
         * <P>Type: INTEGER</P>
         */
        public static final String GEOGRAPHICAL_SCOPE = "geo_scope";

        /**
         * Message serial number.
         * <P>Type: INTEGER</P>
         */
        public static final String SERIAL_NUMBER = "serial_number";

        /**
2740 2741
         * PLMN of broadcast sender. {@code SERIAL_NUMBER + PLMN + LAC + CID} uniquely identifies
         * a broadcast for duplicate detection purposes.
Wink Saville's avatar
Wink Saville committed
2742 2743 2744 2745 2746 2747 2748 2749 2750 2751 2752 2753 2754 2755 2756 2757 2758 2759 2760
         * <P>Type: TEXT</P>
         */
        public static final String PLMN = "plmn";

        /**
         * Location Area (GSM) or Service Area (UMTS) of broadcast sender. Unused for CDMA.
         * Only included if Geographical Scope of message is not PLMN wide (01).
         * <P>Type: INTEGER</P>
         */
        public static final String LAC = "lac";

        /**
         * Cell ID of message sender (GSM/UMTS). Unused for CDMA. Only included when the
         * Geographical Scope of message is cell wide (00 or 11).
         * <P>Type: INTEGER</P>
         */
        public static final String CID = "cid";

        /**
2761
         * Message code. <em>OBSOLETE: merged into SERIAL_NUMBER.</em>
Wink Saville's avatar
Wink Saville committed
2762 2763 2764 2765 2766
         * <P>Type: INTEGER</P>
         */
        public static final String V1_MESSAGE_CODE = "message_code";

        /**
2767
         * Message identifier. <em>OBSOLETE: renamed to SERVICE_CATEGORY.</em>
Wink Saville's avatar
Wink Saville committed
2768 2769 2770 2771 2772
         * <P>Type: INTEGER</P>
         */
        public static final String V1_MESSAGE_IDENTIFIER = "message_id";

        /**
2773
         * Service category (GSM/UMTS: message identifier; CDMA: service category).
Wink Saville's avatar
Wink Saville committed
2774 2775 2776 2777 2778 2779 2780 2781 2782 2783 2784 2785 2786 2787 2788 2789 2790 2791 2792 2793 2794 2795 2796 2797 2798 2799 2800 2801 2802 2803 2804 2805 2806 2807 2808 2809 2810 2811 2812 2813 2814 2815 2816 2817 2818 2819 2820 2821 2822 2823 2824 2825 2826 2827 2828 2829 2830 2831 2832 2833 2834 2835 2836 2837 2838 2839 2840 2841 2842 2843 2844 2845 2846 2847 2848 2849 2850 2851 2852 2853 2854 2855
         * <P>Type: INTEGER</P>
         */
        public static final String SERVICE_CATEGORY = "service_category";

        /**
         * Message language code.
         * <P>Type: TEXT</P>
         */
        public static final String LANGUAGE_CODE = "language";

        /**
         * Message body.
         * <P>Type: TEXT</P>
         */
        public static final String MESSAGE_BODY = "body";

        /**
         * Message delivery time.
         * <P>Type: INTEGER (long)</P>
         */
        public static final String DELIVERY_TIME = "date";

        /**
         * Has the message been viewed?
         * <P>Type: INTEGER (boolean)</P>
         */
        public static final String MESSAGE_READ = "read";

        /**
         * Message format (3GPP or 3GPP2).
         * <P>Type: INTEGER</P>
         */
        public static final String MESSAGE_FORMAT = "format";

        /**
         * Message priority (including emergency).
         * <P>Type: INTEGER</P>
         */
        public static final String MESSAGE_PRIORITY = "priority";

        /**
         * ETWS warning type (ETWS alerts only).
         * <P>Type: INTEGER</P>
         */
        public static final String ETWS_WARNING_TYPE = "etws_warning_type";

        /**
         * CMAS message class (CMAS alerts only).
         * <P>Type: INTEGER</P>
         */
        public static final String CMAS_MESSAGE_CLASS = "cmas_message_class";

        /**
         * CMAS category (CMAS alerts only).
         * <P>Type: INTEGER</P>
         */
        public static final String CMAS_CATEGORY = "cmas_category";

        /**
         * CMAS response type (CMAS alerts only).
         * <P>Type: INTEGER</P>
         */
        public static final String CMAS_RESPONSE_TYPE = "cmas_response_type";

        /**
         * CMAS severity (CMAS alerts only).
         * <P>Type: INTEGER</P>
         */
        public static final String CMAS_SEVERITY = "cmas_severity";

        /**
         * CMAS urgency (CMAS alerts only).
         * <P>Type: INTEGER</P>
         */
        public static final String CMAS_URGENCY = "cmas_urgency";

        /**
         * CMAS certainty (CMAS alerts only).
         * <P>Type: INTEGER</P>
         */
        public static final String CMAS_CERTAINTY = "cmas_certainty";

2856
        /** The default sort order for this table. */
Wink Saville's avatar
Wink Saville committed
2857 2858 2859 2860 2861 2862 2863 2864 2865 2866 2867 2868 2869 2870 2871 2872 2873 2874 2875 2876 2877 2878 2879 2880 2881 2882 2883 2884 2885
        public static final String DEFAULT_SORT_ORDER = DELIVERY_TIME + " DESC";

        /**
         * Query columns for instantiating {@link android.telephony.CellBroadcastMessage} objects.
         */
        public static final String[] QUERY_COLUMNS = {
                _ID,
                GEOGRAPHICAL_SCOPE,
                PLMN,
                LAC,
                CID,
                SERIAL_NUMBER,
                SERVICE_CATEGORY,
                LANGUAGE_CODE,
                MESSAGE_BODY,
                DELIVERY_TIME,
                MESSAGE_READ,
                MESSAGE_FORMAT,
                MESSAGE_PRIORITY,
                ETWS_WARNING_TYPE,
                CMAS_MESSAGE_CLASS,
                CMAS_CATEGORY,
                CMAS_RESPONSE_TYPE,
                CMAS_SEVERITY,
                CMAS_URGENCY,
                CMAS_CERTAINTY
        };
    }
}