Telephony.java revision c1fd61bf259f192afbbdb58db15d64fa95c0befb
1/* 2 * Copyright (C) 2006 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17package android.provider; 18 19import android.annotation.SdkConstant; 20import android.annotation.SdkConstant.SdkConstantType; 21import android.content.ComponentName; 22import android.content.ContentResolver; 23import android.content.ContentValues; 24import android.content.Context; 25import android.content.Intent; 26import android.database.Cursor; 27import android.database.sqlite.SqliteWrapper; 28import android.net.Uri; 29import android.telephony.SmsMessage; 30import android.telephony.SubscriptionManager; 31import android.text.TextUtils; 32import android.telephony.Rlog; 33import android.util.Patterns; 34 35import com.android.internal.telephony.PhoneConstants; 36import com.android.internal.telephony.SmsApplication; 37 38 39import java.util.HashSet; 40import java.util.Set; 41import java.util.regex.Matcher; 42import java.util.regex.Pattern; 43 44/** 45 * The Telephony provider contains data related to phone operation, specifically SMS and MMS 46 * messages and access to the APN list, including the MMSC to use. 47 * 48 * <p class="note"><strong>Note:</strong> These APIs are not available on all Android-powered 49 * devices. If your app depends on telephony features such as for managing SMS messages, include 50 * a <a href="{@docRoot}guide/topics/manifest/uses-feature-element.html">{@code <uses-feature>} 51 * </a> element in your manifest that declares the {@code "android.hardware.telephony"} hardware 52 * feature. Alternatively, you can check for telephony availability at runtime using either 53 * {@link android.content.pm.PackageManager#hasSystemFeature 54 * hasSystemFeature(PackageManager.FEATURE_TELEPHONY)} or {@link 55 * android.telephony.TelephonyManager#getPhoneType}.</p> 56 * 57 * <h3>Creating an SMS app</h3> 58 * 59 * <p>Only the default SMS app (selected by the user in system settings) is able to write to the 60 * SMS Provider (the tables defined within the {@code Telephony} class) and only the default SMS 61 * app receives the {@link android.provider.Telephony.Sms.Intents#SMS_DELIVER_ACTION} broadcast 62 * when the user receives an SMS or the {@link 63 * android.provider.Telephony.Sms.Intents#WAP_PUSH_DELIVER_ACTION} broadcast when the user 64 * receives an MMS.</p> 65 * 66 * <p>Any app that wants to behave as the user's default SMS app must handle the following intents: 67 * <ul> 68 * <li>In a broadcast receiver, include an intent filter for {@link Sms.Intents#SMS_DELIVER_ACTION} 69 * (<code>"android.provider.Telephony.SMS_DELIVER"</code>). The broadcast receiver must also 70 * require the {@link android.Manifest.permission#BROADCAST_SMS} permission. 71 * <p>This allows your app to directly receive incoming SMS messages.</p></li> 72 * <li>In a broadcast receiver, include an intent filter for {@link 73 * Sms.Intents#WAP_PUSH_DELIVER_ACTION}} ({@code "android.provider.Telephony.WAP_PUSH_DELIVER"}) 74 * with the MIME type <code>"application/vnd.wap.mms-message"</code>. 75 * The broadcast receiver must also require the {@link 76 * android.Manifest.permission#BROADCAST_WAP_PUSH} permission. 77 * <p>This allows your app to directly receive incoming MMS messages.</p></li> 78 * <li>In your activity that delivers new messages, include an intent filter for 79 * {@link android.content.Intent#ACTION_SENDTO} (<code>"android.intent.action.SENDTO" 80 * </code>) with schemas, <code>sms:</code>, <code>smsto:</code>, <code>mms:</code>, and 81 * <code>mmsto:</code>. 82 * <p>This allows your app to receive intents from other apps that want to deliver a 83 * message.</p></li> 84 * <li>In a service, include an intent filter for {@link 85 * android.telephony.TelephonyManager#ACTION_RESPOND_VIA_MESSAGE} 86 * (<code>"android.intent.action.RESPOND_VIA_MESSAGE"</code>) with schemas, 87 * <code>sms:</code>, <code>smsto:</code>, <code>mms:</code>, and <code>mmsto:</code>. 88 * This service must also require the {@link 89 * android.Manifest.permission#SEND_RESPOND_VIA_MESSAGE} permission. 90 * <p>This allows users to respond to incoming phone calls with an immediate text message 91 * using your app.</p></li> 92 * </ul> 93 * 94 * <p>Other apps that are not selected as the default SMS app can only <em>read</em> the SMS 95 * Provider, but may also be notified when a new SMS arrives by listening for the {@link 96 * Sms.Intents#SMS_RECEIVED_ACTION} 97 * broadcast, which is a non-abortable broadcast that may be delivered to multiple apps. This 98 * broadcast is intended for apps that—while not selected as the default SMS app—need to 99 * read special incoming messages such as to perform phone number verification.</p> 100 * 101 * <p>For more information about building SMS apps, read the blog post, <a 102 * href="http://android-developers.blogspot.com/2013/10/getting-your-sms-apps-ready-for-kitkat.html" 103 * >Getting Your SMS Apps Ready for KitKat</a>.</p> 104 * 105 */ 106public final class Telephony { 107 private static final String TAG = "Telephony"; 108 109 /** 110 * Not instantiable. 111 * @hide 112 */ 113 private Telephony() { 114 } 115 116 /** 117 * Base columns for tables that contain text-based SMSs. 118 */ 119 public interface TextBasedSmsColumns { 120 121 /** Message type: all messages. */ 122 public static final int MESSAGE_TYPE_ALL = 0; 123 124 /** Message type: inbox. */ 125 public static final int MESSAGE_TYPE_INBOX = 1; 126 127 /** Message type: sent messages. */ 128 public static final int MESSAGE_TYPE_SENT = 2; 129 130 /** Message type: drafts. */ 131 public static final int MESSAGE_TYPE_DRAFT = 3; 132 133 /** Message type: outbox. */ 134 public static final int MESSAGE_TYPE_OUTBOX = 4; 135 136 /** Message type: failed outgoing message. */ 137 public static final int MESSAGE_TYPE_FAILED = 5; 138 139 /** Message type: queued to send later. */ 140 public static final int MESSAGE_TYPE_QUEUED = 6; 141 142 /** 143 * The type of message. 144 * <P>Type: INTEGER</P> 145 */ 146 public static final String TYPE = "type"; 147 148 /** 149 * The thread ID of the message. 150 * <P>Type: INTEGER</P> 151 */ 152 public static final String THREAD_ID = "thread_id"; 153 154 /** 155 * The address of the other party. 156 * <P>Type: TEXT</P> 157 */ 158 public static final String ADDRESS = "address"; 159 160 /** 161 * The date the message was received. 162 * <P>Type: INTEGER (long)</P> 163 */ 164 public static final String DATE = "date"; 165 166 /** 167 * The date the message was sent. 168 * <P>Type: INTEGER (long)</P> 169 */ 170 public static final String DATE_SENT = "date_sent"; 171 172 /** 173 * Has the message been read? 174 * <P>Type: INTEGER (boolean)</P> 175 */ 176 public static final String READ = "read"; 177 178 /** 179 * Has the message been seen by the user? The "seen" flag determines 180 * whether we need to show a notification. 181 * <P>Type: INTEGER (boolean)</P> 182 */ 183 public static final String SEEN = "seen"; 184 185 /** 186 * {@code TP-Status} value for the message, or -1 if no status has been received. 187 * <P>Type: INTEGER</P> 188 */ 189 public static final String STATUS = "status"; 190 191 /** TP-Status: no status received. */ 192 public static final int STATUS_NONE = -1; 193 /** TP-Status: complete. */ 194 public static final int STATUS_COMPLETE = 0; 195 /** TP-Status: pending. */ 196 public static final int STATUS_PENDING = 32; 197 /** TP-Status: failed. */ 198 public static final int STATUS_FAILED = 64; 199 200 /** 201 * The subject of the message, if present. 202 * <P>Type: TEXT</P> 203 */ 204 public static final String SUBJECT = "subject"; 205 206 /** 207 * The body of the message. 208 * <P>Type: TEXT</P> 209 */ 210 public static final String BODY = "body"; 211 212 /** 213 * The ID of the sender of the conversation, if present. 214 * <P>Type: INTEGER (reference to item in {@code content://contacts/people})</P> 215 */ 216 public static final String PERSON = "person"; 217 218 /** 219 * The protocol identifier code. 220 * <P>Type: INTEGER</P> 221 */ 222 public static final String PROTOCOL = "protocol"; 223 224 /** 225 * Is the {@code TP-Reply-Path} flag set? 226 * <P>Type: BOOLEAN</P> 227 */ 228 public static final String REPLY_PATH_PRESENT = "reply_path_present"; 229 230 /** 231 * The service center (SC) through which to send the message, if present. 232 * <P>Type: TEXT</P> 233 */ 234 public static final String SERVICE_CENTER = "service_center"; 235 236 /** 237 * Is the message locked? 238 * <P>Type: INTEGER (boolean)</P> 239 */ 240 public static final String LOCKED = "locked"; 241 242 /** 243 * The subscription to which the message belongs to. Its value will be 244 * {@link android.telephony.SubscriptionManager#INVALID_SUBSCRIPTION_ID} if 245 * the sub id cannot be determined. 246 * <p>Type: INTEGER (long) </p> 247 */ 248 public static final String SUBSCRIPTION_ID = "sub_id"; 249 250 /** 251 * The MTU size of the mobile interface to which the APN connected 252 * @hide 253 */ 254 public static final String MTU = "mtu"; 255 256 /** 257 * Error code associated with sending or receiving this message 258 * <P>Type: INTEGER</P> 259 */ 260 public static final String ERROR_CODE = "error_code"; 261 262 /** 263 * The identity of the sender of a sent message. It is 264 * usually the package name of the app which sends the message. 265 * <p class="note"><strong>Note:</strong> 266 * This column is read-only. It is set by the provider and can not be changed by apps. 267 * <p>Type: TEXT</p> 268 */ 269 public static final String CREATOR = "creator"; 270 } 271 272 /** 273 * Contains all text-based SMS messages. 274 */ 275 public static final class Sms implements BaseColumns, TextBasedSmsColumns { 276 277 /** 278 * Not instantiable. 279 * @hide 280 */ 281 private Sms() { 282 } 283 284 /** 285 * Used to determine the currently configured default SMS package. 286 * @param context context of the requesting application 287 * @return package name for the default SMS package or null 288 */ 289 public static String getDefaultSmsPackage(Context context) { 290 ComponentName component = SmsApplication.getDefaultSmsApplication(context, false); 291 if (component != null) { 292 return component.getPackageName(); 293 } 294 return null; 295 } 296 297 /** 298 * Return cursor for table query. 299 * @hide 300 */ 301 public static Cursor query(ContentResolver cr, String[] projection) { 302 return cr.query(CONTENT_URI, projection, null, null, DEFAULT_SORT_ORDER); 303 } 304 305 /** 306 * Return cursor for table query. 307 * @hide 308 */ 309 public static Cursor query(ContentResolver cr, String[] projection, 310 String where, String orderBy) { 311 return cr.query(CONTENT_URI, projection, where, 312 null, orderBy == null ? DEFAULT_SORT_ORDER : orderBy); 313 } 314 315 /** 316 * The {@code content://} style URL for this table. 317 */ 318 public static final Uri CONTENT_URI = Uri.parse("content://sms"); 319 320 /** 321 * The default sort order for this table. 322 */ 323 public static final String DEFAULT_SORT_ORDER = "date DESC"; 324 325 /** 326 * Add an SMS to the given URI. 327 * 328 * @param resolver the content resolver to use 329 * @param uri the URI to add the message to 330 * @param address the address of the sender 331 * @param body the body of the message 332 * @param subject the pseudo-subject of the message 333 * @param date the timestamp for the message 334 * @param read true if the message has been read, false if not 335 * @param deliveryReport true if a delivery report was requested, false if not 336 * @return the URI for the new message 337 * @hide 338 */ 339 public static Uri addMessageToUri(ContentResolver resolver, 340 Uri uri, String address, String body, String subject, 341 Long date, boolean read, boolean deliveryReport) { 342 return addMessageToUri(SubscriptionManager.getDefaultSmsSubId(), 343 resolver, uri, address, body, subject, date, read, deliveryReport, -1L); 344 } 345 346 /** 347 * Add an SMS to the given URI. 348 * 349 * @param resolver the content resolver to use 350 * @param uri the URI to add the message to 351 * @param address the address of the sender 352 * @param body the body of the message 353 * @param subject the psuedo-subject of the message 354 * @param date the timestamp for the message 355 * @param read true if the message has been read, false if not 356 * @param deliveryReport true if a delivery report was requested, false if not 357 * @param subId the subscription which the message belongs to 358 * @return the URI for the new message 359 * @hide 360 */ 361 public static Uri addMessageToUri(int subId, ContentResolver resolver, 362 Uri uri, String address, String body, String subject, 363 Long date, boolean read, boolean deliveryReport) { 364 return addMessageToUri(subId, resolver, uri, address, body, subject, 365 date, read, deliveryReport, -1L); 366 } 367 368 /** 369 * Add an SMS to the given URI with the specified thread ID. 370 * 371 * @param resolver the content resolver to use 372 * @param uri the URI to add the message to 373 * @param address the address of the sender 374 * @param body the body of the message 375 * @param subject the pseudo-subject of the message 376 * @param date the timestamp for the message 377 * @param read true if the message has been read, false if not 378 * @param deliveryReport true if a delivery report was requested, false if not 379 * @param threadId the thread_id of the message 380 * @return the URI for the new message 381 * @hide 382 */ 383 public static Uri addMessageToUri(ContentResolver resolver, 384 Uri uri, String address, String body, String subject, 385 Long date, boolean read, boolean deliveryReport, long threadId) { 386 return addMessageToUri(SubscriptionManager.getDefaultSmsSubId(), 387 resolver, uri, address, body, subject, 388 date, read, deliveryReport, threadId); 389 } 390 391 /** 392 * Add an SMS to the given URI with thread_id specified. 393 * 394 * @param resolver the content resolver to use 395 * @param uri the URI to add the message to 396 * @param address the address of the sender 397 * @param body the body of the message 398 * @param subject the psuedo-subject of the message 399 * @param date the timestamp for the message 400 * @param read true if the message has been read, false if not 401 * @param deliveryReport true if a delivery report was requested, false if not 402 * @param threadId the thread_id of the message 403 * @param subId the subscription which the message belongs to 404 * @return the URI for the new message 405 * @hide 406 */ 407 public static Uri addMessageToUri(int subId, ContentResolver resolver, 408 Uri uri, String address, String body, String subject, 409 Long date, boolean read, boolean deliveryReport, long threadId) { 410 ContentValues values = new ContentValues(8); 411 Rlog.v(TAG,"Telephony addMessageToUri sub id: " + subId); 412 413 values.put(SUBSCRIPTION_ID, subId); 414 values.put(ADDRESS, address); 415 if (date != null) { 416 values.put(DATE, date); 417 } 418 values.put(READ, read ? Integer.valueOf(1) : Integer.valueOf(0)); 419 values.put(SUBJECT, subject); 420 values.put(BODY, body); 421 if (deliveryReport) { 422 values.put(STATUS, STATUS_PENDING); 423 } 424 if (threadId != -1L) { 425 values.put(THREAD_ID, threadId); 426 } 427 return resolver.insert(uri, values); 428 } 429 430 /** 431 * Move a message to the given folder. 432 * 433 * @param context the context to use 434 * @param uri the message to move 435 * @param folder the folder to move to 436 * @return true if the operation succeeded 437 * @hide 438 */ 439 public static boolean moveMessageToFolder(Context context, 440 Uri uri, int folder, int error) { 441 if (uri == null) { 442 return false; 443 } 444 445 boolean markAsUnread = false; 446 boolean markAsRead = false; 447 switch(folder) { 448 case MESSAGE_TYPE_INBOX: 449 case MESSAGE_TYPE_DRAFT: 450 break; 451 case MESSAGE_TYPE_OUTBOX: 452 case MESSAGE_TYPE_SENT: 453 markAsRead = true; 454 break; 455 case MESSAGE_TYPE_FAILED: 456 case MESSAGE_TYPE_QUEUED: 457 markAsUnread = true; 458 break; 459 default: 460 return false; 461 } 462 463 ContentValues values = new ContentValues(3); 464 465 values.put(TYPE, folder); 466 if (markAsUnread) { 467 values.put(READ, 0); 468 } else if (markAsRead) { 469 values.put(READ, 1); 470 } 471 values.put(ERROR_CODE, error); 472 473 return 1 == SqliteWrapper.update(context, context.getContentResolver(), 474 uri, values, null, null); 475 } 476 477 /** 478 * Returns true iff the folder (message type) identifies an 479 * outgoing message. 480 * @hide 481 */ 482 public static boolean isOutgoingFolder(int messageType) { 483 return (messageType == MESSAGE_TYPE_FAILED) 484 || (messageType == MESSAGE_TYPE_OUTBOX) 485 || (messageType == MESSAGE_TYPE_SENT) 486 || (messageType == MESSAGE_TYPE_QUEUED); 487 } 488 489 /** 490 * Contains all text-based SMS messages in the SMS app inbox. 491 */ 492 public static final class Inbox implements BaseColumns, TextBasedSmsColumns { 493 494 /** 495 * Not instantiable. 496 * @hide 497 */ 498 private Inbox() { 499 } 500 501 /** 502 * The {@code content://} style URL for this table. 503 */ 504 public static final Uri CONTENT_URI = Uri.parse("content://sms/inbox"); 505 506 /** 507 * The default sort order for this table. 508 */ 509 public static final String DEFAULT_SORT_ORDER = "date DESC"; 510 511 /** 512 * Add an SMS to the Draft box. 513 * 514 * @param resolver the content resolver to use 515 * @param address the address of the sender 516 * @param body the body of the message 517 * @param subject the pseudo-subject of the message 518 * @param date the timestamp for the message 519 * @param read true if the message has been read, false if not 520 * @return the URI for the new message 521 * @hide 522 */ 523 public static Uri addMessage(ContentResolver resolver, 524 String address, String body, String subject, Long date, 525 boolean read) { 526 return addMessageToUri(SubscriptionManager.getDefaultSmsSubId(), 527 resolver, CONTENT_URI, address, body, subject, date, read, false); 528 } 529 530 /** 531 * Add an SMS to the Draft box. 532 * 533 * @param resolver the content resolver to use 534 * @param address the address of the sender 535 * @param body the body of the message 536 * @param subject the psuedo-subject of the message 537 * @param date the timestamp for the message 538 * @param read true if the message has been read, false if not 539 * @param subId the subscription which the message belongs to 540 * @return the URI for the new message 541 * @hide 542 */ 543 public static Uri addMessage(int subId, ContentResolver resolver, 544 String address, String body, String subject, Long date, boolean read) { 545 return addMessageToUri(subId, resolver, CONTENT_URI, address, body, 546 subject, date, read, false); 547 } 548 } 549 550 /** 551 * Contains all sent text-based SMS messages in the SMS app. 552 */ 553 public static final class Sent implements BaseColumns, TextBasedSmsColumns { 554 555 /** 556 * Not instantiable. 557 * @hide 558 */ 559 private Sent() { 560 } 561 562 /** 563 * The {@code content://} style URL for this table. 564 */ 565 public static final Uri CONTENT_URI = Uri.parse("content://sms/sent"); 566 567 /** 568 * The default sort order for this table. 569 */ 570 public static final String DEFAULT_SORT_ORDER = "date DESC"; 571 572 /** 573 * Add an SMS to the Draft box. 574 * 575 * @param resolver the content resolver to use 576 * @param address the address of the sender 577 * @param body the body of the message 578 * @param subject the pseudo-subject of the message 579 * @param date the timestamp for the message 580 * @return the URI for the new message 581 * @hide 582 */ 583 public static Uri addMessage(ContentResolver resolver, 584 String address, String body, String subject, Long date) { 585 return addMessageToUri(SubscriptionManager.getDefaultSmsSubId(), 586 resolver, CONTENT_URI, address, body, subject, date, true, false); 587 } 588 589 /** 590 * Add an SMS to the Draft box. 591 * 592 * @param resolver the content resolver to use 593 * @param address the address of the sender 594 * @param body the body of the message 595 * @param subject the psuedo-subject of the message 596 * @param date the timestamp for the message 597 * @param subId the subscription which the message belongs to 598 * @return the URI for the new message 599 * @hide 600 */ 601 public static Uri addMessage(int subId, ContentResolver resolver, 602 String address, String body, String subject, Long date) { 603 return addMessageToUri(subId, resolver, CONTENT_URI, address, body, 604 subject, date, true, false); 605 } 606 } 607 608 /** 609 * Contains all sent text-based SMS messages in the SMS app. 610 */ 611 public static final class Draft implements BaseColumns, TextBasedSmsColumns { 612 613 /** 614 * Not instantiable. 615 * @hide 616 */ 617 private Draft() { 618 } 619 620 /** 621 * The {@code content://} style URL for this table. 622 */ 623 public static final Uri CONTENT_URI = Uri.parse("content://sms/draft"); 624 625 /** 626 * @hide 627 */ 628 public static Uri addMessage(ContentResolver resolver, 629 String address, String body, String subject, Long date) { 630 return addMessageToUri(SubscriptionManager.getDefaultSmsSubId(), 631 resolver, CONTENT_URI, address, body, subject, date, true, false); 632 } 633 634 /** 635 * Add an SMS to the Draft box. 636 * 637 * @param resolver the content resolver to use 638 * @param address the address of the sender 639 * @param body the body of the message 640 * @param subject the psuedo-subject of the message 641 * @param date the timestamp for the message 642 * @param subId the subscription which the message belongs to 643 * @return the URI for the new message 644 * @hide 645 */ 646 public static Uri addMessage(int subId, ContentResolver resolver, 647 String address, String body, String subject, Long date) { 648 return addMessageToUri(subId, resolver, CONTENT_URI, address, body, 649 subject, date, true, false); 650 } 651 652 /** 653 * The default sort order for this table. 654 */ 655 public static final String DEFAULT_SORT_ORDER = "date DESC"; 656 } 657 658 /** 659 * Contains all pending outgoing text-based SMS messages. 660 */ 661 public static final class Outbox implements BaseColumns, TextBasedSmsColumns { 662 663 /** 664 * Not instantiable. 665 * @hide 666 */ 667 private Outbox() { 668 } 669 670 /** 671 * The {@code content://} style URL for this table. 672 */ 673 public static final Uri CONTENT_URI = Uri.parse("content://sms/outbox"); 674 675 /** 676 * The default sort order for this table. 677 */ 678 public static final String DEFAULT_SORT_ORDER = "date DESC"; 679 680 /** 681 * Add an SMS to the outbox. 682 * 683 * @param resolver the content resolver to use 684 * @param address the address of the sender 685 * @param body the body of the message 686 * @param subject the pseudo-subject of the message 687 * @param date the timestamp for the message 688 * @param deliveryReport whether a delivery report was requested for the message 689 * @return the URI for the new message 690 * @hide 691 */ 692 public static Uri addMessage(ContentResolver resolver, 693 String address, String body, String subject, Long date, 694 boolean deliveryReport, long threadId) { 695 return addMessageToUri(SubscriptionManager.getDefaultSmsSubId(), 696 resolver, CONTENT_URI, address, body, subject, date, 697 true, deliveryReport, threadId); 698 } 699 700 /** 701 * Add an SMS to the Out box. 702 * 703 * @param resolver the content resolver to use 704 * @param address the address of the sender 705 * @param body the body of the message 706 * @param subject the psuedo-subject of the message 707 * @param date the timestamp for the message 708 * @param deliveryReport whether a delivery report was requested for the message 709 * @param subId the subscription which the message belongs to 710 * @return the URI for the new message 711 * @hide 712 */ 713 public static Uri addMessage(int subId, ContentResolver resolver, 714 String address, String body, String subject, Long date, 715 boolean deliveryReport, long threadId) { 716 return addMessageToUri(subId, resolver, CONTENT_URI, address, body, 717 subject, date, true, deliveryReport, threadId); 718 } 719 } 720 721 /** 722 * Contains all sent text-based SMS messages in the SMS app. 723 */ 724 public static final class Conversations 725 implements BaseColumns, TextBasedSmsColumns { 726 727 /** 728 * Not instantiable. 729 * @hide 730 */ 731 private Conversations() { 732 } 733 734 /** 735 * The {@code content://} style URL for this table. 736 */ 737 public static final Uri CONTENT_URI = Uri.parse("content://sms/conversations"); 738 739 /** 740 * The default sort order for this table. 741 */ 742 public static final String DEFAULT_SORT_ORDER = "date DESC"; 743 744 /** 745 * The first 45 characters of the body of the message. 746 * <P>Type: TEXT</P> 747 */ 748 public static final String SNIPPET = "snippet"; 749 750 /** 751 * The number of messages in the conversation. 752 * <P>Type: INTEGER</P> 753 */ 754 public static final String MESSAGE_COUNT = "msg_count"; 755 } 756 757 /** 758 * Contains constants for SMS related Intents that are broadcast. 759 */ 760 public static final class Intents { 761 762 /** 763 * Not instantiable. 764 * @hide 765 */ 766 private Intents() { 767 } 768 769 /** 770 * Set by BroadcastReceiver to indicate that the message was handled 771 * successfully. 772 */ 773 public static final int RESULT_SMS_HANDLED = 1; 774 775 /** 776 * Set by BroadcastReceiver to indicate a generic error while 777 * processing the message. 778 */ 779 public static final int RESULT_SMS_GENERIC_ERROR = 2; 780 781 /** 782 * Set by BroadcastReceiver to indicate insufficient memory to store 783 * the message. 784 */ 785 public static final int RESULT_SMS_OUT_OF_MEMORY = 3; 786 787 /** 788 * Set by BroadcastReceiver to indicate that the message, while 789 * possibly valid, is of a format or encoding that is not 790 * supported. 791 */ 792 public static final int RESULT_SMS_UNSUPPORTED = 4; 793 794 /** 795 * Set by BroadcastReceiver to indicate a duplicate incoming message. 796 */ 797 public static final int RESULT_SMS_DUPLICATED = 5; 798 799 /** 800 * Activity action: Ask the user to change the default 801 * SMS application. This will show a dialog that asks the 802 * user whether they want to replace the current default 803 * SMS application with the one specified in 804 * {@link #EXTRA_PACKAGE_NAME}. 805 */ 806 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) 807 public static final String ACTION_CHANGE_DEFAULT = 808 "android.provider.Telephony.ACTION_CHANGE_DEFAULT"; 809 810 /** 811 * The PackageName string passed in as an 812 * extra for {@link #ACTION_CHANGE_DEFAULT} 813 * 814 * @see #ACTION_CHANGE_DEFAULT 815 */ 816 public static final String EXTRA_PACKAGE_NAME = "package"; 817 818 /** 819 * Broadcast Action: A new text-based SMS message has been received 820 * by the device. This intent will only be delivered to the default 821 * sms app. That app is responsible for writing the message and notifying 822 * the user. The intent will have the following extra values:</p> 823 * 824 * <ul> 825 * <li><em>"pdus"</em> - An Object[] of byte[]s containing the PDUs 826 * that make up the message.</li> 827 * <li><em>"format"</em> - A String describing the format of the PDUs. It can 828 * be either "3gpp" or "3gpp2".</li> 829 * <li><em>"subscription"</em> - An optional long value of the subscription id which 830 * received the message.</li> 831 * <li><em>"slot"</em> - An optional int value of the SIM slot containing the 832 * subscription.</li> 833 * <li><em>"phone"</em> - An optional int value of the phone id associated with the 834 * subscription.</li> 835 * <li><em>"errorCode"</em> - An optional int error code associated with receiving 836 * the message.</li> 837 * </ul> 838 * 839 * <p>The extra values can be extracted using 840 * {@link #getMessagesFromIntent(Intent)}.</p> 841 * 842 * <p>If a BroadcastReceiver encounters an error while processing 843 * this intent it should set the result code appropriately.</p> 844 * 845 * <p class="note"><strong>Note:</strong> 846 * The broadcast receiver that filters for this intent must declare 847 * {@link android.Manifest.permission#BROADCAST_SMS} as a required permission in 848 * the <a href="{@docRoot}guide/topics/manifest/receiver-element.html">{@code 849 * <receiver>}</a> tag. 850 */ 851 @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION) 852 public static final String SMS_DELIVER_ACTION = 853 "android.provider.Telephony.SMS_DELIVER"; 854 855 /** 856 * Broadcast Action: A new text-based SMS message has been received 857 * by the device. This intent will only be delivered to a 858 * carrier app which is responsible for filtering the message. 859 * If the carrier app wants to drop a message, it should set the result 860 * code to {@link android.app.Activity#RESULT_CANCELED}. The carrier app can 861 * also modify the SMS PDU by setting the "pdus" value in result extras.</p> 862 * 863 * The intent will have the following extra values:</p> 864 * 865 * <ul> 866 * <li><em>"pdus"</em> - An Object[] of byte[]s containing the PDUs 867 * that make up the message.</li> 868 * <li><em>"format"</em> - A String describing the format of the PDUs. It can 869 * be either "3gpp" or "3gpp2".</li> 870 * <li><em>"destport"</em> - An int describing the destination port of a data 871 * SMS. It will be -1 for text SMS.</li> 872 * </ul> 873 * 874 * <p>The extra values can be extracted using 875 * {@link #getMessagesFromIntent(Intent)}.</p> 876 * 877 * <p class="note"><strong>Note:</strong> 878 * The broadcast receiver that filters for this intent must be a carrier privileged app. 879 * It must also declare {@link android.Manifest.permission#BROADCAST_SMS} as a required 880 * permission in the <a href="{@docRoot}guide/topics/manifest/receiver-element.html"> 881 * {@code <receiver>}</a> tag. 882 */ 883 @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION) 884 public static final String SMS_FILTER_ACTION = 885 "android.provider.Telephony.SMS_FILTER"; 886 887 /** 888 * Broadcast Action: A new text-based SMS message has been received 889 * by the device. This intent will be delivered to all registered 890 * receivers as a notification. These apps are not expected to write the 891 * message or notify the user. The intent will have the following extra 892 * values:</p> 893 * 894 * <ul> 895 * <li><em>"pdus"</em> - An Object[] of byte[]s containing the PDUs 896 * that make up the message.</li> 897 * </ul> 898 * 899 * <p>The extra values can be extracted using 900 * {@link #getMessagesFromIntent(Intent)}.</p> 901 * 902 * <p>If a BroadcastReceiver encounters an error while processing 903 * this intent it should set the result code appropriately.</p> 904 */ 905 @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION) 906 public static final String SMS_RECEIVED_ACTION = 907 "android.provider.Telephony.SMS_RECEIVED"; 908 909 /** 910 * Broadcast Action: A new data based SMS message has been received 911 * by the device. This intent will be delivered to all registered 912 * receivers as a notification. The intent will have the following extra 913 * values:</p> 914 * 915 * <ul> 916 * <li><em>"pdus"</em> - An Object[] of byte[]s containing the PDUs 917 * that make up the message.</li> 918 * </ul> 919 * 920 * <p>The extra values can be extracted using 921 * {@link #getMessagesFromIntent(Intent)}.</p> 922 * 923 * <p>If a BroadcastReceiver encounters an error while processing 924 * this intent it should set the result code appropriately.</p> 925 */ 926 @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION) 927 public static final String DATA_SMS_RECEIVED_ACTION = 928 "android.intent.action.DATA_SMS_RECEIVED"; 929 930 /** 931 * Broadcast Action: A new WAP PUSH message has been received by the 932 * device. This intent will only be delivered to the default 933 * sms app. That app is responsible for writing the message and notifying 934 * the user. The intent will have the following extra values:</p> 935 * 936 * <ul> 937 * <li><em>"transactionId"</em> - (Integer) The WAP transaction ID</li> 938 * <li><em>"pduType"</em> - (Integer) The WAP PDU type</li> 939 * <li><em>"header"</em> - (byte[]) The header of the message</li> 940 * <li><em>"data"</em> - (byte[]) The data payload of the message</li> 941 * <li><em>"contentTypeParameters" </em> 942 * -(HashMap<String,String>) Any parameters associated with the content type 943 * (decoded from the WSP Content-Type header)</li> 944 * <li><em>"subscription"</em> - An optional long value of the subscription id which 945 * received the message.</li> 946 * <li><em>"slot"</em> - An optional int value of the SIM slot containing the 947 * subscription.</li> 948 * <li><em>"phone"</em> - An optional int value of the phone id associated with the 949 * subscription.</li> 950 * </ul> 951 * 952 * <p>If a BroadcastReceiver encounters an error while processing 953 * this intent it should set the result code appropriately.</p> 954 * 955 * <p>The contentTypeParameters extra value is map of content parameters keyed by 956 * their names.</p> 957 * 958 * <p>If any unassigned well-known parameters are encountered, the key of the map will 959 * be 'unassigned/0x...', where '...' is the hex value of the unassigned parameter. If 960 * a parameter has No-Value the value in the map will be null.</p> 961 * 962 * <p class="note"><strong>Note:</strong> 963 * The broadcast receiver that filters for this intent must declare 964 * {@link android.Manifest.permission#BROADCAST_WAP_PUSH} as a required permission in 965 * the <a href="{@docRoot}guide/topics/manifest/receiver-element.html">{@code 966 * <receiver>}</a> tag. 967 */ 968 @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION) 969 public static final String WAP_PUSH_DELIVER_ACTION = 970 "android.provider.Telephony.WAP_PUSH_DELIVER"; 971 972 /** 973 * Broadcast Action: A new WAP PUSH message has been received by the 974 * device. This intent will be delivered to all registered 975 * receivers as a notification. These apps are not expected to write the 976 * message or notify the user. The intent will have the following extra 977 * values:</p> 978 * 979 * <ul> 980 * <li><em>"transactionId"</em> - (Integer) The WAP transaction ID</li> 981 * <li><em>"pduType"</em> - (Integer) The WAP PDU type</li> 982 * <li><em>"header"</em> - (byte[]) The header of the message</li> 983 * <li><em>"data"</em> - (byte[]) The data payload of the message</li> 984 * <li><em>"contentTypeParameters"</em> 985 * - (HashMap<String,String>) Any parameters associated with the content type 986 * (decoded from the WSP Content-Type header)</li> 987 * </ul> 988 * 989 * <p>If a BroadcastReceiver encounters an error while processing 990 * this intent it should set the result code appropriately.</p> 991 * 992 * <p>The contentTypeParameters extra value is map of content parameters keyed by 993 * their names.</p> 994 * 995 * <p>If any unassigned well-known parameters are encountered, the key of the map will 996 * be 'unassigned/0x...', where '...' is the hex value of the unassigned parameter. If 997 * a parameter has No-Value the value in the map will be null.</p> 998 */ 999 @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION) 1000 public static final String WAP_PUSH_RECEIVED_ACTION = 1001 "android.provider.Telephony.WAP_PUSH_RECEIVED"; 1002 1003 /** 1004 * Broadcast Action: A new Cell Broadcast message has been received 1005 * by the device. The intent will have the following extra 1006 * values:</p> 1007 * 1008 * <ul> 1009 * <li><em>"message"</em> - An SmsCbMessage object containing the broadcast message 1010 * data. This is not an emergency alert, so ETWS and CMAS data will be null.</li> 1011 * </ul> 1012 * 1013 * <p>The extra values can be extracted using 1014 * {@link #getMessagesFromIntent(Intent)}.</p> 1015 * 1016 * <p>If a BroadcastReceiver encounters an error while processing 1017 * this intent it should set the result code appropriately.</p> 1018 */ 1019 @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION) 1020 public static final String SMS_CB_RECEIVED_ACTION = 1021 "android.provider.Telephony.SMS_CB_RECEIVED"; 1022 1023 /** 1024 * Broadcast Action: A new Emergency Broadcast message has been received 1025 * by the device. The intent will have the following extra 1026 * values:</p> 1027 * 1028 * <ul> 1029 * <li><em>"message"</em> - An SmsCbMessage object containing the broadcast message 1030 * data, including ETWS or CMAS warning notification info if present.</li> 1031 * </ul> 1032 * 1033 * <p>The extra values can be extracted using 1034 * {@link #getMessagesFromIntent(Intent)}.</p> 1035 * 1036 * <p>If a BroadcastReceiver encounters an error while processing 1037 * this intent it should set the result code appropriately.</p> 1038 */ 1039 @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION) 1040 public static final String SMS_EMERGENCY_CB_RECEIVED_ACTION = 1041 "android.provider.Telephony.SMS_EMERGENCY_CB_RECEIVED"; 1042 1043 /** 1044 * Broadcast Action: A new CDMA SMS has been received containing Service Category 1045 * Program Data (updates the list of enabled broadcast channels). The intent will 1046 * have the following extra values:</p> 1047 * 1048 * <ul> 1049 * <li><em>"operations"</em> - An array of CdmaSmsCbProgramData objects containing 1050 * the service category operations (add/delete/clear) to perform.</li> 1051 * </ul> 1052 * 1053 * <p>The extra values can be extracted using 1054 * {@link #getMessagesFromIntent(Intent)}.</p> 1055 * 1056 * <p>If a BroadcastReceiver encounters an error while processing 1057 * this intent it should set the result code appropriately.</p> 1058 */ 1059 @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION) 1060 public static final String SMS_SERVICE_CATEGORY_PROGRAM_DATA_RECEIVED_ACTION = 1061 "android.provider.Telephony.SMS_SERVICE_CATEGORY_PROGRAM_DATA_RECEIVED"; 1062 1063 /** 1064 * Broadcast Action: The SIM storage for SMS messages is full. If 1065 * space is not freed, messages targeted for the SIM (class 2) may 1066 * not be saved. 1067 */ 1068 @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION) 1069 public static final String SIM_FULL_ACTION = 1070 "android.provider.Telephony.SIM_FULL"; 1071 1072 /** 1073 * Broadcast Action: An incoming SMS has been rejected by the 1074 * telephony framework. This intent is sent in lieu of any 1075 * of the RECEIVED_ACTION intents. The intent will have the 1076 * following extra value:</p> 1077 * 1078 * <ul> 1079 * <li><em>"result"</em> - An int result code, e.g. {@link #RESULT_SMS_OUT_OF_MEMORY} 1080 * indicating the error returned to the network.</li> 1081 * </ul> 1082 */ 1083 @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION) 1084 public static final String SMS_REJECTED_ACTION = 1085 "android.provider.Telephony.SMS_REJECTED"; 1086 1087 /** 1088 * Broadcast Action: An incoming MMS has been downloaded. The intent is sent to all 1089 * users, except for secondary users where SMS has been disabled and to managed 1090 * profiles. 1091 * @hide 1092 */ 1093 @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION) 1094 public static final String MMS_DOWNLOADED_ACTION = 1095 "android.provider.Telephony.MMS_DOWNLOADED"; 1096 1097 /** 1098 * Broadcast Action: A new SMS PDU needs to be sent from 1099 * the device. This intent will only be delivered to a 1100 * carrier app. That app is responsible for sending the PDU. 1101 * The intent will have the following extra values:</p> 1102 * 1103 * <ul> 1104 * <li><em>"pdu"</em> - (byte[]) The PDU to send.</li> 1105 * <li><em>"smsc"</em> - (byte[]) The service center address (for GSM PDU only).</li> 1106 * <li><em>"format"</em> - (String) The format of the PDU. Either 3gpp or 3gpp2. </li> 1107 * <li><em>"concat.refNumber"</em> - (int) If the SMS is part of a multi-part SMS, the 1108 * ref number used in the SMS header.</li> 1109 * <li><em>"concat.seqNumber"</em> - (int) If the SMS is part of a multi-part SMS, the 1110 * sequence number of this SMS.</li> 1111 * <li><em>"concat.msgCount"</em> - (int) If the SMS is part of a multi-part SMS, the 1112 * total number of SMSes in the multi-part SMS.</li> 1113 * </ul> 1114 * 1115 * <p>If a BroadcastReceiver is trying to send the message, 1116 * it should set the result code to {@link android.app.Activity#RESULT_OK} and set 1117 * the following in the result extra values:</p> 1118 * 1119 * <ul> 1120 * <li><em>"messageref"</em> - (int) The new message reference number which will be 1121 * later used in the updateSmsSendStatus call.</li> 1122 * </ul> 1123 * 1124 * <p>If a BroadcastReceiver cannot send the message, it should not set the result 1125 * code and the platform will send it via the normal pathway. 1126 * </p> 1127 * 1128 * <p class="note"><strong>Note:</strong> 1129 * The broadcast receiver that filters for this intent must be a carrier privileged app. 1130 * It must also declare {@link android.Manifest.permission#BROADCAST_SMS} as a required 1131 * permission in the <a href="{@docRoot}guide/topics/manifest/receiver-element.html"> 1132 * {@code <receiver>}</a> tag. 1133 */ 1134 @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION) 1135 public static final String SMS_SEND_ACTION = 1136 "android.provider.Telephony.SMS_SEND"; 1137 1138 /** 1139 * Read the PDUs out of an {@link #SMS_RECEIVED_ACTION} or a 1140 * {@link #DATA_SMS_RECEIVED_ACTION} intent. 1141 * 1142 * @param intent the intent to read from 1143 * @return an array of SmsMessages for the PDUs 1144 */ 1145 public static SmsMessage[] getMessagesFromIntent(Intent intent) { 1146 Object[] messages = (Object[]) intent.getSerializableExtra("pdus"); 1147 String format = intent.getStringExtra("format"); 1148 int subId = intent.getIntExtra(PhoneConstants.SUBSCRIPTION_KEY, 1149 SubscriptionManager.getDefaultSmsSubId()); 1150 1151 Rlog.v(TAG, " getMessagesFromIntent sub_id : " + subId); 1152 1153 int pduCount = messages.length; 1154 SmsMessage[] msgs = new SmsMessage[pduCount]; 1155 1156 for (int i = 0; i < pduCount; i++) { 1157 byte[] pdu = (byte[]) messages[i]; 1158 msgs[i] = SmsMessage.createFromPdu(pdu, format); 1159 msgs[i].setSubId(subId); 1160 } 1161 return msgs; 1162 } 1163 } 1164 } 1165 1166 /** 1167 * Base columns for tables that contain MMSs. 1168 */ 1169 public interface BaseMmsColumns extends BaseColumns { 1170 1171 /** Message box: all messages. */ 1172 public static final int MESSAGE_BOX_ALL = 0; 1173 /** Message box: inbox. */ 1174 public static final int MESSAGE_BOX_INBOX = 1; 1175 /** Message box: sent messages. */ 1176 public static final int MESSAGE_BOX_SENT = 2; 1177 /** Message box: drafts. */ 1178 public static final int MESSAGE_BOX_DRAFTS = 3; 1179 /** Message box: outbox. */ 1180 public static final int MESSAGE_BOX_OUTBOX = 4; 1181 /** Message box: failed. */ 1182 public static final int MESSAGE_BOX_FAILED = 5; 1183 1184 /** 1185 * The thread ID of the message. 1186 * <P>Type: INTEGER (long)</P> 1187 */ 1188 public static final String THREAD_ID = "thread_id"; 1189 1190 /** 1191 * The date the message was received. 1192 * <P>Type: INTEGER (long)</P> 1193 */ 1194 public static final String DATE = "date"; 1195 1196 /** 1197 * The date the message was sent. 1198 * <P>Type: INTEGER (long)</P> 1199 */ 1200 public static final String DATE_SENT = "date_sent"; 1201 1202 /** 1203 * The box which the message belongs to, e.g. {@link #MESSAGE_BOX_INBOX}. 1204 * <P>Type: INTEGER</P> 1205 */ 1206 public static final String MESSAGE_BOX = "msg_box"; 1207 1208 /** 1209 * Has the message been read? 1210 * <P>Type: INTEGER (boolean)</P> 1211 */ 1212 public static final String READ = "read"; 1213 1214 /** 1215 * Has the message been seen by the user? The "seen" flag determines 1216 * whether we need to show a new message notification. 1217 * <P>Type: INTEGER (boolean)</P> 1218 */ 1219 public static final String SEEN = "seen"; 1220 1221 /** 1222 * Does the message have only a text part (can also have a subject) with 1223 * no picture, slideshow, sound, etc. parts? 1224 * <P>Type: INTEGER (boolean)</P> 1225 */ 1226 public static final String TEXT_ONLY = "text_only"; 1227 1228 /** 1229 * The {@code Message-ID} of the message. 1230 * <P>Type: TEXT</P> 1231 */ 1232 public static final String MESSAGE_ID = "m_id"; 1233 1234 /** 1235 * The subject of the message, if present. 1236 * <P>Type: TEXT</P> 1237 */ 1238 public static final String SUBJECT = "sub"; 1239 1240 /** 1241 * The character set of the subject, if present. 1242 * <P>Type: INTEGER</P> 1243 */ 1244 public static final String SUBJECT_CHARSET = "sub_cs"; 1245 1246 /** 1247 * The {@code Content-Type} of the message. 1248 * <P>Type: TEXT</P> 1249 */ 1250 public static final String CONTENT_TYPE = "ct_t"; 1251 1252 /** 1253 * The {@code Content-Location} of the message. 1254 * <P>Type: TEXT</P> 1255 */ 1256 public static final String CONTENT_LOCATION = "ct_l"; 1257 1258 /** 1259 * The expiry time of the message. 1260 * <P>Type: INTEGER (long)</P> 1261 */ 1262 public static final String EXPIRY = "exp"; 1263 1264 /** 1265 * The class of the message. 1266 * <P>Type: TEXT</P> 1267 */ 1268 public static final String MESSAGE_CLASS = "m_cls"; 1269 1270 /** 1271 * The type of the message defined by MMS spec. 1272 * <P>Type: INTEGER</P> 1273 */ 1274 public static final String MESSAGE_TYPE = "m_type"; 1275 1276 /** 1277 * The version of the specification that this message conforms to. 1278 * <P>Type: INTEGER</P> 1279 */ 1280 public static final String MMS_VERSION = "v"; 1281 1282 /** 1283 * The size of the message. 1284 * <P>Type: INTEGER</P> 1285 */ 1286 public static final String MESSAGE_SIZE = "m_size"; 1287 1288 /** 1289 * The priority of the message. 1290 * <P>Type: INTEGER</P> 1291 */ 1292 public static final String PRIORITY = "pri"; 1293 1294 /** 1295 * The {@code read-report} of the message. 1296 * <P>Type: INTEGER (boolean)</P> 1297 */ 1298 public static final String READ_REPORT = "rr"; 1299 1300 /** 1301 * Is read report allowed? 1302 * <P>Type: INTEGER (boolean)</P> 1303 */ 1304 public static final String REPORT_ALLOWED = "rpt_a"; 1305 1306 /** 1307 * The {@code response-status} of the message. 1308 * <P>Type: INTEGER</P> 1309 */ 1310 public static final String RESPONSE_STATUS = "resp_st"; 1311 1312 /** 1313 * The {@code status} of the message. 1314 * <P>Type: INTEGER</P> 1315 */ 1316 public static final String STATUS = "st"; 1317 1318 /** 1319 * The {@code transaction-id} of the message. 1320 * <P>Type: TEXT</P> 1321 */ 1322 public static final String TRANSACTION_ID = "tr_id"; 1323 1324 /** 1325 * The {@code retrieve-status} of the message. 1326 * <P>Type: INTEGER</P> 1327 */ 1328 public static final String RETRIEVE_STATUS = "retr_st"; 1329 1330 /** 1331 * The {@code retrieve-text} of the message. 1332 * <P>Type: TEXT</P> 1333 */ 1334 public static final String RETRIEVE_TEXT = "retr_txt"; 1335 1336 /** 1337 * The character set of the retrieve-text. 1338 * <P>Type: INTEGER</P> 1339 */ 1340 public static final String RETRIEVE_TEXT_CHARSET = "retr_txt_cs"; 1341 1342 /** 1343 * The {@code read-status} of the message. 1344 * <P>Type: INTEGER</P> 1345 */ 1346 public static final String READ_STATUS = "read_status"; 1347 1348 /** 1349 * The {@code content-class} of the message. 1350 * <P>Type: INTEGER</P> 1351 */ 1352 public static final String CONTENT_CLASS = "ct_cls"; 1353 1354 /** 1355 * The {@code delivery-report} of the message. 1356 * <P>Type: INTEGER</P> 1357 */ 1358 public static final String DELIVERY_REPORT = "d_rpt"; 1359 1360 /** 1361 * The {@code delivery-time-token} of the message. 1362 * <P>Type: INTEGER</P> 1363 * @deprecated this column is no longer supported. 1364 * @hide 1365 */ 1366 @Deprecated 1367 public static final String DELIVERY_TIME_TOKEN = "d_tm_tok"; 1368 1369 /** 1370 * The {@code delivery-time} of the message. 1371 * <P>Type: INTEGER</P> 1372 */ 1373 public static final String DELIVERY_TIME = "d_tm"; 1374 1375 /** 1376 * The {@code response-text} of the message. 1377 * <P>Type: TEXT</P> 1378 */ 1379 public static final String RESPONSE_TEXT = "resp_txt"; 1380 1381 /** 1382 * The {@code sender-visibility} of the message. 1383 * <P>Type: TEXT</P> 1384 * @deprecated this column is no longer supported. 1385 * @hide 1386 */ 1387 @Deprecated 1388 public static final String SENDER_VISIBILITY = "s_vis"; 1389 1390 /** 1391 * The {@code reply-charging} of the message. 1392 * <P>Type: INTEGER</P> 1393 * @deprecated this column is no longer supported. 1394 * @hide 1395 */ 1396 @Deprecated 1397 public static final String REPLY_CHARGING = "r_chg"; 1398 1399 /** 1400 * The {@code reply-charging-deadline-token} of the message. 1401 * <P>Type: INTEGER</P> 1402 * @deprecated this column is no longer supported. 1403 * @hide 1404 */ 1405 @Deprecated 1406 public static final String REPLY_CHARGING_DEADLINE_TOKEN = "r_chg_dl_tok"; 1407 1408 /** 1409 * The {@code reply-charging-deadline} of the message. 1410 * <P>Type: INTEGER</P> 1411 * @deprecated this column is no longer supported. 1412 * @hide 1413 */ 1414 @Deprecated 1415 public static final String REPLY_CHARGING_DEADLINE = "r_chg_dl"; 1416 1417 /** 1418 * The {@code reply-charging-id} of the message. 1419 * <P>Type: TEXT</P> 1420 * @deprecated this column is no longer supported. 1421 * @hide 1422 */ 1423 @Deprecated 1424 public static final String REPLY_CHARGING_ID = "r_chg_id"; 1425 1426 /** 1427 * The {@code reply-charging-size} of the message. 1428 * <P>Type: INTEGER</P> 1429 * @deprecated this column is no longer supported. 1430 * @hide 1431 */ 1432 @Deprecated 1433 public static final String REPLY_CHARGING_SIZE = "r_chg_sz"; 1434 1435 /** 1436 * The {@code previously-sent-by} of the message. 1437 * <P>Type: TEXT</P> 1438 * @deprecated this column is no longer supported. 1439 * @hide 1440 */ 1441 @Deprecated 1442 public static final String PREVIOUSLY_SENT_BY = "p_s_by"; 1443 1444 /** 1445 * The {@code previously-sent-date} of the message. 1446 * <P>Type: INTEGER</P> 1447 * @deprecated this column is no longer supported. 1448 * @hide 1449 */ 1450 @Deprecated 1451 public static final String PREVIOUSLY_SENT_DATE = "p_s_d"; 1452 1453 /** 1454 * The {@code store} of the message. 1455 * <P>Type: TEXT</P> 1456 * @deprecated this column is no longer supported. 1457 * @hide 1458 */ 1459 @Deprecated 1460 public static final String STORE = "store"; 1461 1462 /** 1463 * The {@code mm-state} of the message. 1464 * <P>Type: INTEGER</P> 1465 * @deprecated this column is no longer supported. 1466 * @hide 1467 */ 1468 @Deprecated 1469 public static final String MM_STATE = "mm_st"; 1470 1471 /** 1472 * The {@code mm-flags-token} of the message. 1473 * <P>Type: INTEGER</P> 1474 * @deprecated this column is no longer supported. 1475 * @hide 1476 */ 1477 @Deprecated 1478 public static final String MM_FLAGS_TOKEN = "mm_flg_tok"; 1479 1480 /** 1481 * The {@code mm-flags} of the message. 1482 * <P>Type: TEXT</P> 1483 * @deprecated this column is no longer supported. 1484 * @hide 1485 */ 1486 @Deprecated 1487 public static final String MM_FLAGS = "mm_flg"; 1488 1489 /** 1490 * The {@code store-status} of the message. 1491 * <P>Type: TEXT</P> 1492 * @deprecated this column is no longer supported. 1493 * @hide 1494 */ 1495 @Deprecated 1496 public static final String STORE_STATUS = "store_st"; 1497 1498 /** 1499 * The {@code store-status-text} of the message. 1500 * <P>Type: TEXT</P> 1501 * @deprecated this column is no longer supported. 1502 * @hide 1503 */ 1504 @Deprecated 1505 public static final String STORE_STATUS_TEXT = "store_st_txt"; 1506 1507 /** 1508 * The {@code stored} of the message. 1509 * <P>Type: TEXT</P> 1510 * @deprecated this column is no longer supported. 1511 * @hide 1512 */ 1513 @Deprecated 1514 public static final String STORED = "stored"; 1515 1516 /** 1517 * The {@code totals} of the message. 1518 * <P>Type: TEXT</P> 1519 * @deprecated this column is no longer supported. 1520 * @hide 1521 */ 1522 @Deprecated 1523 public static final String TOTALS = "totals"; 1524 1525 /** 1526 * The {@code mbox-totals} of the message. 1527 * <P>Type: TEXT</P> 1528 * @deprecated this column is no longer supported. 1529 * @hide 1530 */ 1531 @Deprecated 1532 public static final String MBOX_TOTALS = "mb_t"; 1533 1534 /** 1535 * The {@code mbox-totals-token} of the message. 1536 * <P>Type: INTEGER</P> 1537 * @deprecated this column is no longer supported. 1538 * @hide 1539 */ 1540 @Deprecated 1541 public static final String MBOX_TOTALS_TOKEN = "mb_t_tok"; 1542 1543 /** 1544 * The {@code quotas} of the message. 1545 * <P>Type: TEXT</P> 1546 * @deprecated this column is no longer supported. 1547 * @hide 1548 */ 1549 @Deprecated 1550 public static final String QUOTAS = "qt"; 1551 1552 /** 1553 * The {@code mbox-quotas} of the message. 1554 * <P>Type: TEXT</P> 1555 * @deprecated this column is no longer supported. 1556 * @hide 1557 */ 1558 @Deprecated 1559 public static final String MBOX_QUOTAS = "mb_qt"; 1560 1561 /** 1562 * The {@code mbox-quotas-token} of the message. 1563 * <P>Type: INTEGER</P> 1564 * @deprecated this column is no longer supported. 1565 * @hide 1566 */ 1567 @Deprecated 1568 public static final String MBOX_QUOTAS_TOKEN = "mb_qt_tok"; 1569 1570 /** 1571 * The {@code message-count} of the message. 1572 * <P>Type: INTEGER</P> 1573 * @deprecated this column is no longer supported. 1574 * @hide 1575 */ 1576 @Deprecated 1577 public static final String MESSAGE_COUNT = "m_cnt"; 1578 1579 /** 1580 * The {@code start} of the message. 1581 * <P>Type: INTEGER</P> 1582 * @deprecated this column is no longer supported. 1583 * @hide 1584 */ 1585 @Deprecated 1586 public static final String START = "start"; 1587 1588 /** 1589 * The {@code distribution-indicator} of the message. 1590 * <P>Type: TEXT</P> 1591 * @deprecated this column is no longer supported. 1592 * @hide 1593 */ 1594 @Deprecated 1595 public static final String DISTRIBUTION_INDICATOR = "d_ind"; 1596 1597 /** 1598 * The {@code element-descriptor} of the message. 1599 * <P>Type: TEXT</P> 1600 * @deprecated this column is no longer supported. 1601 * @hide 1602 */ 1603 @Deprecated 1604 public static final String ELEMENT_DESCRIPTOR = "e_des"; 1605 1606 /** 1607 * The {@code limit} of the message. 1608 * <P>Type: INTEGER</P> 1609 * @deprecated this column is no longer supported. 1610 * @hide 1611 */ 1612 @Deprecated 1613 public static final String LIMIT = "limit"; 1614 1615 /** 1616 * The {@code recommended-retrieval-mode} of the message. 1617 * <P>Type: INTEGER</P> 1618 * @deprecated this column is no longer supported. 1619 * @hide 1620 */ 1621 @Deprecated 1622 public static final String RECOMMENDED_RETRIEVAL_MODE = "r_r_mod"; 1623 1624 /** 1625 * The {@code recommended-retrieval-mode-text} of the message. 1626 * <P>Type: TEXT</P> 1627 * @deprecated this column is no longer supported. 1628 * @hide 1629 */ 1630 @Deprecated 1631 public static final String RECOMMENDED_RETRIEVAL_MODE_TEXT = "r_r_mod_txt"; 1632 1633 /** 1634 * The {@code status-text} of the message. 1635 * <P>Type: TEXT</P> 1636 * @deprecated this column is no longer supported. 1637 * @hide 1638 */ 1639 @Deprecated 1640 public static final String STATUS_TEXT = "st_txt"; 1641 1642 /** 1643 * The {@code applic-id} of the message. 1644 * <P>Type: TEXT</P> 1645 * @deprecated this column is no longer supported. 1646 * @hide 1647 */ 1648 @Deprecated 1649 public static final String APPLIC_ID = "apl_id"; 1650 1651 /** 1652 * The {@code reply-applic-id} of the message. 1653 * <P>Type: TEXT</P> 1654 * @deprecated this column is no longer supported. 1655 * @hide 1656 */ 1657 @Deprecated 1658 public static final String REPLY_APPLIC_ID = "r_apl_id"; 1659 1660 /** 1661 * The {@code aux-applic-id} of the message. 1662 * <P>Type: TEXT</P> 1663 * @deprecated this column is no longer supported. 1664 * @hide 1665 */ 1666 @Deprecated 1667 public static final String AUX_APPLIC_ID = "aux_apl_id"; 1668 1669 /** 1670 * The {@code drm-content} of the message. 1671 * <P>Type: TEXT</P> 1672 * @deprecated this column is no longer supported. 1673 * @hide 1674 */ 1675 @Deprecated 1676 public static final String DRM_CONTENT = "drm_c"; 1677 1678 /** 1679 * The {@code adaptation-allowed} of the message. 1680 * <P>Type: TEXT</P> 1681 * @deprecated this column is no longer supported. 1682 * @hide 1683 */ 1684 @Deprecated 1685 public static final String ADAPTATION_ALLOWED = "adp_a"; 1686 1687 /** 1688 * The {@code replace-id} of the message. 1689 * <P>Type: TEXT</P> 1690 * @deprecated this column is no longer supported. 1691 * @hide 1692 */ 1693 @Deprecated 1694 public static final String REPLACE_ID = "repl_id"; 1695 1696 /** 1697 * The {@code cancel-id} of the message. 1698 * <P>Type: TEXT</P> 1699 * @deprecated this column is no longer supported. 1700 * @hide 1701 */ 1702 @Deprecated 1703 public static final String CANCEL_ID = "cl_id"; 1704 1705 /** 1706 * The {@code cancel-status} of the message. 1707 * <P>Type: INTEGER</P> 1708 * @deprecated this column is no longer supported. 1709 * @hide 1710 */ 1711 @Deprecated 1712 public static final String CANCEL_STATUS = "cl_st"; 1713 1714 /** 1715 * Is the message locked? 1716 * <P>Type: INTEGER (boolean)</P> 1717 */ 1718 public static final String LOCKED = "locked"; 1719 1720 /** 1721 * The subscription to which the message belongs to. Its value will be 1722 * {@link android.telephony.SubscriptionManager#INVALID_SUBSCRIPTION_ID} if 1723 * the sub id cannot be determined. 1724 * <p>Type: INTEGER (long)</p> 1725 */ 1726 public static final String SUBSCRIPTION_ID = "sub_id"; 1727 1728 /** 1729 * The identity of the sender of a sent message. It is 1730 * usually the package name of the app which sends the message. 1731 * <p class="note"><strong>Note:</strong> 1732 * This column is read-only. It is set by the provider and can not be changed by apps. 1733 * <p>Type: TEXT</p> 1734 */ 1735 public static final String CREATOR = "creator"; 1736 } 1737 1738 /** 1739 * Columns for the "canonical_addresses" table used by MMS and SMS. 1740 */ 1741 public interface CanonicalAddressesColumns extends BaseColumns { 1742 /** 1743 * An address used in MMS or SMS. Email addresses are 1744 * converted to lower case and are compared by string 1745 * equality. Other addresses are compared using 1746 * PHONE_NUMBERS_EQUAL. 1747 * <P>Type: TEXT</P> 1748 */ 1749 public static final String ADDRESS = "address"; 1750 } 1751 1752 /** 1753 * Columns for the "threads" table used by MMS and SMS. 1754 */ 1755 public interface ThreadsColumns extends BaseColumns { 1756 1757 /** 1758 * The date at which the thread was created. 1759 * <P>Type: INTEGER (long)</P> 1760 */ 1761 public static final String DATE = "date"; 1762 1763 /** 1764 * A string encoding of the recipient IDs of the recipients of 1765 * the message, in numerical order and separated by spaces. 1766 * <P>Type: TEXT</P> 1767 */ 1768 public static final String RECIPIENT_IDS = "recipient_ids"; 1769 1770 /** 1771 * The message count of the thread. 1772 * <P>Type: INTEGER</P> 1773 */ 1774 public static final String MESSAGE_COUNT = "message_count"; 1775 1776 /** 1777 * Indicates whether all messages of the thread have been read. 1778 * <P>Type: INTEGER</P> 1779 */ 1780 public static final String READ = "read"; 1781 1782 /** 1783 * The snippet of the latest message in the thread. 1784 * <P>Type: TEXT</P> 1785 */ 1786 public static final String SNIPPET = "snippet"; 1787 1788 /** 1789 * The charset of the snippet. 1790 * <P>Type: INTEGER</P> 1791 */ 1792 public static final String SNIPPET_CHARSET = "snippet_cs"; 1793 1794 /** 1795 * Type of the thread, either {@link Threads#COMMON_THREAD} or 1796 * {@link Threads#BROADCAST_THREAD}. 1797 * <P>Type: INTEGER</P> 1798 */ 1799 public static final String TYPE = "type"; 1800 1801 /** 1802 * Indicates whether there is a transmission error in the thread. 1803 * <P>Type: INTEGER</P> 1804 */ 1805 public static final String ERROR = "error"; 1806 1807 /** 1808 * Indicates whether this thread contains any attachments. 1809 * <P>Type: INTEGER</P> 1810 */ 1811 public static final String HAS_ATTACHMENT = "has_attachment"; 1812 1813 /** 1814 * If the thread is archived 1815 * <P>Type: INTEGER (boolean)</P> 1816 */ 1817 public static final String ARCHIVED = "archived"; 1818 } 1819 1820 /** 1821 * Helper functions for the "threads" table used by MMS and SMS. 1822 */ 1823 public static final class Threads implements ThreadsColumns { 1824 1825 private static final String[] ID_PROJECTION = { BaseColumns._ID }; 1826 1827 /** 1828 * Private {@code content://} style URL for this table. Used by 1829 * {@link #getOrCreateThreadId(android.content.Context, java.util.Set)}. 1830 */ 1831 private static final Uri THREAD_ID_CONTENT_URI = Uri.parse( 1832 "content://mms-sms/threadID"); 1833 1834 /** 1835 * The {@code content://} style URL for this table, by conversation. 1836 */ 1837 public static final Uri CONTENT_URI = Uri.withAppendedPath( 1838 MmsSms.CONTENT_URI, "conversations"); 1839 1840 /** 1841 * The {@code content://} style URL for this table, for obsolete threads. 1842 */ 1843 public static final Uri OBSOLETE_THREADS_URI = Uri.withAppendedPath( 1844 CONTENT_URI, "obsolete"); 1845 1846 /** Thread type: common thread. */ 1847 public static final int COMMON_THREAD = 0; 1848 1849 /** Thread type: broadcast thread. */ 1850 public static final int BROADCAST_THREAD = 1; 1851 1852 /** 1853 * Not instantiable. 1854 * @hide 1855 */ 1856 private Threads() { 1857 } 1858 1859 /** 1860 * This is a single-recipient version of {@code getOrCreateThreadId}. 1861 * It's convenient for use with SMS messages. 1862 * @param context the context object to use. 1863 * @param recipient the recipient to send to. 1864 * @hide 1865 */ 1866 public static long getOrCreateThreadId(Context context, String recipient) { 1867 Set<String> recipients = new HashSet<String>(); 1868 1869 recipients.add(recipient); 1870 return getOrCreateThreadId(context, recipients); 1871 } 1872 1873 /** 1874 * Given the recipients list and subject of an unsaved message, 1875 * return its thread ID. If the message starts a new thread, 1876 * allocate a new thread ID. Otherwise, use the appropriate 1877 * existing thread ID. 1878 * 1879 * <p>Find the thread ID of the same set of recipients (in any order, 1880 * without any additions). If one is found, return it. Otherwise, 1881 * return a unique thread ID.</p> 1882 * @hide 1883 */ 1884 public static long getOrCreateThreadId( 1885 Context context, Set<String> recipients) { 1886 Uri.Builder uriBuilder = THREAD_ID_CONTENT_URI.buildUpon(); 1887 1888 for (String recipient : recipients) { 1889 if (Mms.isEmailAddress(recipient)) { 1890 recipient = Mms.extractAddrSpec(recipient); 1891 } 1892 1893 uriBuilder.appendQueryParameter("recipient", recipient); 1894 } 1895 1896 Uri uri = uriBuilder.build(); 1897 //if (DEBUG) Rlog.v(TAG, "getOrCreateThreadId uri: " + uri); 1898 1899 Cursor cursor = SqliteWrapper.query(context, context.getContentResolver(), 1900 uri, ID_PROJECTION, null, null, null); 1901 if (cursor != null) { 1902 try { 1903 if (cursor.moveToFirst()) { 1904 return cursor.getLong(0); 1905 } else { 1906 Rlog.e(TAG, "getOrCreateThreadId returned no rows!"); 1907 } 1908 } finally { 1909 cursor.close(); 1910 } 1911 } 1912 1913 Rlog.e(TAG, "getOrCreateThreadId failed with " + recipients.size() + " recipients"); 1914 throw new IllegalArgumentException("Unable to find or allocate a thread ID."); 1915 } 1916 } 1917 1918 /** 1919 * Contains all MMS messages. 1920 */ 1921 public static final class Mms implements BaseMmsColumns { 1922 1923 /** 1924 * Not instantiable. 1925 * @hide 1926 */ 1927 private Mms() { 1928 } 1929 1930 /** 1931 * The {@code content://} URI for this table. 1932 */ 1933 public static final Uri CONTENT_URI = Uri.parse("content://mms"); 1934 1935 /** 1936 * Content URI for getting MMS report requests. 1937 */ 1938 public static final Uri REPORT_REQUEST_URI = Uri.withAppendedPath( 1939 CONTENT_URI, "report-request"); 1940 1941 /** 1942 * Content URI for getting MMS report status. 1943 */ 1944 public static final Uri REPORT_STATUS_URI = Uri.withAppendedPath( 1945 CONTENT_URI, "report-status"); 1946 1947 /** 1948 * The default sort order for this table. 1949 */ 1950 public static final String DEFAULT_SORT_ORDER = "date DESC"; 1951 1952 /** 1953 * Regex pattern for names and email addresses. 1954 * <ul> 1955 * <li><em>mailbox</em> = {@code name-addr}</li> 1956 * <li><em>name-addr</em> = {@code [display-name] angle-addr}</li> 1957 * <li><em>angle-addr</em> = {@code [CFWS] "<" addr-spec ">" [CFWS]}</li> 1958 * </ul> 1959 * @hide 1960 */ 1961 public static final Pattern NAME_ADDR_EMAIL_PATTERN = 1962 Pattern.compile("\\s*(\"[^\"]*\"|[^<>\"]+)\\s*<([^<>]+)>\\s*"); 1963 1964 /** 1965 * Helper method to query this table. 1966 * @hide 1967 */ 1968 public static Cursor query( 1969 ContentResolver cr, String[] projection) { 1970 return cr.query(CONTENT_URI, projection, null, null, DEFAULT_SORT_ORDER); 1971 } 1972 1973 /** 1974 * Helper method to query this table. 1975 * @hide 1976 */ 1977 public static Cursor query( 1978 ContentResolver cr, String[] projection, 1979 String where, String orderBy) { 1980 return cr.query(CONTENT_URI, projection, 1981 where, null, orderBy == null ? DEFAULT_SORT_ORDER : orderBy); 1982 } 1983 1984 /** 1985 * Helper method to extract email address from address string. 1986 * @hide 1987 */ 1988 public static String extractAddrSpec(String address) { 1989 Matcher match = NAME_ADDR_EMAIL_PATTERN.matcher(address); 1990 1991 if (match.matches()) { 1992 return match.group(2); 1993 } 1994 return address; 1995 } 1996 1997 /** 1998 * Is the specified address an email address? 1999 * 2000 * @param address the input address to test 2001 * @return true if address is an email address; false otherwise. 2002 * @hide 2003 */ 2004 public static boolean isEmailAddress(String address) { 2005 if (TextUtils.isEmpty(address)) { 2006 return false; 2007 } 2008 2009 String s = extractAddrSpec(address); 2010 Matcher match = Patterns.EMAIL_ADDRESS.matcher(s); 2011 return match.matches(); 2012 } 2013 2014 /** 2015 * Is the specified number a phone number? 2016 * 2017 * @param number the input number to test 2018 * @return true if number is a phone number; false otherwise. 2019 * @hide 2020 */ 2021 public static boolean isPhoneNumber(String number) { 2022 if (TextUtils.isEmpty(number)) { 2023 return false; 2024 } 2025 2026 Matcher match = Patterns.PHONE.matcher(number); 2027 return match.matches(); 2028 } 2029 2030 /** 2031 * Contains all MMS messages in the MMS app inbox. 2032 */ 2033 public static final class Inbox implements BaseMmsColumns { 2034 2035 /** 2036 * Not instantiable. 2037 * @hide 2038 */ 2039 private Inbox() { 2040 } 2041 2042 /** 2043 * The {@code content://} style URL for this table. 2044 */ 2045 public static final Uri 2046 CONTENT_URI = Uri.parse("content://mms/inbox"); 2047 2048 /** 2049 * The default sort order for this table. 2050 */ 2051 public static final String DEFAULT_SORT_ORDER = "date DESC"; 2052 } 2053 2054 /** 2055 * Contains all MMS messages in the MMS app sent folder. 2056 */ 2057 public static final class Sent implements BaseMmsColumns { 2058 2059 /** 2060 * Not instantiable. 2061 * @hide 2062 */ 2063 private Sent() { 2064 } 2065 2066 /** 2067 * The {@code content://} style URL for this table. 2068 */ 2069 public static final Uri 2070 CONTENT_URI = Uri.parse("content://mms/sent"); 2071 2072 /** 2073 * The default sort order for this table. 2074 */ 2075 public static final String DEFAULT_SORT_ORDER = "date DESC"; 2076 } 2077 2078 /** 2079 * Contains all MMS messages in the MMS app drafts folder. 2080 */ 2081 public static final class Draft implements BaseMmsColumns { 2082 2083 /** 2084 * Not instantiable. 2085 * @hide 2086 */ 2087 private Draft() { 2088 } 2089 2090 /** 2091 * The {@code content://} style URL for this table. 2092 */ 2093 public static final Uri 2094 CONTENT_URI = Uri.parse("content://mms/drafts"); 2095 2096 /** 2097 * The default sort order for this table. 2098 */ 2099 public static final String DEFAULT_SORT_ORDER = "date DESC"; 2100 } 2101 2102 /** 2103 * Contains all MMS messages in the MMS app outbox. 2104 */ 2105 public static final class Outbox implements BaseMmsColumns { 2106 2107 /** 2108 * Not instantiable. 2109 * @hide 2110 */ 2111 private Outbox() { 2112 } 2113 2114 /** 2115 * The {@code content://} style URL for this table. 2116 */ 2117 public static final Uri 2118 CONTENT_URI = Uri.parse("content://mms/outbox"); 2119 2120 /** 2121 * The default sort order for this table. 2122 */ 2123 public static final String DEFAULT_SORT_ORDER = "date DESC"; 2124 } 2125 2126 /** 2127 * Contains address information for an MMS message. 2128 */ 2129 public static final class Addr implements BaseColumns { 2130 2131 /** 2132 * Not instantiable. 2133 * @hide 2134 */ 2135 private Addr() { 2136 } 2137 2138 /** 2139 * The ID of MM which this address entry belongs to. 2140 * <P>Type: INTEGER (long)</P> 2141 */ 2142 public static final String MSG_ID = "msg_id"; 2143 2144 /** 2145 * The ID of contact entry in Phone Book. 2146 * <P>Type: INTEGER (long)</P> 2147 */ 2148 public static final String CONTACT_ID = "contact_id"; 2149 2150 /** 2151 * The address text. 2152 * <P>Type: TEXT</P> 2153 */ 2154 public static final String ADDRESS = "address"; 2155 2156 /** 2157 * Type of address: must be one of {@code PduHeaders.BCC}, 2158 * {@code PduHeaders.CC}, {@code PduHeaders.FROM}, {@code PduHeaders.TO}. 2159 * <P>Type: INTEGER</P> 2160 */ 2161 public static final String TYPE = "type"; 2162 2163 /** 2164 * Character set of this entry (MMS charset value). 2165 * <P>Type: INTEGER</P> 2166 */ 2167 public static final String CHARSET = "charset"; 2168 } 2169 2170 /** 2171 * Contains message parts. 2172 */ 2173 public static final class Part implements BaseColumns { 2174 2175 /** 2176 * Not instantiable. 2177 * @hide 2178 */ 2179 private Part() { 2180 } 2181 2182 /** 2183 * The identifier of the message which this part belongs to. 2184 * <P>Type: INTEGER</P> 2185 */ 2186 public static final String MSG_ID = "mid"; 2187 2188 /** 2189 * The order of the part. 2190 * <P>Type: INTEGER</P> 2191 */ 2192 public static final String SEQ = "seq"; 2193 2194 /** 2195 * The content type of the part. 2196 * <P>Type: TEXT</P> 2197 */ 2198 public static final String CONTENT_TYPE = "ct"; 2199 2200 /** 2201 * The name of the part. 2202 * <P>Type: TEXT</P> 2203 */ 2204 public static final String NAME = "name"; 2205 2206 /** 2207 * The charset of the part. 2208 * <P>Type: TEXT</P> 2209 */ 2210 public static final String CHARSET = "chset"; 2211 2212 /** 2213 * The file name of the part. 2214 * <P>Type: TEXT</P> 2215 */ 2216 public static final String FILENAME = "fn"; 2217 2218 /** 2219 * The content disposition of the part. 2220 * <P>Type: TEXT</P> 2221 */ 2222 public static final String CONTENT_DISPOSITION = "cd"; 2223 2224 /** 2225 * The content ID of the part. 2226 * <P>Type: INTEGER</P> 2227 */ 2228 public static final String CONTENT_ID = "cid"; 2229 2230 /** 2231 * The content location of the part. 2232 * <P>Type: INTEGER</P> 2233 */ 2234 public static final String CONTENT_LOCATION = "cl"; 2235 2236 /** 2237 * The start of content-type of the message. 2238 * <P>Type: INTEGER</P> 2239 */ 2240 public static final String CT_START = "ctt_s"; 2241 2242 /** 2243 * The type of content-type of the message. 2244 * <P>Type: TEXT</P> 2245 */ 2246 public static final String CT_TYPE = "ctt_t"; 2247 2248 /** 2249 * The location (on filesystem) of the binary data of the part. 2250 * <P>Type: INTEGER</P> 2251 */ 2252 public static final String _DATA = "_data"; 2253 2254 /** 2255 * The message text. 2256 * <P>Type: TEXT</P> 2257 */ 2258 public static final String TEXT = "text"; 2259 } 2260 2261 /** 2262 * Message send rate table. 2263 */ 2264 public static final class Rate { 2265 2266 /** 2267 * Not instantiable. 2268 * @hide 2269 */ 2270 private Rate() { 2271 } 2272 2273 /** 2274 * The {@code content://} style URL for this table. 2275 */ 2276 public static final Uri CONTENT_URI = Uri.withAppendedPath( 2277 Mms.CONTENT_URI, "rate"); 2278 2279 /** 2280 * When a message was successfully sent. 2281 * <P>Type: INTEGER (long)</P> 2282 */ 2283 public static final String SENT_TIME = "sent_time"; 2284 } 2285 2286 /** 2287 * Intents class. 2288 */ 2289 public static final class Intents { 2290 2291 /** 2292 * Not instantiable. 2293 * @hide 2294 */ 2295 private Intents() { 2296 } 2297 2298 /** 2299 * Indicates that the contents of specified URIs were changed. 2300 * The application which is showing or caching these contents 2301 * should be updated. 2302 */ 2303 @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION) 2304 public static final String CONTENT_CHANGED_ACTION 2305 = "android.intent.action.CONTENT_CHANGED"; 2306 2307 /** 2308 * Broadcast Action: A new MMS PDU needs to be sent from 2309 * the device. This intent will only be delivered to a 2310 * carrier app. That app is responsible for sending the PDU. 2311 * The intent will have the following extra values:</p> 2312 * 2313 * <ul> 2314 * <li><em>{@link #EXTRA_MMS_CONTENT_URI}</em> - (Uri) The content provider of the 2315 * PDU to send.</li> 2316 * <li><em>{@link #EXTRA_MMS_LOCATION_URL}</em> - (String) The optional url to send 2317 * this MMS PDU. If this is not specified, PDU should be sent to the default MMSC 2318 * url.</li> 2319 * </ul> 2320 * 2321 * <p>If a BroadcastReceiver is trying to send the message, 2322 * it should set the result code to {@link android.app.Activity#RESULT_OK} and set 2323 * the following in the result extra values:</p> 2324 * 2325 * <ul> 2326 * <li><em>"messageref"</em> - (int) The new message reference number which will be 2327 * later used in the updateMmsSendStatus call.</li> 2328 * </ul> 2329 * 2330 * <p>If a BroadcastReceiver cannot send the message, it should not set the result 2331 * code and the platform will send it via the normal pathway. 2332 * </p> 2333 * 2334 * <p class="note"><strong>Note:</strong> 2335 * The broadcast receiver that filters for this intent must be a carrier privileged app. 2336 * It must also declare {@link android.Manifest.permission#BROADCAST_WAP_PUSH} as a required 2337 * permission in the <a href="{@docRoot}guide/topics/manifest/receiver-element.html"> 2338 * {@code <receiver>}</a> tag. 2339 */ 2340 @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION) 2341 public static final String MMS_SEND_ACTION = 2342 "android.provider.Telephony.MMS_SEND"; 2343 2344 /** 2345 * Broadcast Action: A new MMS needs to be downloaded. 2346 * This intent will only be delivered to a 2347 * carrier app. That app is responsible for downloading the message at the URL. 2348 * The intent will have the following extra values:</p> 2349 * 2350 * <ul> 2351 * <li><em>{@link #EXTRA_MMS_CONTENT_URI}</em> - (Uri) The content provider of the 2352 * PDU to be downloaded.</li> 2353 * <li><em>{@link #EXTRA_MMS_LOCATION_URL}</em> - (String) The message URL to be 2354 * downloaded.</li> 2355 * </ul> 2356 * 2357 * <p>If a BroadcastReceiver is trying to download the message, 2358 * it should set the result code to {@link android.app.Activity#RESULT_OK} and set 2359 * the following in the result extra values:</p> 2360 * 2361 * <ul> 2362 * <li><em>"messageref"</em> - (int) The new message reference number which will be 2363 * later used in the updateMmsDownloadStatus call.</li> 2364 * </ul> 2365 * 2366 * <p>If a BroadcastReceiver cannot download the message, it should not set the result 2367 * code and the platform will download it via the normal pathway. 2368 * </p> 2369 * 2370 * <p class="note"><strong>Note:</strong> 2371 * The broadcast receiver that filters for this intent must be a carrier privileged app. 2372 * It must also declare {@link android.Manifest.permission#BROADCAST_WAP_PUSH} as a required 2373 * permission in the <a href="{@docRoot}guide/topics/manifest/receiver-element.html"> 2374 * {@code <receiver>}</a> tag. 2375 */ 2376 @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION) 2377 public static final String MMS_DOWNLOAD_ACTION = 2378 "android.provider.Telephony.MMS_DOWNLOAD"; 2379 2380 /** 2381 * An extra field which stores the URI of deleted contents. 2382 */ 2383 public static final String DELETED_CONTENTS = "deleted_contents"; 2384 2385 /** 2386 * The content provider of the PDU to be sent/downloaded passed as an extra for 2387 * {@link #MMS_DOWNLOAD_ACTION} and {@link #MMS_SEND_ACTION}. 2388 */ 2389 public static final String EXTRA_MMS_CONTENT_URI = 2390 "android.provider.Telephony.extra.MMS_CONTENT_URI"; 2391 2392 /** 2393 * The message URL to be downloaded passed as an extra for {@link #MMS_DOWNLOAD_ACTION}. 2394 * It is also the URL to send an MMS to passed as an extra for 2395 * {@link #MMS_SEND_ACTION}. 2396 */ 2397 public static final String EXTRA_MMS_LOCATION_URL = 2398 "android.provider.Telephony.extra.MMS_LOCATION_URL"; 2399 } 2400 } 2401 2402 /** 2403 * Contains all MMS and SMS messages. 2404 */ 2405 public static final class MmsSms implements BaseColumns { 2406 2407 /** 2408 * Not instantiable. 2409 * @hide 2410 */ 2411 private MmsSms() { 2412 } 2413 2414 /** 2415 * The column to distinguish SMS and MMS messages in query results. 2416 */ 2417 public static final String TYPE_DISCRIMINATOR_COLUMN = 2418 "transport_type"; 2419 2420 /** 2421 * The {@code content://} style URL for this table. 2422 */ 2423 public static final Uri CONTENT_URI = Uri.parse("content://mms-sms/"); 2424 2425 /** 2426 * The {@code content://} style URL for this table, by conversation. 2427 */ 2428 public static final Uri CONTENT_CONVERSATIONS_URI = Uri.parse( 2429 "content://mms-sms/conversations"); 2430 2431 /** 2432 * The {@code content://} style URL for this table, by phone number. 2433 */ 2434 public static final Uri CONTENT_FILTER_BYPHONE_URI = Uri.parse( 2435 "content://mms-sms/messages/byphone"); 2436 2437 /** 2438 * The {@code content://} style URL for undelivered messages in this table. 2439 */ 2440 public static final Uri CONTENT_UNDELIVERED_URI = Uri.parse( 2441 "content://mms-sms/undelivered"); 2442 2443 /** 2444 * The {@code content://} style URL for draft messages in this table. 2445 */ 2446 public static final Uri CONTENT_DRAFT_URI = Uri.parse( 2447 "content://mms-sms/draft"); 2448 2449 /** 2450 * The {@code content://} style URL for locked messages in this table. 2451 */ 2452 public static final Uri CONTENT_LOCKED_URI = Uri.parse( 2453 "content://mms-sms/locked"); 2454 2455 /** 2456 * Pass in a query parameter called "pattern" which is the text to search for. 2457 * The sort order is fixed to be: {@code thread_id ASC, date DESC}. 2458 */ 2459 public static final Uri SEARCH_URI = Uri.parse( 2460 "content://mms-sms/search"); 2461 2462 // Constants for message protocol types. 2463 2464 /** SMS protocol type. */ 2465 public static final int SMS_PROTO = 0; 2466 2467 /** MMS protocol type. */ 2468 public static final int MMS_PROTO = 1; 2469 2470 // Constants for error types of pending messages. 2471 2472 /** Error type: no error. */ 2473 public static final int NO_ERROR = 0; 2474 2475 /** Error type: generic transient error. */ 2476 public static final int ERR_TYPE_GENERIC = 1; 2477 2478 /** Error type: SMS protocol transient error. */ 2479 public static final int ERR_TYPE_SMS_PROTO_TRANSIENT = 2; 2480 2481 /** Error type: MMS protocol transient error. */ 2482 public static final int ERR_TYPE_MMS_PROTO_TRANSIENT = 3; 2483 2484 /** Error type: transport failure. */ 2485 public static final int ERR_TYPE_TRANSPORT_FAILURE = 4; 2486 2487 /** Error type: permanent error (along with all higher error values). */ 2488 public static final int ERR_TYPE_GENERIC_PERMANENT = 10; 2489 2490 /** Error type: SMS protocol permanent error. */ 2491 public static final int ERR_TYPE_SMS_PROTO_PERMANENT = 11; 2492 2493 /** Error type: MMS protocol permanent error. */ 2494 public static final int ERR_TYPE_MMS_PROTO_PERMANENT = 12; 2495 2496 /** 2497 * Contains pending messages info. 2498 */ 2499 public static final class PendingMessages implements BaseColumns { 2500 2501 /** 2502 * Not instantiable. 2503 * @hide 2504 */ 2505 private PendingMessages() { 2506 } 2507 2508 public static final Uri CONTENT_URI = Uri.withAppendedPath( 2509 MmsSms.CONTENT_URI, "pending"); 2510 2511 /** 2512 * The type of transport protocol (MMS or SMS). 2513 * <P>Type: INTEGER</P> 2514 */ 2515 public static final String PROTO_TYPE = "proto_type"; 2516 2517 /** 2518 * The ID of the message to be sent or downloaded. 2519 * <P>Type: INTEGER (long)</P> 2520 */ 2521 public static final String MSG_ID = "msg_id"; 2522 2523 /** 2524 * The type of the message to be sent or downloaded. 2525 * This field is only valid for MM. For SM, its value is always set to 0. 2526 * <P>Type: INTEGER</P> 2527 */ 2528 public static final String MSG_TYPE = "msg_type"; 2529 2530 /** 2531 * The type of the error code. 2532 * <P>Type: INTEGER</P> 2533 */ 2534 public static final String ERROR_TYPE = "err_type"; 2535 2536 /** 2537 * The error code of sending/retrieving process. 2538 * <P>Type: INTEGER</P> 2539 */ 2540 public static final String ERROR_CODE = "err_code"; 2541 2542 /** 2543 * How many times we tried to send or download the message. 2544 * <P>Type: INTEGER</P> 2545 */ 2546 public static final String RETRY_INDEX = "retry_index"; 2547 2548 /** 2549 * The time to do next retry. 2550 * <P>Type: INTEGER (long)</P> 2551 */ 2552 public static final String DUE_TIME = "due_time"; 2553 2554 /** 2555 * The time we last tried to send or download the message. 2556 * <P>Type: INTEGER (long)</P> 2557 */ 2558 public static final String LAST_TRY = "last_try"; 2559 2560 /** 2561 * The subscription to which the message belongs to. Its value will be 2562 * {@link android.telephony.SubscriptionManager#INVALID_SUBSCRIPTION_ID} if 2563 * the sub id cannot be determined. 2564 * <p>Type: INTEGER (long) </p> 2565 */ 2566 public static final String SUBSCRIPTION_ID = "pending_sub_id"; 2567 } 2568 2569 /** 2570 * Words table used by provider for full-text searches. 2571 * @hide 2572 */ 2573 public static final class WordsTable { 2574 2575 /** 2576 * Not instantiable. 2577 * @hide 2578 */ 2579 private WordsTable() {} 2580 2581 /** 2582 * Primary key. 2583 * <P>Type: INTEGER (long)</P> 2584 */ 2585 public static final String ID = "_id"; 2586 2587 /** 2588 * Source row ID. 2589 * <P>Type: INTEGER (long)</P> 2590 */ 2591 public static final String SOURCE_ROW_ID = "source_id"; 2592 2593 /** 2594 * Table ID (either 1 or 2). 2595 * <P>Type: INTEGER</P> 2596 */ 2597 public static final String TABLE_ID = "table_to_use"; 2598 2599 /** 2600 * The words to index. 2601 * <P>Type: TEXT</P> 2602 */ 2603 public static final String INDEXED_TEXT = "index_text"; 2604 } 2605 } 2606 2607 /** 2608 * Carriers class contains information about APNs, including MMSC information. 2609 */ 2610 public static final class Carriers implements BaseColumns { 2611 2612 /** 2613 * Not instantiable. 2614 * @hide 2615 */ 2616 private Carriers() {} 2617 2618 /** 2619 * The {@code content://} style URL for this table. 2620 */ 2621 public static final Uri CONTENT_URI = Uri.parse("content://telephony/carriers"); 2622 2623 /** 2624 * The default sort order for this table. 2625 */ 2626 public static final String DEFAULT_SORT_ORDER = "name ASC"; 2627 2628 /** 2629 * Entry name. 2630 * <P>Type: TEXT</P> 2631 */ 2632 public static final String NAME = "name"; 2633 2634 /** 2635 * APN name. 2636 * <P>Type: TEXT</P> 2637 */ 2638 public static final String APN = "apn"; 2639 2640 /** 2641 * Proxy address. 2642 * <P>Type: TEXT</P> 2643 */ 2644 public static final String PROXY = "proxy"; 2645 2646 /** 2647 * Proxy port. 2648 * <P>Type: TEXT</P> 2649 */ 2650 public static final String PORT = "port"; 2651 2652 /** 2653 * MMS proxy address. 2654 * <P>Type: TEXT</P> 2655 */ 2656 public static final String MMSPROXY = "mmsproxy"; 2657 2658 /** 2659 * MMS proxy port. 2660 * <P>Type: TEXT</P> 2661 */ 2662 public static final String MMSPORT = "mmsport"; 2663 2664 /** 2665 * Server address. 2666 * <P>Type: TEXT</P> 2667 */ 2668 public static final String SERVER = "server"; 2669 2670 /** 2671 * APN username. 2672 * <P>Type: TEXT</P> 2673 */ 2674 public static final String USER = "user"; 2675 2676 /** 2677 * APN password. 2678 * <P>Type: TEXT</P> 2679 */ 2680 public static final String PASSWORD = "password"; 2681 2682 /** 2683 * MMSC URL. 2684 * <P>Type: TEXT</P> 2685 */ 2686 public static final String MMSC = "mmsc"; 2687 2688 /** 2689 * Mobile Country Code (MCC). 2690 * <P>Type: TEXT</P> 2691 */ 2692 public static final String MCC = "mcc"; 2693 2694 /** 2695 * Mobile Network Code (MNC). 2696 * <P>Type: TEXT</P> 2697 */ 2698 public static final String MNC = "mnc"; 2699 2700 /** 2701 * Numeric operator ID (as String). Usually {@code MCC + MNC}. 2702 * <P>Type: TEXT</P> 2703 */ 2704 public static final String NUMERIC = "numeric"; 2705 2706 /** 2707 * Authentication type. 2708 * <P>Type: INTEGER</P> 2709 */ 2710 public static final String AUTH_TYPE = "authtype"; 2711 2712 /** 2713 * Comma-delimited list of APN types. 2714 * <P>Type: TEXT</P> 2715 */ 2716 public static final String TYPE = "type"; 2717 2718 /** 2719 * The protocol to use to connect to this APN. 2720 * 2721 * One of the {@code PDP_type} values in TS 27.007 section 10.1.1. 2722 * For example: {@code IP}, {@code IPV6}, {@code IPV4V6}, or {@code PPP}. 2723 * <P>Type: TEXT</P> 2724 */ 2725 public static final String PROTOCOL = "protocol"; 2726 2727 /** 2728 * The protocol to use to connect to this APN when roaming. 2729 * The syntax is the same as protocol. 2730 * <P>Type: TEXT</P> 2731 */ 2732 public static final String ROAMING_PROTOCOL = "roaming_protocol"; 2733 2734 /** 2735 * Is this the current APN? 2736 * <P>Type: INTEGER (boolean)</P> 2737 */ 2738 public static final String CURRENT = "current"; 2739 2740 /** 2741 * Is this APN enabled? 2742 * <P>Type: INTEGER (boolean)</P> 2743 */ 2744 public static final String CARRIER_ENABLED = "carrier_enabled"; 2745 2746 /** 2747 * Radio Access Technology info. 2748 * To check what values are allowed, refer to {@link android.telephony.ServiceState}. 2749 * This should be spread to other technologies, 2750 * but is currently only used for LTE (14) and eHRPD (13). 2751 * <P>Type: INTEGER</P> 2752 */ 2753 public static final String BEARER = "bearer"; 2754 2755 /** 2756 * MVNO type: 2757 * {@code SPN (Service Provider Name), IMSI, GID (Group Identifier Level 1)}. 2758 * <P>Type: TEXT</P> 2759 */ 2760 public static final String MVNO_TYPE = "mvno_type"; 2761 2762 /** 2763 * MVNO data. 2764 * Use the following examples. 2765 * <ul> 2766 * <li>SPN: A MOBILE, BEN NL, ...</li> 2767 * <li>IMSI: 302720x94, 2060188, ...</li> 2768 * <li>GID: 4E, 33, ...</li> 2769 * </ul> 2770 * <P>Type: TEXT</P> 2771 */ 2772 public static final String MVNO_MATCH_DATA = "mvno_match_data"; 2773 2774 /** 2775 * The subscription to which the APN belongs to 2776 * <p>Type: INTEGER (long) </p> 2777 */ 2778 public static final String SUBSCRIPTION_ID = "sub_id"; 2779 2780 /** 2781 * The profile_id to which the APN saved in modem 2782 * <p>Type: INTEGER</p> 2783 *@hide 2784 */ 2785 public static final String PROFILE_ID = "profile_id"; 2786 2787 /** 2788 * Is the apn setting to be set in modem 2789 * <P>Type: INTEGER (boolean)</P> 2790 *@hide 2791 */ 2792 public static final String MODEM_COGNITIVE = "modem_cognitive"; 2793 2794 /** 2795 * The max connections of this apn 2796 * <p>Type: INTEGER</p> 2797 *@hide 2798 */ 2799 public static final String MAX_CONNS = "max_conns"; 2800 2801 /** 2802 * The wait time for retry of the apn 2803 * <p>Type: INTEGER</p> 2804 *@hide 2805 */ 2806 public static final String WAIT_TIME = "wait_time"; 2807 2808 /** 2809 * The time to limit max connection for the apn 2810 * <p>Type: INTEGER</p> 2811 *@hide 2812 */ 2813 public static final String MAX_CONNS_TIME = "max_conns_time"; 2814 2815 /** 2816 * The MTU size of the mobile interface to which the APN connected 2817 * <p>Type: INTEGER </p> 2818 * @hide 2819 */ 2820 public static final String MTU = "mtu"; 2821 } 2822 2823 /** 2824 * Contains received SMS cell broadcast messages. 2825 * @hide 2826 */ 2827 public static final class CellBroadcasts implements BaseColumns { 2828 2829 /** 2830 * Not instantiable. 2831 * @hide 2832 */ 2833 private CellBroadcasts() {} 2834 2835 /** 2836 * The {@code content://} URI for this table. 2837 */ 2838 public static final Uri CONTENT_URI = Uri.parse("content://cellbroadcasts"); 2839 2840 /** 2841 * Message geographical scope. 2842 * <P>Type: INTEGER</P> 2843 */ 2844 public static final String GEOGRAPHICAL_SCOPE = "geo_scope"; 2845 2846 /** 2847 * Message serial number. 2848 * <P>Type: INTEGER</P> 2849 */ 2850 public static final String SERIAL_NUMBER = "serial_number"; 2851 2852 /** 2853 * PLMN of broadcast sender. {@code SERIAL_NUMBER + PLMN + LAC + CID} uniquely identifies 2854 * a broadcast for duplicate detection purposes. 2855 * <P>Type: TEXT</P> 2856 */ 2857 public static final String PLMN = "plmn"; 2858 2859 /** 2860 * Location Area (GSM) or Service Area (UMTS) of broadcast sender. Unused for CDMA. 2861 * Only included if Geographical Scope of message is not PLMN wide (01). 2862 * <P>Type: INTEGER</P> 2863 */ 2864 public static final String LAC = "lac"; 2865 2866 /** 2867 * Cell ID of message sender (GSM/UMTS). Unused for CDMA. Only included when the 2868 * Geographical Scope of message is cell wide (00 or 11). 2869 * <P>Type: INTEGER</P> 2870 */ 2871 public static final String CID = "cid"; 2872 2873 /** 2874 * Message code. <em>OBSOLETE: merged into SERIAL_NUMBER.</em> 2875 * <P>Type: INTEGER</P> 2876 */ 2877 public static final String V1_MESSAGE_CODE = "message_code"; 2878 2879 /** 2880 * Message identifier. <em>OBSOLETE: renamed to SERVICE_CATEGORY.</em> 2881 * <P>Type: INTEGER</P> 2882 */ 2883 public static final String V1_MESSAGE_IDENTIFIER = "message_id"; 2884 2885 /** 2886 * Service category (GSM/UMTS: message identifier; CDMA: service category). 2887 * <P>Type: INTEGER</P> 2888 */ 2889 public static final String SERVICE_CATEGORY = "service_category"; 2890 2891 /** 2892 * Message language code. 2893 * <P>Type: TEXT</P> 2894 */ 2895 public static final String LANGUAGE_CODE = "language"; 2896 2897 /** 2898 * Message body. 2899 * <P>Type: TEXT</P> 2900 */ 2901 public static final String MESSAGE_BODY = "body"; 2902 2903 /** 2904 * Message delivery time. 2905 * <P>Type: INTEGER (long)</P> 2906 */ 2907 public static final String DELIVERY_TIME = "date"; 2908 2909 /** 2910 * Has the message been viewed? 2911 * <P>Type: INTEGER (boolean)</P> 2912 */ 2913 public static final String MESSAGE_READ = "read"; 2914 2915 /** 2916 * Message format (3GPP or 3GPP2). 2917 * <P>Type: INTEGER</P> 2918 */ 2919 public static final String MESSAGE_FORMAT = "format"; 2920 2921 /** 2922 * Message priority (including emergency). 2923 * <P>Type: INTEGER</P> 2924 */ 2925 public static final String MESSAGE_PRIORITY = "priority"; 2926 2927 /** 2928 * ETWS warning type (ETWS alerts only). 2929 * <P>Type: INTEGER</P> 2930 */ 2931 public static final String ETWS_WARNING_TYPE = "etws_warning_type"; 2932 2933 /** 2934 * CMAS message class (CMAS alerts only). 2935 * <P>Type: INTEGER</P> 2936 */ 2937 public static final String CMAS_MESSAGE_CLASS = "cmas_message_class"; 2938 2939 /** 2940 * CMAS category (CMAS alerts only). 2941 * <P>Type: INTEGER</P> 2942 */ 2943 public static final String CMAS_CATEGORY = "cmas_category"; 2944 2945 /** 2946 * CMAS response type (CMAS alerts only). 2947 * <P>Type: INTEGER</P> 2948 */ 2949 public static final String CMAS_RESPONSE_TYPE = "cmas_response_type"; 2950 2951 /** 2952 * CMAS severity (CMAS alerts only). 2953 * <P>Type: INTEGER</P> 2954 */ 2955 public static final String CMAS_SEVERITY = "cmas_severity"; 2956 2957 /** 2958 * CMAS urgency (CMAS alerts only). 2959 * <P>Type: INTEGER</P> 2960 */ 2961 public static final String CMAS_URGENCY = "cmas_urgency"; 2962 2963 /** 2964 * CMAS certainty (CMAS alerts only). 2965 * <P>Type: INTEGER</P> 2966 */ 2967 public static final String CMAS_CERTAINTY = "cmas_certainty"; 2968 2969 /** The default sort order for this table. */ 2970 public static final String DEFAULT_SORT_ORDER = DELIVERY_TIME + " DESC"; 2971 2972 /** 2973 * Query columns for instantiating {@link android.telephony.CellBroadcastMessage} objects. 2974 */ 2975 public static final String[] QUERY_COLUMNS = { 2976 _ID, 2977 GEOGRAPHICAL_SCOPE, 2978 PLMN, 2979 LAC, 2980 CID, 2981 SERIAL_NUMBER, 2982 SERVICE_CATEGORY, 2983 LANGUAGE_CODE, 2984 MESSAGE_BODY, 2985 DELIVERY_TIME, 2986 MESSAGE_READ, 2987 MESSAGE_FORMAT, 2988 MESSAGE_PRIORITY, 2989 ETWS_WARNING_TYPE, 2990 CMAS_MESSAGE_CLASS, 2991 CMAS_CATEGORY, 2992 CMAS_RESPONSE_TYPE, 2993 CMAS_SEVERITY, 2994 CMAS_URGENCY, 2995 CMAS_CERTAINTY 2996 }; 2997 } 2998} 2999