Telephony.java 97.7 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
             *   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";

990 991 992 993 994 995 996 997 998
            /**
             * Action: A SMS based carrier provision intent. Used to identify default
             * carrier provisioning app on the device.
             * @hide
             */
            @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION)
            public static final String SMS_CARRIER_PROVISION_ACTION =
                    "android.provider.Telephony.SMS_CARRIER_PROVISION";

Wink Saville's avatar
Wink Saville committed
999 1000 1001 1002 1003 1004
            /**
             * 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
1005
             *   <li><em>"message"</em> - An SmsCbMessage object containing the broadcast message
Wink Saville's avatar
Wink Saville committed
1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024
             *   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
1025
             *   <li><em>"operations"</em> - An array of CdmaSmsCbProgramData objects containing
Wink Saville's avatar
Wink Saville committed
1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054
             *   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
1055
             *   <li><em>"result"</em> - An int result code, e.g. {@link #RESULT_SMS_OUT_OF_MEMORY}
Wink Saville's avatar
Wink Saville committed
1056 1057 1058 1059 1060 1061 1062
             *   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";

1063 1064 1065 1066 1067 1068 1069 1070 1071 1072
            /**
             * 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
1073 1074 1075 1076 1077 1078 1079
            /**
             * 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
             */
1080
            public static SmsMessage[] getMessagesFromIntent(Intent intent) {
Wink Saville's avatar
Wink Saville committed
1081 1082
                Object[] messages = (Object[]) intent.getSerializableExtra("pdus");
                String format = intent.getStringExtra("format");
Wink Saville's avatar
Wink Saville committed
1083
                int subId = intent.getIntExtra(PhoneConstants.SUBSCRIPTION_KEY,
1084
                        SubscriptionManager.getDefaultSmsSubId());
Wink Saville's avatar
Wink Saville committed
1085 1086

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

1088
                int pduCount = messages.length;
Wink Saville's avatar
Wink Saville committed
1089
                SmsMessage[] msgs = new SmsMessage[pduCount];
1090

Wink Saville's avatar
Wink Saville committed
1091
                for (int i = 0; i < pduCount; i++) {
1092 1093
                    byte[] pdu = (byte[]) messages[i];
                    msgs[i] = SmsMessage.createFromPdu(pdu, format);
Wink Saville's avatar
Wink Saville committed
1094
                    msgs[i].setSubId(subId);
Wink Saville's avatar
Wink Saville committed
1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105
                }
                return msgs;
            }
        }
    }

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

1106
        /** Message box: all messages. */
Wink Saville's avatar
Wink Saville committed
1107
        public static final int MESSAGE_BOX_ALL    = 0;
1108
        /** Message box: inbox. */
Wink Saville's avatar
Wink Saville committed
1109
        public static final int MESSAGE_BOX_INBOX  = 1;
1110
        /** Message box: sent messages. */
Wink Saville's avatar
Wink Saville committed
1111
        public static final int MESSAGE_BOX_SENT   = 2;
1112
        /** Message box: drafts. */
Wink Saville's avatar
Wink Saville committed
1113
        public static final int MESSAGE_BOX_DRAFTS = 3;
1114
        /** Message box: outbox. */
Wink Saville's avatar
Wink Saville committed
1115
        public static final int MESSAGE_BOX_OUTBOX = 4;
Ye Wen's avatar
Ye Wen committed
1116 1117
        /** Message box: failed. */
        public static final int MESSAGE_BOX_FAILED = 5;
Wink Saville's avatar
Wink Saville committed
1118

1119 1120 1121 1122 1123 1124
        /**
         * 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
1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137
        /**
         * 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";

        /**
1138
         * The box which the message belongs to, e.g. {@link #MESSAGE_BOX_INBOX}.
Wink Saville's avatar
Wink Saville committed
1139 1140 1141 1142 1143
         * <P>Type: INTEGER</P>
         */
        public static final String MESSAGE_BOX = "msg_box";

        /**
1144
         * Has the message been read?
Wink Saville's avatar
Wink Saville committed
1145 1146 1147 1148 1149
         * <P>Type: INTEGER (boolean)</P>
         */
        public static final String READ = "read";

        /**
1150 1151 1152
         * 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
1153 1154 1155
         */
        public static final String SEEN = "seen";

Tom Taylor's avatar
Tom Taylor committed
1156
        /**
1157 1158 1159
         * 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
1160 1161 1162
         */
        public static final String TEXT_ONLY = "text_only";

Wink Saville's avatar
Wink Saville committed
1163
        /**
1164
         * The {@code Message-ID} of the message.
Wink Saville's avatar
Wink Saville committed
1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181
         * <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";

        /**
1182
         * The {@code Content-Type} of the message.
Wink Saville's avatar
Wink Saville committed
1183 1184 1185 1186 1187
         * <P>Type: TEXT</P>
         */
        public static final String CONTENT_TYPE = "ct_t";

        /**
1188
         * The {@code Content-Location} of the message.
Wink Saville's avatar
Wink Saville committed
1189 1190 1191 1192 1193 1194
         * <P>Type: TEXT</P>
         */
        public static final String CONTENT_LOCATION = "ct_l";

        /**
         * The expiry time of the message.
1195
         * <P>Type: INTEGER (long)</P>
Wink Saville's avatar
Wink Saville committed
1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211
         */
        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";

        /**
1212
         * The version of the specification that this message conforms to.
Wink Saville's avatar
Wink Saville committed
1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224
         * <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.
1225
         * <P>Type: INTEGER</P>
Wink Saville's avatar
Wink Saville committed
1226 1227 1228 1229
         */
        public static final String PRIORITY = "pri";

        /**
1230 1231
         * The {@code read-report} of the message.
         * <P>Type: INTEGER (boolean)</P>
Wink Saville's avatar
Wink Saville committed
1232 1233 1234 1235
         */
        public static final String READ_REPORT = "rr";

        /**
1236 1237
         * Is read report allowed?
         * <P>Type: INTEGER (boolean)</P>
Wink Saville's avatar
Wink Saville committed
1238 1239 1240 1241
         */
        public static final String REPORT_ALLOWED = "rpt_a";

        /**
1242
         * The {@code response-status} of the message.
Wink Saville's avatar
Wink Saville committed
1243 1244 1245 1246 1247
         * <P>Type: INTEGER</P>
         */
        public static final String RESPONSE_STATUS = "resp_st";

        /**
1248
         * The {@code status} of the message.
Wink Saville's avatar
Wink Saville committed
1249 1250 1251 1252 1253
         * <P>Type: INTEGER</P>
         */
        public static final String STATUS = "st";

        /**
1254
         * The {@code transaction-id} of the message.
Wink Saville's avatar
Wink Saville committed
1255 1256 1257 1258 1259
         * <P>Type: TEXT</P>
         */
        public static final String TRANSACTION_ID = "tr_id";

        /**
1260
         * The {@code retrieve-status} of the message.
Wink Saville's avatar
Wink Saville committed
1261 1262 1263 1264 1265
         * <P>Type: INTEGER</P>
         */
        public static final String RETRIEVE_STATUS = "retr_st";

        /**
1266
         * The {@code retrieve-text} of the message.
Wink Saville's avatar
Wink Saville committed
1267 1268 1269 1270 1271 1272
         * <P>Type: TEXT</P>
         */
        public static final String RETRIEVE_TEXT = "retr_txt";

        /**
         * The character set of the retrieve-text.
1273
         * <P>Type: INTEGER</P>
Wink Saville's avatar
Wink Saville committed
1274 1275 1276 1277
         */
        public static final String RETRIEVE_TEXT_CHARSET = "retr_txt_cs";

        /**
1278
         * The {@code read-status} of the message.
Wink Saville's avatar
Wink Saville committed
1279 1280 1281 1282 1283
         * <P>Type: INTEGER</P>
         */
        public static final String READ_STATUS = "read_status";

        /**
1284
         * The {@code content-class} of the message.
Wink Saville's avatar
Wink Saville committed
1285 1286 1287 1288 1289
         * <P>Type: INTEGER</P>
         */
        public static final String CONTENT_CLASS = "ct_cls";

        /**
1290
         * The {@code delivery-report} of the message.
Wink Saville's avatar
Wink Saville committed
1291 1292 1293 1294 1295
         * <P>Type: INTEGER</P>
         */
        public static final String DELIVERY_REPORT = "d_rpt";

        /**
1296
         * The {@code delivery-time-token} of the message.
Wink Saville's avatar
Wink Saville committed
1297
         * <P>Type: INTEGER</P>
1298 1299
         * @deprecated this column is no longer supported.
         * @hide
Wink Saville's avatar
Wink Saville committed
1300
         */
1301
        @Deprecated
Wink Saville's avatar
Wink Saville committed
1302 1303 1304
        public static final String DELIVERY_TIME_TOKEN = "d_tm_tok";

        /**
1305
         * The {@code delivery-time} of the message.
Wink Saville's avatar
Wink Saville committed
1306 1307 1308 1309 1310
         * <P>Type: INTEGER</P>
         */
        public static final String DELIVERY_TIME = "d_tm";

        /**
1311
         * The {@code response-text} of the message.
Wink Saville's avatar
Wink Saville committed
1312 1313 1314 1315 1316
         * <P>Type: TEXT</P>
         */
        public static final String RESPONSE_TEXT = "resp_txt";

        /**
1317
         * The {@code sender-visibility} of the message.
Wink Saville's avatar
Wink Saville committed
1318
         * <P>Type: TEXT</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 SENDER_VISIBILITY = "s_vis";

        /**
1326
         * The {@code reply-charging} 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 = "r_chg";

        /**
1335
         * The {@code reply-charging-deadline-token} 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_TOKEN = "r_chg_dl_tok";

        /**
1344
         * The {@code reply-charging-deadline} of the message.
Wink Saville's avatar
Wink Saville committed
1345
         * <P>Type: INTEGER</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_DEADLINE = "r_chg_dl";

        /**
1353
         * The {@code reply-charging-id} of the message.
Wink Saville's avatar
Wink Saville committed
1354
         * <P>Type: TEXT</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_ID = "r_chg_id";

        /**
1362
         * The {@code reply-charging-size} of the message.
Wink Saville's avatar
Wink Saville committed
1363
         * <P>Type: INTEGER</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 REPLY_CHARGING_SIZE = "r_chg_sz";

        /**
1371
         * The {@code previously-sent-by} of the message.
Wink Saville's avatar
Wink Saville committed
1372
         * <P>Type: TEXT</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_BY = "p_s_by";

        /**
1380
         * The {@code previously-sent-date} of the message.
Wink Saville's avatar
Wink Saville committed
1381
         * <P>Type: INTEGER</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 PREVIOUSLY_SENT_DATE = "p_s_d";

        /**
1389
         * The {@code store} of the message.
Wink Saville's avatar
Wink Saville committed
1390
         * <P>Type: TEXT</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 STORE = "store";

        /**
1398
         * The {@code mm-state} 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_STATE = "mm_st";

        /**
1407
         * The {@code mm-flags-token} of the message.
Wink Saville's avatar
Wink Saville committed
1408
         * <P>Type: INTEGER</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_TOKEN = "mm_flg_tok";

        /**
1416
         * The {@code mm-flags} 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 MM_FLAGS = "mm_flg";

        /**
1425
         * The {@code store-status} 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 = "store_st";

        /**
1434
         * The {@code store-status-text} 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 STORE_STATUS_TEXT = "store_st_txt";

        /**
1443
         * The {@code stored} 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 STORED = "stored";

        /**
1452
         * The {@code 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 TOTALS = "totals";

        /**
1461
         * The {@code mbox-totals} of the message.
Wink Saville's avatar
Wink Saville committed
1462
         * <P>Type: TEXT</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 = "mb_t";

        /**
1470
         * The {@code mbox-totals-token} of the message.
Wink Saville's avatar
Wink Saville committed
1471
         * <P>Type: INTEGER</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 MBOX_TOTALS_TOKEN = "mb_t_tok";

        /**
1479
         * The {@code 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 QUOTAS = "qt";

        /**
1488
         * The {@code mbox-quotas} of the message.
Wink Saville's avatar
Wink Saville committed
1489
         * <P>Type: TEXT</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 = "mb_qt";

        /**
1497
         * The {@code mbox-quotas-token} 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 MBOX_QUOTAS_TOKEN = "mb_qt_tok";

        /**
1506
         * The {@code message-count} 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 MESSAGE_COUNT = "m_cnt";

        /**
1515
         * The {@code start} of the message.
Wink Saville's avatar
Wink Saville committed
1516
         * <P>Type: INTEGER</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 START = "start";

        /**
1524
         * The {@code distribution-indicator} 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 DISTRIBUTION_INDICATOR = "d_ind";

        /**
1533
         * The {@code element-descriptor} of the message.
Wink Saville's avatar
Wink Saville committed
1534
         * <P>Type: TEXT</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 ELEMENT_DESCRIPTOR = "e_des";

        /**
1542
         * The {@code limit} 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 LIMIT = "limit";

        /**
1551
         * The {@code recommended-retrieval-mode} of the message.
Wink Saville's avatar
Wink Saville committed
1552
         * <P>Type: INTEGER</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 = "r_r_mod";

        /**
1560
         * The {@code recommended-retrieval-mode-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 RECOMMENDED_RETRIEVAL_MODE_TEXT = "r_r_mod_txt";

        /**
1569
         * The {@code status-text} 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 STATUS_TEXT = "st_txt";

        /**
1578
         * The {@code 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 APPLIC_ID = "apl_id";

        /**
1587
         * The {@code reply-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 REPLY_APPLIC_ID = "r_apl_id";

        /**
1596
         * The {@code aux-applic-id} 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 AUX_APPLIC_ID = "aux_apl_id";

        /**
1605
         * The {@code drm-content} 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 DRM_CONTENT = "drm_c";

        /**
1614
         * The {@code adaptation-allowed} 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 ADAPTATION_ALLOWED = "adp_a";

        /**
1623
         * The {@code replace-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 REPLACE_ID = "repl_id";

        /**
1632
         * The {@code cancel-id} of the message.
Wink Saville's avatar
Wink Saville committed
1633
         * <P>Type: TEXT</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_ID = "cl_id";

        /**
1641
         * The {@code cancel-status} of the message.
Wink Saville's avatar
Wink Saville committed
1642
         * <P>Type: INTEGER</P>
1643 1644
         * @deprecated this column is no longer supported.
         * @hide
Wink Saville's avatar
Wink Saville committed
1645
         */
1646
        @Deprecated
Wink Saville's avatar
Wink Saville committed
1647 1648 1649
        public static final String CANCEL_STATUS = "cl_st";

        /**
1650
         * Is the message locked?
Wink Saville's avatar
Wink Saville committed
1651 1652 1653
         * <P>Type: INTEGER (boolean)</P>
         */
        public static final String LOCKED = "locked";
Wink Saville's avatar
Wink Saville committed
1654 1655

        /**
1656
         * The subscription to which the message belongs to. Its value will be
1657
         * < 0 if the sub id cannot be determined.
1658
         * <p>Type: INTEGER (long)</p>
Wink Saville's avatar
Wink Saville committed
1659
         */
1660
        public static final String SUBSCRIPTION_ID = "sub_id";
Wink Saville's avatar
Wink Saville committed
1661

1662
        /**
1663 1664
         * The identity of the sender of a sent message. It is
         * usually the package name of the app which sends the message.
1665 1666
         * <p class="note"><strong>Note:</strong>
         * This column is read-only. It is set by the provider and can not be changed by apps.
1667
         * <p>Type: TEXT</p>
1668 1669
         */
        public static final String CREATOR = "creator";
Wink Saville's avatar
Wink Saville committed
1670 1671 1672
    }

    /**
1673
     * Columns for the "canonical_addresses" table used by MMS and SMS.
Wink Saville's avatar
Wink Saville committed
1674 1675 1676 1677 1678 1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689
     */
    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 {
1690

Wink Saville's avatar
Wink Saville committed
1691 1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 1707 1708
        /**
         * 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";
1709

Wink Saville's avatar
Wink Saville committed
1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 1720
        /**
         * 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";
1721

Wink Saville's avatar
Wink Saville committed
1722 1723 1724 1725 1726
        /**
         * The charset of the snippet.
         * <P>Type: INTEGER</P>
         */
        public static final String SNIPPET_CHARSET = "snippet_cs";
1727

Wink Saville's avatar
Wink Saville committed
1728
        /**
1729 1730
         * Type of the thread, either {@link Threads#COMMON_THREAD} or
         * {@link Threads#BROADCAST_THREAD}.
Wink Saville's avatar
Wink Saville committed
1731 1732 1733
         * <P>Type: INTEGER</P>
         */
        public static final String TYPE = "type";
1734

Wink Saville's avatar
Wink Saville committed
1735 1736 1737 1738 1739
        /**
         * Indicates whether there is a transmission error in the thread.
         * <P>Type: INTEGER</P>
         */
        public static final String ERROR = "error";
1740

Wink Saville's avatar
Wink Saville committed
1741 1742 1743 1744 1745
        /**
         * Indicates whether this thread contains any attachments.
         * <P>Type: INTEGER</P>
         */
        public static final String HAS_ATTACHMENT = "has_attachment";
1746 1747 1748

        /**
         * If the thread is archived
1749
         * <P>Type: INTEGER (boolean)</P>
1750 1751
         */
        public static final String ARCHIVED = "archived";
Wink Saville's avatar
Wink Saville committed
1752 1753 1754 1755 1756 1757
    }

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

Wink Saville's avatar
Wink Saville committed
1759
        private static final String[] ID_PROJECTION = { BaseColumns._ID };
1760 1761 1762 1763 1764

        /**
         * 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
1765 1766
        private static final Uri THREAD_ID_CONTENT_URI = Uri.parse(
                "content://mms-sms/threadID");
1767 1768 1769 1770

        /**
         * The {@code content://} style URL for this table, by conversation.
         */
Wink Saville's avatar
Wink Saville committed
1771 1772
        public static final Uri CONTENT_URI = Uri.withAppendedPath(
                MmsSms.CONTENT_URI, "conversations");
1773 1774 1775 1776

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

1780
        /** Thread type: common thread. */
Wink Saville's avatar
Wink Saville committed
1781
        public static final int COMMON_THREAD    = 0;
1782 1783

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

1786 1787 1788 1789
        /**
         * Not instantiable.
         * @hide
         */
Wink Saville's avatar
Wink Saville committed
1790 1791 1792 1793
        private Threads() {
        }

        /**
1794 1795 1796 1797
         * 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
1798 1799 1800 1801 1802 1803 1804 1805 1806 1807 1808 1809 1810 1811
         */
        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.
         *
1812 1813 1814
         * <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
1815 1816 1817 1818 1819 1820 1821 1822 1823 1824 1825 1826 1827 1828
         */
        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
1829
            //if (DEBUG) Rlog.v(TAG, "getOrCreateThreadId uri: " + uri);
Wink Saville's avatar
Wink Saville committed
1830 1831 1832 1833 1834 1835 1836 1837

            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
1838
                        Rlog.e(TAG, "getOrCreateThreadId returned no rows!");
Wink Saville's avatar
Wink Saville committed
1839 1840 1841 1842 1843 1844
                    }
                } finally {
                    cursor.close();
                }
            }

1845
            Rlog.e(TAG, "getOrCreateThreadId failed with " + recipients.size() + " recipients");
Wink Saville's avatar
Wink Saville committed
1846 1847 1848 1849 1850 1851 1852 1853
            throw new IllegalArgumentException("Unable to find or allocate a thread ID.");
        }
    }

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

Wink Saville's avatar
Wink Saville committed
1855
        /**
1856 1857 1858 1859 1860 1861 1862 1863
         * Not instantiable.
         * @hide
         */
        private Mms() {
        }

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

1867 1868 1869
        /**
         * Content URI for getting MMS report requests.
         */
Wink Saville's avatar
Wink Saville committed
1870 1871 1872
        public static final Uri REPORT_REQUEST_URI = Uri.withAppendedPath(
                                            CONTENT_URI, "report-request");

1873 1874 1875
        /**
         * Content URI for getting MMS report status.
         */
Wink Saville's avatar
Wink Saville committed
1876 1877 1878 1879
        public static final Uri REPORT_STATUS_URI = Uri.withAppendedPath(
                                            CONTENT_URI, "report-status");

        /**
1880
         * The default sort order for this table.
Wink Saville's avatar
Wink Saville committed
1881 1882 1883 1884
         */
        public static final String DEFAULT_SORT_ORDER = "date DESC";

        /**
1885 1886 1887 1888 1889 1890 1891
         * 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
1892 1893 1894 1895 1896
         */
        public static final Pattern NAME_ADDR_EMAIL_PATTERN =
                Pattern.compile("\\s*(\"[^\"]*\"|[^<>\"]+)\\s*<([^<>]+)>\\s*");

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

1905 1906 1907 1908 1909
        /**
         * Helper method to query this table.
         * @hide
         */
        public static Cursor query(
Wink Saville's avatar
Wink Saville committed
1910 1911 1912 1913 1914 1915
                ContentResolver cr, String[] projection,
                String where, String orderBy) {
            return cr.query(CONTENT_URI, projection,
                    where, null, orderBy == null ? DEFAULT_SORT_ORDER : orderBy);
        }

1916 1917 1918 1919
        /**
         * Helper method to extract email address from address string.
         * @hide
         */
Wink Saville's avatar
Wink Saville committed
1920 1921 1922 1923 1924 1925 1926 1927 1928 1929
        public static String extractAddrSpec(String address) {
            Matcher match = NAME_ADDR_EMAIL_PATTERN.matcher(address);

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

        /**
1930
         * Is the specified address an email address?
Wink Saville's avatar
Wink Saville committed
1931
         *
1932 1933 1934
         * @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
1935 1936 1937 1938 1939 1940 1941 1942 1943 1944 1945 1946
         */
        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();
        }

        /**
1947
         * Is the specified number a phone number?
Wink Saville's avatar
Wink Saville committed
1948
         *
1949 1950 1951
         * @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
1952 1953 1954 1955 1956 1957 1958 1959 1960 1961 1962
         */
        public static boolean isPhoneNumber(String number) {
            if (TextUtils.isEmpty(number)) {
                return false;
            }

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

        /**
1963
         * Contains all MMS messages in the MMS app inbox.
Wink Saville's avatar
Wink Saville committed
1964 1965
         */
        public static final class Inbox implements BaseMmsColumns {
1966 1967 1968 1969 1970 1971 1972 1973

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

Wink Saville's avatar
Wink Saville committed
1974
            /**
1975
             * The {@code content://} style URL for this table.
Wink Saville's avatar
Wink Saville committed
1976 1977 1978 1979 1980
             */
            public static final Uri
                    CONTENT_URI = Uri.parse("content://mms/inbox");

            /**
1981
             * The default sort order for this table.
Wink Saville's avatar
Wink Saville committed
1982 1983 1984 1985 1986
             */
            public static final String DEFAULT_SORT_ORDER = "date DESC";
        }

        /**
1987
         * Contains all MMS messages in the MMS app sent folder.
Wink Saville's avatar
Wink Saville committed
1988 1989
         */
        public static final class Sent implements BaseMmsColumns {
1990

Wink Saville's avatar
Wink Saville committed
1991
            /**
1992 1993 1994 1995 1996 1997 1998 1999
             * Not instantiable.
             * @hide
             */
            private Sent() {
            }

            /**
             * The {@code content://} style URL for this table.
Wink Saville's avatar
Wink Saville committed
2000 2001 2002 2003 2004
             */
            public static final Uri
                    CONTENT_URI = Uri.parse("content://mms/sent");

            /**
2005
             * The default sort order for this table.
Wink Saville's avatar
Wink Saville committed
2006 2007 2008 2009 2010
             */
            public static final String DEFAULT_SORT_ORDER = "date DESC";
        }

        /**
2011
         * Contains all MMS messages in the MMS app drafts folder.
Wink Saville's avatar
Wink Saville committed
2012 2013
         */
        public static final class Draft implements BaseMmsColumns {
2014

Wink Saville's avatar
Wink Saville committed
2015
            /**
2016 2017 2018 2019 2020 2021 2022 2023
             * Not instantiable.
             * @hide
             */
            private Draft() {
            }

            /**
             * The {@code content://} style URL for this table.
Wink Saville's avatar
Wink Saville committed
2024 2025 2026 2027 2028
             */
            public static final Uri
                    CONTENT_URI = Uri.parse("content://mms/drafts");

            /**
2029
             * The default sort order for this table.
Wink Saville's avatar
Wink Saville committed
2030 2031 2032 2033 2034
             */
            public static final String DEFAULT_SORT_ORDER = "date DESC";
        }

        /**
2035
         * Contains all MMS messages in the MMS app outbox.
Wink Saville's avatar
Wink Saville committed
2036 2037
         */
        public static final class Outbox implements BaseMmsColumns {
2038

Wink Saville's avatar
Wink Saville committed
2039
            /**
2040 2041 2042 2043 2044 2045 2046 2047
             * Not instantiable.
             * @hide
             */
            private Outbox() {
            }

            /**
             * The {@code content://} style URL for this table.
Wink Saville's avatar
Wink Saville committed
2048 2049 2050 2051 2052
             */
            public static final Uri
                    CONTENT_URI = Uri.parse("content://mms/outbox");

            /**
2053
             * The default sort order for this table.
Wink Saville's avatar
Wink Saville committed
2054 2055 2056 2057
             */
            public static final String DEFAULT_SORT_ORDER = "date DESC";
        }

2058 2059 2060
        /**
         * Contains address information for an MMS message.
         */
Wink Saville's avatar
Wink Saville committed
2061
        public static final class Addr implements BaseColumns {
2062 2063 2064 2065 2066 2067 2068 2069

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

Wink Saville's avatar
Wink Saville committed
2070 2071
            /**
             * The ID of MM which this address entry belongs to.
2072
             * <P>Type: INTEGER (long)</P>
Wink Saville's avatar
Wink Saville committed
2073 2074 2075 2076 2077
             */
            public static final String MSG_ID = "msg_id";

            /**
             * The ID of contact entry in Phone Book.
2078
             * <P>Type: INTEGER (long)</P>
Wink Saville's avatar
Wink Saville committed
2079 2080 2081 2082 2083
             */
            public static final String CONTACT_ID = "contact_id";

            /**
             * The address text.
2084
             * <P>Type: TEXT</P>
Wink Saville's avatar
Wink Saville committed
2085 2086 2087 2088
             */
            public static final String ADDRESS = "address";

            /**
2089 2090 2091
             * 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
2092 2093 2094 2095
             */
            public static final String TYPE = "type";

            /**
2096 2097
             * Character set of this entry (MMS charset value).
             * <P>Type: INTEGER</P>
Wink Saville's avatar
Wink Saville committed
2098 2099 2100 2101
             */
            public static final String CHARSET = "charset";
        }

2102 2103 2104
        /**
         * Contains message parts.
         */
Wink Saville's avatar
Wink Saville committed
2105
        public static final class Part implements BaseColumns {
2106 2107 2108 2109 2110 2111 2112 2113

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

Wink Saville's avatar
Wink Saville committed
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 2172 2173 2174 2175 2176 2177 2178 2179 2180
            /**
             * 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";

            /**
2181
             * The location (on filesystem) of the binary data of the part.
Wink Saville's avatar
Wink Saville committed
2182 2183 2184 2185
             * <P>Type: INTEGER</P>
             */
            public static final String _DATA = "_data";

2186 2187 2188 2189
            /**
             * The message text.
             * <P>Type: TEXT</P>
             */
Wink Saville's avatar
Wink Saville committed
2190 2191 2192
            public static final String TEXT = "text";
        }

2193 2194 2195
        /**
         * Message send rate table.
         */
Wink Saville's avatar
Wink Saville committed
2196
        public static final class Rate {
2197 2198 2199 2200 2201 2202 2203 2204 2205 2206 2207

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

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

Wink Saville's avatar
Wink Saville committed
2211 2212
            /**
             * When a message was successfully sent.
2213
             * <P>Type: INTEGER (long)</P>
Wink Saville's avatar
Wink Saville committed
2214 2215 2216 2217
             */
            public static final String SENT_TIME = "sent_time";
        }

2218 2219 2220
        /**
         * Intents class.
         */
Wink Saville's avatar
Wink Saville committed
2221 2222 2223
        public static final class Intents {

            /**
2224 2225
             * Not instantiable.
             * @hide
Wink Saville's avatar
Wink Saville committed
2226
             */
2227 2228 2229
            private Intents() {
            }

Wink Saville's avatar
Wink Saville committed
2230 2231 2232 2233 2234
            /**
             * Indicates that the contents of specified URIs were changed.
             * The application which is showing or caching these contents
             * should be updated.
             */
2235 2236 2237 2238
            @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION)
            public static final String CONTENT_CHANGED_ACTION
                    = "android.intent.action.CONTENT_CHANGED";

Wink Saville's avatar
Wink Saville committed
2239 2240 2241 2242 2243 2244 2245 2246 2247 2248 2249
            /**
             * 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 {
2250 2251 2252 2253 2254 2255 2256 2257

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

Wink Saville's avatar
Wink Saville committed
2258
        /**
2259
         * The column to distinguish SMS and MMS messages in query results.
Wink Saville's avatar
Wink Saville committed
2260 2261 2262 2263
         */
        public static final String TYPE_DISCRIMINATOR_COLUMN =
                "transport_type";

2264 2265 2266
        /**
         * The {@code content://} style URL for this table.
         */
Wink Saville's avatar
Wink Saville committed
2267 2268
        public static final Uri CONTENT_URI = Uri.parse("content://mms-sms/");

2269 2270 2271
        /**
         * The {@code content://} style URL for this table, by conversation.
         */
Wink Saville's avatar
Wink Saville committed
2272 2273 2274
        public static final Uri CONTENT_CONVERSATIONS_URI = Uri.parse(
                "content://mms-sms/conversations");

2275 2276 2277
        /**
         * The {@code content://} style URL for this table, by phone number.
         */
Wink Saville's avatar
Wink Saville committed
2278 2279 2280
        public static final Uri CONTENT_FILTER_BYPHONE_URI = Uri.parse(
                "content://mms-sms/messages/byphone");

2281 2282 2283
        /**
         * The {@code content://} style URL for undelivered messages in this table.
         */
Wink Saville's avatar
Wink Saville committed
2284 2285 2286
        public static final Uri CONTENT_UNDELIVERED_URI = Uri.parse(
                "content://mms-sms/undelivered");

2287 2288 2289
        /**
         * The {@code content://} style URL for draft messages in this table.
         */
Wink Saville's avatar
Wink Saville committed
2290 2291 2292
        public static final Uri CONTENT_DRAFT_URI = Uri.parse(
                "content://mms-sms/draft");

2293 2294 2295
        /**
         * The {@code content://} style URL for locked messages in this table.
         */
Wink Saville's avatar
Wink Saville committed
2296 2297 2298
        public static final Uri CONTENT_LOCKED_URI = Uri.parse(
                "content://mms-sms/locked");

2299 2300 2301
        /**
         * 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
2302 2303 2304 2305 2306
         */
        public static final Uri SEARCH_URI = Uri.parse(
                "content://mms-sms/search");

        // Constants for message protocol types.
2307 2308

        /** SMS protocol type. */
Wink Saville's avatar
Wink Saville committed
2309
        public static final int SMS_PROTO = 0;
2310 2311

        /** MMS protocol type. */
Wink Saville's avatar
Wink Saville committed
2312 2313 2314
        public static final int MMS_PROTO = 1;

        // Constants for error types of pending messages.
2315 2316

        /** Error type: no error. */
Wink Saville's avatar
Wink Saville committed
2317
        public static final int NO_ERROR                      = 0;
2318 2319

        /** Error type: generic transient error. */
Wink Saville's avatar
Wink Saville committed
2320
        public static final int ERR_TYPE_GENERIC              = 1;
2321 2322

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

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

        /** Error type: transport failure. */
Wink Saville's avatar
Wink Saville committed
2329
        public static final int ERR_TYPE_TRANSPORT_FAILURE    = 4;
2330 2331

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

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

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

2340 2341 2342
        /**
         * Contains pending messages info.
         */
Wink Saville's avatar
Wink Saville committed
2343
        public static final class PendingMessages implements BaseColumns {
2344 2345 2346 2347 2348 2349 2350 2351

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

Wink Saville's avatar
Wink Saville committed
2352 2353
            public static final Uri CONTENT_URI = Uri.withAppendedPath(
                    MmsSms.CONTENT_URI, "pending");
2354

Wink Saville's avatar
Wink Saville committed
2355
            /**
2356
             * The type of transport protocol (MMS or SMS).
Wink Saville's avatar
Wink Saville committed
2357 2358 2359
             * <P>Type: INTEGER</P>
             */
            public static final String PROTO_TYPE = "proto_type";
2360

Wink Saville's avatar
Wink Saville committed
2361 2362
            /**
             * The ID of the message to be sent or downloaded.
2363
             * <P>Type: INTEGER (long)</P>
Wink Saville's avatar
Wink Saville committed
2364 2365
             */
            public static final String MSG_ID = "msg_id";
2366

Wink Saville's avatar
Wink Saville committed
2367 2368
            /**
             * The type of the message to be sent or downloaded.
2369 2370
             * 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
2371 2372
             */
            public static final String MSG_TYPE = "msg_type";
2373

Wink Saville's avatar
Wink Saville committed
2374 2375 2376 2377 2378
            /**
             * The type of the error code.
             * <P>Type: INTEGER</P>
             */
            public static final String ERROR_TYPE = "err_type";
2379

Wink Saville's avatar
Wink Saville committed
2380 2381
            /**
             * The error code of sending/retrieving process.
2382
             * <P>Type: INTEGER</P>
Wink Saville's avatar
Wink Saville committed
2383 2384
             */
            public static final String ERROR_CODE = "err_code";
2385

Wink Saville's avatar
Wink Saville committed
2386 2387
            /**
             * How many times we tried to send or download the message.
2388
             * <P>Type: INTEGER</P>
Wink Saville's avatar
Wink Saville committed
2389 2390
             */
            public static final String RETRY_INDEX = "retry_index";
2391

Wink Saville's avatar
Wink Saville committed
2392 2393
            /**
             * The time to do next retry.
2394
             * <P>Type: INTEGER (long)</P>
Wink Saville's avatar
Wink Saville committed
2395 2396
             */
            public static final String DUE_TIME = "due_time";
2397

Wink Saville's avatar
Wink Saville committed
2398 2399
            /**
             * The time we last tried to send or download the message.
2400
             * <P>Type: INTEGER (long)</P>
Wink Saville's avatar
Wink Saville committed
2401 2402
             */
            public static final String LAST_TRY = "last_try";
Wink Saville's avatar
Wink Saville committed
2403 2404

            /**
2405
             * The subscription to which the message belongs to. Its value will be
2406
             * < 0 if the sub id cannot be determined.
Wink Saville's avatar
Wink Saville committed
2407 2408
             * <p>Type: INTEGER (long) </p>
             */
2409
            public static final String SUBSCRIPTION_ID = "pending_sub_id";
Wink Saville's avatar
Wink Saville committed
2410 2411
        }

2412 2413 2414 2415
        /**
         * Words table used by provider for full-text searches.
         * @hide
         */
Wink Saville's avatar
Wink Saville committed
2416
        public static final class WordsTable {
2417 2418 2419 2420 2421 2422 2423 2424 2425 2426 2427

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

            /**
             * Primary key.
             * <P>Type: INTEGER (long)</P>
             */
Wink Saville's avatar
Wink Saville committed
2428
            public static final String ID = "_id";
2429 2430 2431 2432 2433

            /**
             * Source row ID.
             * <P>Type: INTEGER (long)</P>
             */
Wink Saville's avatar
Wink Saville committed
2434
            public static final String SOURCE_ROW_ID = "source_id";
2435 2436 2437 2438 2439

            /**
             * Table ID (either 1 or 2).
             * <P>Type: INTEGER</P>
             */
Wink Saville's avatar
Wink Saville committed
2440
            public static final String TABLE_ID = "table_to_use";
2441 2442 2443 2444 2445

            /**
             * The words to index.
             * <P>Type: TEXT</P>
             */
Wink Saville's avatar
Wink Saville committed
2446 2447 2448 2449
            public static final String INDEXED_TEXT = "index_text";
        }
    }

2450 2451 2452
    /**
     * Carriers class contains information about APNs, including MMSC information.
     */
Wink Saville's avatar
Wink Saville committed
2453
    public static final class Carriers implements BaseColumns {
2454 2455 2456 2457 2458 2459 2460

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

Wink Saville's avatar
Wink Saville committed
2461
        /**
2462
         * The {@code content://} style URL for this table.
Wink Saville's avatar
Wink Saville committed
2463
         */
2464
        public static final Uri CONTENT_URI = Uri.parse("content://telephony/carriers");
Wink Saville's avatar
Wink Saville committed
2465 2466

        /**
2467
         * The default sort order for this table.
Wink Saville's avatar
Wink Saville committed
2468 2469 2470
         */
        public static final String DEFAULT_SORT_ORDER = "name ASC";

2471 2472 2473 2474
        /**
         * Entry name.
         * <P>Type: TEXT</P>
         */
Wink Saville's avatar
Wink Saville committed
2475 2476
        public static final String NAME = "name";

2477 2478 2479 2480
        /**
         * APN name.
         * <P>Type: TEXT</P>
         */
Wink Saville's avatar
Wink Saville committed
2481 2482
        public static final String APN = "apn";

2483 2484 2485 2486
        /**
         * Proxy address.
         * <P>Type: TEXT</P>
         */
Wink Saville's avatar
Wink Saville committed
2487 2488
        public static final String PROXY = "proxy";

2489 2490 2491 2492
        /**
         * Proxy port.
         * <P>Type: TEXT</P>
         */
Wink Saville's avatar
Wink Saville committed
2493 2494
        public static final String PORT = "port";

2495 2496 2497 2498
        /**
         * MMS proxy address.
         * <P>Type: TEXT</P>
         */
Wink Saville's avatar
Wink Saville committed
2499 2500
        public static final String MMSPROXY = "mmsproxy";

2501 2502 2503 2504
        /**
         * MMS proxy port.
         * <P>Type: TEXT</P>
         */
Wink Saville's avatar
Wink Saville committed
2505 2506
        public static final String MMSPORT = "mmsport";

2507 2508 2509 2510
        /**
         * Server address.
         * <P>Type: TEXT</P>
         */
Wink Saville's avatar
Wink Saville committed
2511 2512
        public static final String SERVER = "server";

2513 2514 2515 2516
        /**
         * APN username.
         * <P>Type: TEXT</P>
         */
Wink Saville's avatar
Wink Saville committed
2517 2518
        public static final String USER = "user";

2519 2520 2521 2522
        /**
         * APN password.
         * <P>Type: TEXT</P>
         */
Wink Saville's avatar
Wink Saville committed
2523 2524
        public static final String PASSWORD = "password";

2525 2526 2527 2528
        /**
         * MMSC URL.
         * <P>Type: TEXT</P>
         */
Wink Saville's avatar
Wink Saville committed
2529 2530
        public static final String MMSC = "mmsc";

2531 2532 2533 2534
        /**
         * Mobile Country Code (MCC).
         * <P>Type: TEXT</P>
         */
Wink Saville's avatar
Wink Saville committed
2535 2536
        public static final String MCC = "mcc";

2537 2538 2539 2540
        /**
         * Mobile Network Code (MNC).
         * <P>Type: TEXT</P>
         */
Wink Saville's avatar
Wink Saville committed
2541 2542
        public static final String MNC = "mnc";

2543 2544 2545 2546
        /**
         * Numeric operator ID (as String). Usually {@code MCC + MNC}.
         * <P>Type: TEXT</P>
         */
Wink Saville's avatar
Wink Saville committed
2547 2548
        public static final String NUMERIC = "numeric";

2549 2550 2551 2552
        /**
         * Authentication type.
         * <P>Type:  INTEGER</P>
         */
Wink Saville's avatar
Wink Saville committed
2553 2554
        public static final String AUTH_TYPE = "authtype";

2555 2556 2557 2558
        /**
         * Comma-delimited list of APN types.
         * <P>Type: TEXT</P>
         */
Wink Saville's avatar
Wink Saville committed
2559 2560 2561
        public static final String TYPE = "type";

        /**
2562
         * The protocol to use to connect to this APN.
Wink Saville's avatar
Wink Saville committed
2563
         *
2564 2565 2566
         * 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
2567 2568 2569 2570
         */
        public static final String PROTOCOL = "protocol";

        /**
2571 2572 2573 2574
         * 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
2575 2576
        public static final String ROAMING_PROTOCOL = "roaming_protocol";

2577 2578 2579 2580
        /**
         * Is this the current APN?
         * <P>Type: INTEGER (boolean)</P>
         */
Wink Saville's avatar
Wink Saville committed
2581 2582 2583
        public static final String CURRENT = "current";

        /**
2584 2585 2586
         * Is this APN enabled?
         * <P>Type: INTEGER (boolean)</P>
         */
Wink Saville's avatar
Wink Saville committed
2587 2588 2589
        public static final String CARRIER_ENABLED = "carrier_enabled";

        /**
2590 2591 2592 2593 2594 2595
         * 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
2596
        public static final String BEARER = "bearer";
2597

Amit Mahajan's avatar
Amit Mahajan committed
2598 2599 2600 2601 2602 2603 2604
        /**
         * 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
2605
         * @hide
Amit Mahajan's avatar
Amit Mahajan committed
2606 2607 2608
         */
        public static final String BEARER_BITMASK = "bearer_bitmask";

2609
        /**
2610 2611 2612 2613
         * MVNO type:
         * {@code SPN (Service Provider Name), IMSI, GID (Group Identifier Level 1)}.
         * <P>Type: TEXT</P>
         */
2614 2615 2616
        public static final String MVNO_TYPE = "mvno_type";

        /**
2617 2618 2619 2620 2621 2622 2623 2624 2625
         * 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>
         */
2626
        public static final String MVNO_MATCH_DATA = "mvno_match_data";
Wink Saville's avatar
Wink Saville committed
2627 2628

        /**
2629
         * The subscription to which the APN belongs to
Wink Saville's avatar
Wink Saville committed
2630 2631
         * <p>Type: INTEGER (long) </p>
         */
2632
        public static final String SUBSCRIPTION_ID = "sub_id";
Wink Saville's avatar
Wink Saville committed
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 2660 2661 2662 2663 2664 2665 2666 2667 2668
        /**
         * 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";

2669 2670 2671 2672 2673 2674
        /**
         * The MTU size of the mobile interface to  which the APN connected
         * <p>Type: INTEGER </p>
         * @hide
         */
        public static final String MTU = "mtu";
2675 2676

        /**
2677
         * Is this APN added/edited/deleted by a user or carrier?
2678 2679 2680
         * <p>Type: INTEGER </p>
         * @hide
         */
Amit Mahajan's avatar
Amit Mahajan committed
2681
        public static final String EDITED = "edited";
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 2708 2709 2710 2711 2712 2713 2714 2715 2716

        /**
         * 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
2717 2718 2719 2720
    }

    /**
     * Contains received SMS cell broadcast messages.
2721
     * @hide
Wink Saville's avatar
Wink Saville committed
2722 2723 2724
     */
    public static final class CellBroadcasts implements BaseColumns {

2725 2726 2727 2728
        /**
         * Not instantiable.
         * @hide
         */
Wink Saville's avatar
Wink Saville committed
2729 2730 2731
        private CellBroadcasts() {}

        /**
2732
         * The {@code content://} URI for this table.
Wink Saville's avatar
Wink Saville committed
2733
         */
2734
        public static final Uri CONTENT_URI = Uri.parse("content://cellbroadcasts");
Wink Saville's avatar
Wink Saville committed
2735 2736 2737 2738 2739 2740 2741 2742 2743 2744 2745 2746 2747 2748

        /**
         * 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";

        /**
2749 2750
         * 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
2751 2752 2753 2754 2755 2756 2757 2758 2759 2760 2761 2762 2763 2764 2765 2766 2767 2768 2769
         * <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";

        /**
2770
         * Message code. <em>OBSOLETE: merged into SERIAL_NUMBER.</em>
Wink Saville's avatar
Wink Saville committed
2771 2772 2773 2774 2775
         * <P>Type: INTEGER</P>
         */
        public static final String V1_MESSAGE_CODE = "message_code";

        /**
2776
         * Message identifier. <em>OBSOLETE: renamed to SERVICE_CATEGORY.</em>
Wink Saville's avatar
Wink Saville committed
2777 2778 2779 2780 2781
         * <P>Type: INTEGER</P>
         */
        public static final String V1_MESSAGE_IDENTIFIER = "message_id";

        /**
2782
         * Service category (GSM/UMTS: message identifier; CDMA: service category).
Wink Saville's avatar
Wink Saville committed
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 2856 2857 2858 2859 2860 2861 2862 2863 2864
         * <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";

2865
        /** The default sort order for this table. */
Wink Saville's avatar
Wink Saville committed
2866 2867 2868 2869 2870 2871 2872 2873 2874 2875 2876 2877 2878 2879 2880 2881 2882 2883 2884 2885 2886 2887 2888 2889 2890 2891 2892 2893 2894
        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
        };
    }
}