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 17 package android.provider; 18 19 import android.Manifest; 20 import android.annotation.IntDef; 21 import android.annotation.NonNull; 22 import android.annotation.RequiresPermission; 23 import android.annotation.SdkConstant; 24 import android.annotation.SdkConstant.SdkConstantType; 25 import android.annotation.SystemApi; 26 import android.annotation.TestApi; 27 import android.compat.annotation.ChangeId; 28 import android.compat.annotation.EnabledAfter; 29 import android.compat.annotation.UnsupportedAppUsage; 30 import android.content.ComponentName; 31 import android.content.ContentResolver; 32 import android.content.ContentValues; 33 import android.content.Context; 34 import android.content.Intent; 35 import android.database.ContentObserver; 36 import android.database.Cursor; 37 import android.database.sqlite.SqliteWrapper; 38 import android.net.Uri; 39 import android.os.Build; 40 import android.os.Bundle; 41 import android.telephony.CarrierConfigManager; 42 import android.telephony.Rlog; 43 import android.telephony.ServiceState; 44 import android.telephony.SmsMessage; 45 import android.telephony.SubscriptionManager; 46 import android.telephony.TelephonyManager; 47 import android.telephony.UiccAccessRule; 48 import android.text.TextUtils; 49 import android.util.Patterns; 50 51 import com.android.internal.telephony.SmsApplication; 52 53 import java.lang.annotation.Retention; 54 import java.lang.annotation.RetentionPolicy; 55 import java.util.HashSet; 56 import java.util.List; 57 import java.util.Set; 58 import java.util.regex.Matcher; 59 import java.util.regex.Pattern; 60 61 /** 62 * The Telephony provider contains data related to phone operation, specifically SMS and MMS 63 * messages, access to the APN list, including the MMSC to use, and the service state. 64 * 65 * <p class="note"><strong>Note:</strong> These APIs are not available on all Android-powered 66 * devices. If your app depends on telephony features such as for managing SMS messages, include 67 * a <a href="{@docRoot}guide/topics/manifest/uses-feature-element.html">{@code <uses-feature>} 68 * </a> element in your manifest that declares the {@code "android.hardware.telephony"} hardware 69 * feature. Alternatively, you can check for telephony availability at runtime using either 70 * {@link android.content.pm.PackageManager#hasSystemFeature 71 * hasSystemFeature(PackageManager.FEATURE_TELEPHONY)} or {@link 72 * android.telephony.TelephonyManager#getPhoneType}.</p> 73 * 74 * <h3>Creating an SMS app</h3> 75 * 76 * <p>Only the default SMS app (selected by the user in system settings) is able to write to the 77 * SMS Provider (the tables defined within the {@code Telephony} class) and only the default SMS 78 * app receives the {@link android.provider.Telephony.Sms.Intents#SMS_DELIVER_ACTION} broadcast 79 * when the user receives an SMS or the {@link 80 * android.provider.Telephony.Sms.Intents#WAP_PUSH_DELIVER_ACTION} broadcast when the user 81 * receives an MMS.</p> 82 * 83 * <p>Any app that wants to behave as the user's default SMS app must handle the following intents: 84 * <ul> 85 * <li>In a broadcast receiver, include an intent filter for {@link Sms.Intents#SMS_DELIVER_ACTION} 86 * (<code>"android.provider.Telephony.SMS_DELIVER"</code>). The broadcast receiver must also 87 * require the {@link android.Manifest.permission#BROADCAST_SMS} permission. 88 * <p>This allows your app to directly receive incoming SMS messages.</p></li> 89 * <li>In a broadcast receiver, include an intent filter for {@link 90 * Sms.Intents#WAP_PUSH_DELIVER_ACTION}} ({@code "android.provider.Telephony.WAP_PUSH_DELIVER"}) 91 * with the MIME type <code>"application/vnd.wap.mms-message"</code>. 92 * The broadcast receiver must also require the {@link 93 * android.Manifest.permission#BROADCAST_WAP_PUSH} permission. 94 * <p>This allows your app to directly receive incoming MMS messages.</p></li> 95 * <li>In your activity that delivers new messages, include an intent filter for 96 * {@link android.content.Intent#ACTION_SENDTO} (<code>"android.intent.action.SENDTO" 97 * </code>) with schemas, <code>sms:</code>, <code>smsto:</code>, <code>mms:</code>, and 98 * <code>mmsto:</code>. 99 * <p>This allows your app to receive intents from other apps that want to deliver a 100 * message.</p></li> 101 * <li>In a service, include an intent filter for {@link 102 * android.telephony.TelephonyManager#ACTION_RESPOND_VIA_MESSAGE} 103 * (<code>"android.intent.action.RESPOND_VIA_MESSAGE"</code>) with schemas, 104 * <code>sms:</code>, <code>smsto:</code>, <code>mms:</code>, and <code>mmsto:</code>. 105 * This service must also require the {@link 106 * android.Manifest.permission#SEND_RESPOND_VIA_MESSAGE} permission. 107 * <p>This allows users to respond to incoming phone calls with an immediate text message 108 * using your app.</p></li> 109 * </ul> 110 * 111 * <p>Other apps that are not selected as the default SMS app can only <em>read</em> the SMS 112 * Provider, but may also be notified when a new SMS arrives by listening for the {@link 113 * Sms.Intents#SMS_RECEIVED_ACTION} 114 * broadcast, which is a non-abortable broadcast that may be delivered to multiple apps. This 115 * broadcast is intended for apps that—while not selected as the default SMS app—need to 116 * read special incoming messages such as to perform phone number verification.</p> 117 * 118 * <p>For more information about building SMS apps, read the blog post, <a 119 * href="http://android-developers.blogspot.com/2013/10/getting-your-sms-apps-ready-for-kitkat.html" 120 * >Getting Your SMS Apps Ready for KitKat</a>.</p> 121 * 122 */ 123 public final class Telephony { 124 private static final String TAG = "Telephony"; 125 126 /** 127 * Not instantiable. 128 * @hide 129 */ Telephony()130 private Telephony() { 131 } 132 133 /** 134 * Base columns for tables that contain text-based SMSs. 135 */ 136 public interface TextBasedSmsColumns { 137 138 /** Message type: all messages. */ 139 public static final int MESSAGE_TYPE_ALL = 0; 140 141 /** Message type: inbox. */ 142 public static final int MESSAGE_TYPE_INBOX = 1; 143 144 /** Message type: sent messages. */ 145 public static final int MESSAGE_TYPE_SENT = 2; 146 147 /** Message type: drafts. */ 148 public static final int MESSAGE_TYPE_DRAFT = 3; 149 150 /** Message type: outbox. */ 151 public static final int MESSAGE_TYPE_OUTBOX = 4; 152 153 /** Message type: failed outgoing message. */ 154 public static final int MESSAGE_TYPE_FAILED = 5; 155 156 /** Message type: queued to send later. */ 157 public static final int MESSAGE_TYPE_QUEUED = 6; 158 159 /** 160 * The type of message. 161 * <P>Type: INTEGER</P> 162 */ 163 public static final String TYPE = "type"; 164 165 /** 166 * The thread ID of the message. 167 * <P>Type: INTEGER</P> 168 */ 169 public static final String THREAD_ID = "thread_id"; 170 171 /** 172 * The address of the other party. 173 * <P>Type: TEXT</P> 174 */ 175 public static final String ADDRESS = "address"; 176 177 /** 178 * The date the message was received. 179 * <P>Type: INTEGER (long)</P> 180 */ 181 public static final String DATE = "date"; 182 183 /** 184 * The date the message was sent. 185 * <P>Type: INTEGER (long)</P> 186 */ 187 public static final String DATE_SENT = "date_sent"; 188 189 /** 190 * Has the message been read? 191 * <P>Type: INTEGER (boolean)</P> 192 */ 193 public static final String READ = "read"; 194 195 /** 196 * Has the message been seen by the user? The "seen" flag determines 197 * whether we need to show a notification. 198 * <P>Type: INTEGER (boolean)</P> 199 */ 200 public static final String SEEN = "seen"; 201 202 /** 203 * {@code TP-Status} value for the message, or -1 if no status has been received. 204 * <P>Type: INTEGER</P> 205 */ 206 public static final String STATUS = "status"; 207 208 /** TP-Status: no status received. */ 209 public static final int STATUS_NONE = -1; 210 /** TP-Status: complete. */ 211 public static final int STATUS_COMPLETE = 0; 212 /** TP-Status: pending. */ 213 public static final int STATUS_PENDING = 32; 214 /** TP-Status: failed. */ 215 public static final int STATUS_FAILED = 64; 216 217 /** 218 * The subject of the message, if present. 219 * <P>Type: TEXT</P> 220 */ 221 public static final String SUBJECT = "subject"; 222 223 /** 224 * The body of the message. 225 * <P>Type: TEXT</P> 226 */ 227 public static final String BODY = "body"; 228 229 /** 230 * The ID of the sender of the conversation, if present. 231 * <P>Type: INTEGER (reference to item in {@code content://contacts/people})</P> 232 */ 233 public static final String PERSON = "person"; 234 235 /** 236 * The protocol identifier code. 237 * <P>Type: INTEGER</P> 238 */ 239 public static final String PROTOCOL = "protocol"; 240 241 /** 242 * Is the {@code TP-Reply-Path} flag set? 243 * <P>Type: BOOLEAN</P> 244 */ 245 public static final String REPLY_PATH_PRESENT = "reply_path_present"; 246 247 /** 248 * The service center (SC) through which to send the message, if present. 249 * <P>Type: TEXT</P> 250 */ 251 public static final String SERVICE_CENTER = "service_center"; 252 253 /** 254 * Is the message locked? 255 * <P>Type: INTEGER (boolean)</P> 256 */ 257 public static final String LOCKED = "locked"; 258 259 /** 260 * The subscription to which the message belongs to. Its value will be 261 * < 0 if the sub id cannot be determined. 262 * <p>Type: INTEGER (long) </p> 263 */ 264 public static final String SUBSCRIPTION_ID = "sub_id"; 265 266 /** 267 * The MTU size of the mobile interface to which the APN connected 268 * @hide 269 */ 270 public static final String MTU = "mtu"; 271 272 /** 273 * Error code associated with sending or receiving this message 274 * <P>Type: INTEGER</P> 275 */ 276 public static final String ERROR_CODE = "error_code"; 277 278 /** 279 * The identity of the sender of a sent message. It is 280 * usually the package name of the app which sends the message. 281 * <p class="note"><strong>Note:</strong> 282 * This column is read-only. It is set by the provider and can not be changed by apps. 283 * <p>Type: TEXT</p> 284 */ 285 public static final String CREATOR = "creator"; 286 } 287 288 /** 289 * Columns in sms_changes table. 290 * @hide 291 */ 292 public interface TextBasedSmsChangesColumns { 293 /** 294 * The {@code content://} style URL for this table. 295 * @hide 296 */ 297 public static final Uri CONTENT_URI = Uri.parse("content://sms-changes"); 298 299 /** 300 * Primary key. 301 * <P>Type: INTEGER (long)</P> 302 * @hide 303 */ 304 public static final String ID = "_id"; 305 306 /** 307 * Triggers on sms table create a row in this table for each update/delete. 308 * This column is the "_id" of the row from sms table that was updated/deleted. 309 * <P>Type: INTEGER (long)</P> 310 * @hide 311 */ 312 public static final String ORIG_ROW_ID = "orig_rowid"; 313 314 /** 315 * Triggers on sms table create a row in this table for each update/delete. 316 * This column is the "sub_id" of the row from sms table that was updated/deleted. 317 * @hide 318 * <P>Type: INTEGER (long)</P> 319 */ 320 public static final String SUB_ID = "sub_id"; 321 322 /** 323 * The type of operation that created this row. 324 * {@link #TYPE_UPDATE} = update op 325 * {@link #TYPE_DELETE} = delete op 326 * @hide 327 * <P>Type: INTEGER (long)</P> 328 */ 329 public static final String TYPE = "type"; 330 331 /** 332 * One of the possible values for the above column "type". Indicates it is an update op. 333 * @hide 334 */ 335 public static final int TYPE_UPDATE = 0; 336 337 /** 338 * One of the possible values for the above column "type". Indicates it is a delete op. 339 * @hide 340 */ 341 public static final int TYPE_DELETE = 1; 342 343 /** 344 * This column contains a non-null value only if the operation on sms table is an update op 345 * and the column "read" is changed by the update op. 346 * <P>Type: INTEGER (boolean)</P> 347 * @hide 348 */ 349 public static final String NEW_READ_STATUS = "new_read_status"; 350 } 351 352 /** 353 * Contains all text-based SMS messages. 354 */ 355 public static final class Sms implements BaseColumns, TextBasedSmsColumns { 356 357 /** 358 * Not instantiable. 359 * @hide 360 */ Sms()361 private Sms() { 362 } 363 364 /** 365 * Used to determine the currently configured default SMS package. 366 * <p> 367 * As of Android 11 apps will need specific permission to query other packages. To use 368 * this method an app must include in their AndroidManifest: 369 * <queries> 370 * <intent> 371 * <action android:name="android.provider.Telephony.SMS_DELIVER"/> 372 * </intent> 373 * </queries> 374 * Which will allow them to query packages which declare intent filters that include 375 * the {@link android.provider.Telephony.Sms.Intents#SMS_DELIVER_ACTION} intent. 376 * </p> 377 * 378 * @param context context of the requesting application 379 * @return package name for the default SMS package or null 380 */ getDefaultSmsPackage(Context context)381 public static String getDefaultSmsPackage(Context context) { 382 ComponentName component = SmsApplication.getDefaultSmsApplication(context, false); 383 if (component != null) { 384 return component.getPackageName(); 385 } 386 return null; 387 } 388 389 /** 390 * Return cursor for table query. 391 * @hide 392 */ query(ContentResolver cr, String[] projection)393 public static Cursor query(ContentResolver cr, String[] projection) { 394 return cr.query(CONTENT_URI, projection, null, null, DEFAULT_SORT_ORDER); 395 } 396 397 /** 398 * Return cursor for table query. 399 * @hide 400 */ 401 @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.P, trackingBug = 115609023) query(ContentResolver cr, String[] projection, String where, String orderBy)402 public static Cursor query(ContentResolver cr, String[] projection, 403 String where, String orderBy) { 404 return cr.query(CONTENT_URI, projection, where, 405 null, orderBy == null ? DEFAULT_SORT_ORDER : orderBy); 406 } 407 408 /** 409 * The {@code content://} style URL for this table. 410 */ 411 public static final Uri CONTENT_URI = Uri.parse("content://sms"); 412 413 /** 414 * The default sort order for this table. 415 */ 416 public static final String DEFAULT_SORT_ORDER = "date DESC"; 417 418 /** 419 * Add an SMS to the given URI. 420 * 421 * @param resolver the content resolver to use 422 * @param uri the URI to add the message to 423 * @param address the address of the sender 424 * @param body the body of the message 425 * @param subject the pseudo-subject of the message 426 * @param date the timestamp for the message 427 * @param read true if the message has been read, false if not 428 * @param deliveryReport true if a delivery report was requested, false if not 429 * @return the URI for the new message 430 * @hide 431 */ 432 @UnsupportedAppUsage addMessageToUri(ContentResolver resolver, Uri uri, String address, String body, String subject, Long date, boolean read, boolean deliveryReport)433 public static Uri addMessageToUri(ContentResolver resolver, 434 Uri uri, String address, String body, String subject, 435 Long date, boolean read, boolean deliveryReport) { 436 return addMessageToUri(SubscriptionManager.getDefaultSmsSubscriptionId(), 437 resolver, uri, address, body, subject, date, read, deliveryReport, -1L); 438 } 439 440 /** 441 * Add an SMS to the given URI. 442 * 443 * @param resolver the content resolver to use 444 * @param uri the URI to add the message to 445 * @param address the address of the sender 446 * @param body the body of the message 447 * @param subject the psuedo-subject of the message 448 * @param date the timestamp for the message 449 * @param read true if the message has been read, false if not 450 * @param deliveryReport true if a delivery report was requested, false if not 451 * @param subId the subscription which the message belongs to 452 * @return the URI for the new message 453 * @hide 454 */ 455 @UnsupportedAppUsage addMessageToUri(int subId, ContentResolver resolver, Uri uri, String address, String body, String subject, Long date, boolean read, boolean deliveryReport)456 public static Uri addMessageToUri(int subId, ContentResolver resolver, 457 Uri uri, String address, String body, String subject, 458 Long date, boolean read, boolean deliveryReport) { 459 return addMessageToUri(subId, resolver, uri, address, body, subject, 460 date, read, deliveryReport, -1L); 461 } 462 463 /** 464 * Add an SMS to the given URI with the specified thread ID. 465 * 466 * @param resolver the content resolver to use 467 * @param uri the URI to add the message to 468 * @param address the address of the sender 469 * @param body the body of the message 470 * @param subject the pseudo-subject of the message 471 * @param date the timestamp for the message 472 * @param read true if the message has been read, false if not 473 * @param deliveryReport true if a delivery report was requested, false if not 474 * @param threadId the thread_id of the message 475 * @return the URI for the new message 476 * @hide 477 */ 478 @UnsupportedAppUsage addMessageToUri(ContentResolver resolver, Uri uri, String address, String body, String subject, Long date, boolean read, boolean deliveryReport, long threadId)479 public static Uri addMessageToUri(ContentResolver resolver, 480 Uri uri, String address, String body, String subject, 481 Long date, boolean read, boolean deliveryReport, long threadId) { 482 return addMessageToUri(SubscriptionManager.getDefaultSmsSubscriptionId(), 483 resolver, uri, address, body, subject, 484 date, read, deliveryReport, threadId); 485 } 486 487 /** 488 * Add an SMS to the given URI with thread_id specified. 489 * 490 * @param resolver the content resolver to use 491 * @param uri the URI to add the message to 492 * @param address the address of the sender 493 * @param body the body of the message 494 * @param subject the psuedo-subject of the message 495 * @param date the timestamp for the message 496 * @param read true if the message has been read, false if not 497 * @param deliveryReport true if a delivery report was requested, false if not 498 * @param threadId the thread_id of the message 499 * @param subId the subscription which the message belongs to 500 * @return the URI for the new message 501 * @hide 502 */ 503 @UnsupportedAppUsage addMessageToUri(int subId, ContentResolver resolver, Uri uri, String address, String body, String subject, Long date, boolean read, boolean deliveryReport, long threadId)504 public static Uri addMessageToUri(int subId, ContentResolver resolver, 505 Uri uri, String address, String body, String subject, 506 Long date, boolean read, boolean deliveryReport, long threadId) { 507 ContentValues values = new ContentValues(8); 508 Rlog.v(TAG,"Telephony addMessageToUri sub id: " + subId); 509 510 values.put(SUBSCRIPTION_ID, subId); 511 values.put(ADDRESS, address); 512 if (date != null) { 513 values.put(DATE, date); 514 } 515 values.put(READ, read ? Integer.valueOf(1) : Integer.valueOf(0)); 516 values.put(SUBJECT, subject); 517 values.put(BODY, body); 518 if (deliveryReport) { 519 values.put(STATUS, STATUS_PENDING); 520 } 521 if (threadId != -1L) { 522 values.put(THREAD_ID, threadId); 523 } 524 return resolver.insert(uri, values); 525 } 526 527 /** 528 * Move a message to the given folder. 529 * 530 * @param context the context to use 531 * @param uri the message to move 532 * @param folder the folder to move to 533 * @return true if the operation succeeded 534 * @hide 535 */ 536 @UnsupportedAppUsage moveMessageToFolder(Context context, Uri uri, int folder, int error)537 public static boolean moveMessageToFolder(Context context, 538 Uri uri, int folder, int error) { 539 if (uri == null) { 540 return false; 541 } 542 543 boolean markAsUnread = false; 544 boolean markAsRead = false; 545 switch(folder) { 546 case MESSAGE_TYPE_INBOX: 547 case MESSAGE_TYPE_DRAFT: 548 break; 549 case MESSAGE_TYPE_OUTBOX: 550 case MESSAGE_TYPE_SENT: 551 markAsRead = true; 552 break; 553 case MESSAGE_TYPE_FAILED: 554 case MESSAGE_TYPE_QUEUED: 555 markAsUnread = true; 556 break; 557 default: 558 return false; 559 } 560 561 ContentValues values = new ContentValues(3); 562 563 values.put(TYPE, folder); 564 if (markAsUnread) { 565 values.put(READ, 0); 566 } else if (markAsRead) { 567 values.put(READ, 1); 568 } 569 values.put(ERROR_CODE, error); 570 571 return 1 == SqliteWrapper.update(context, context.getContentResolver(), 572 uri, values, null, null); 573 } 574 575 /** 576 * Returns true iff the folder (message type) identifies an 577 * outgoing message. 578 * @hide 579 */ 580 @UnsupportedAppUsage isOutgoingFolder(int messageType)581 public static boolean isOutgoingFolder(int messageType) { 582 return (messageType == MESSAGE_TYPE_FAILED) 583 || (messageType == MESSAGE_TYPE_OUTBOX) 584 || (messageType == MESSAGE_TYPE_SENT) 585 || (messageType == MESSAGE_TYPE_QUEUED); 586 } 587 588 /** 589 * Contains all text-based SMS messages in the SMS app inbox. 590 */ 591 public static final class Inbox implements BaseColumns, TextBasedSmsColumns { 592 593 /** 594 * Not instantiable. 595 * @hide 596 */ Inbox()597 private Inbox() { 598 } 599 600 /** 601 * The {@code content://} style URL for this table. 602 */ 603 public static final Uri CONTENT_URI = Uri.parse("content://sms/inbox"); 604 605 /** 606 * The default sort order for this table. 607 */ 608 public static final String DEFAULT_SORT_ORDER = "date DESC"; 609 610 /** 611 * Add an SMS to the Draft box. 612 * 613 * @param resolver the content resolver to use 614 * @param address the address of the sender 615 * @param body the body of the message 616 * @param subject the pseudo-subject of the message 617 * @param date the timestamp for the message 618 * @param read true if the message has been read, false if not 619 * @return the URI for the new message 620 * @hide 621 */ 622 @UnsupportedAppUsage addMessage(ContentResolver resolver, String address, String body, String subject, Long date, boolean read)623 public static Uri addMessage(ContentResolver resolver, 624 String address, String body, String subject, Long date, 625 boolean read) { 626 return addMessageToUri(SubscriptionManager.getDefaultSmsSubscriptionId(), 627 resolver, CONTENT_URI, address, body, subject, date, read, false); 628 } 629 630 /** 631 * Add an SMS to the Draft box. 632 * 633 * @param resolver the content resolver to use 634 * @param address the address of the sender 635 * @param body the body of the message 636 * @param subject the psuedo-subject of the message 637 * @param date the timestamp for the message 638 * @param read true if the message has been read, false if not 639 * @param subId the subscription which the message belongs to 640 * @return the URI for the new message 641 * @hide 642 */ 643 @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.R, trackingBug = 170729553) addMessage(int subId, ContentResolver resolver, String address, String body, String subject, Long date, boolean read)644 public static Uri addMessage(int subId, ContentResolver resolver, 645 String address, String body, String subject, Long date, boolean read) { 646 return addMessageToUri(subId, resolver, CONTENT_URI, address, body, 647 subject, date, read, false); 648 } 649 } 650 651 /** 652 * Contains all sent text-based SMS messages in the SMS app. 653 */ 654 public static final class Sent implements BaseColumns, TextBasedSmsColumns { 655 656 /** 657 * Not instantiable. 658 * @hide 659 */ Sent()660 private Sent() { 661 } 662 663 /** 664 * The {@code content://} style URL for this table. 665 */ 666 public static final Uri CONTENT_URI = Uri.parse("content://sms/sent"); 667 668 /** 669 * The default sort order for this table. 670 */ 671 public static final String DEFAULT_SORT_ORDER = "date DESC"; 672 673 /** 674 * Add an SMS to the Draft box. 675 * 676 * @param resolver the content resolver to use 677 * @param address the address of the sender 678 * @param body the body of the message 679 * @param subject the pseudo-subject of the message 680 * @param date the timestamp for the message 681 * @return the URI for the new message 682 * @hide 683 */ 684 @UnsupportedAppUsage addMessage(ContentResolver resolver, String address, String body, String subject, Long date)685 public static Uri addMessage(ContentResolver resolver, 686 String address, String body, String subject, Long date) { 687 return addMessageToUri(SubscriptionManager.getDefaultSmsSubscriptionId(), 688 resolver, CONTENT_URI, address, body, subject, date, true, false); 689 } 690 691 /** 692 * Add an SMS to the Draft box. 693 * 694 * @param resolver the content resolver to use 695 * @param address the address of the sender 696 * @param body the body of the message 697 * @param subject the psuedo-subject of the message 698 * @param date the timestamp for the message 699 * @param subId the subscription which the message belongs to 700 * @return the URI for the new message 701 * @hide 702 */ 703 @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.R, trackingBug = 170729553) addMessage(int subId, ContentResolver resolver, String address, String body, String subject, Long date)704 public static Uri addMessage(int subId, ContentResolver resolver, 705 String address, String body, String subject, Long date) { 706 return addMessageToUri(subId, resolver, CONTENT_URI, address, body, 707 subject, date, true, false); 708 } 709 } 710 711 /** 712 * Contains all draft text-based SMS messages in the SMS app. 713 */ 714 public static final class Draft implements BaseColumns, TextBasedSmsColumns { 715 716 /** 717 * Not instantiable. 718 * @hide 719 */ Draft()720 private Draft() { 721 } 722 723 /** 724 * The {@code content://} style URL for this table. 725 */ 726 public static final Uri CONTENT_URI = Uri.parse("content://sms/draft"); 727 728 /** 729 * @hide 730 */ 731 @UnsupportedAppUsage addMessage(ContentResolver resolver, String address, String body, String subject, Long date)732 public static Uri addMessage(ContentResolver resolver, 733 String address, String body, String subject, Long date) { 734 return addMessageToUri(SubscriptionManager.getDefaultSmsSubscriptionId(), 735 resolver, CONTENT_URI, address, body, subject, date, true, false); 736 } 737 738 /** 739 * Add an SMS to the Draft box. 740 * 741 * @param resolver the content resolver to use 742 * @param address the address of the sender 743 * @param body the body of the message 744 * @param subject the psuedo-subject of the message 745 * @param date the timestamp for the message 746 * @param subId the subscription which the message belongs to 747 * @return the URI for the new message 748 * @hide 749 */ 750 @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.R, trackingBug = 170729553) addMessage(int subId, ContentResolver resolver, String address, String body, String subject, Long date)751 public static Uri addMessage(int subId, ContentResolver resolver, 752 String address, String body, String subject, Long date) { 753 return addMessageToUri(subId, resolver, CONTENT_URI, address, body, 754 subject, date, true, false); 755 } 756 757 /** 758 * The default sort order for this table. 759 */ 760 public static final String DEFAULT_SORT_ORDER = "date DESC"; 761 } 762 763 /** 764 * Contains all pending outgoing text-based SMS messages. 765 */ 766 public static final class Outbox implements BaseColumns, TextBasedSmsColumns { 767 768 /** 769 * Not instantiable. 770 * @hide 771 */ Outbox()772 private Outbox() { 773 } 774 775 /** 776 * The {@code content://} style URL for this table. 777 */ 778 public static final Uri CONTENT_URI = Uri.parse("content://sms/outbox"); 779 780 /** 781 * The default sort order for this table. 782 */ 783 public static final String DEFAULT_SORT_ORDER = "date DESC"; 784 785 /** 786 * Add an SMS to the outbox. 787 * 788 * @param resolver the content resolver to use 789 * @param address the address of the sender 790 * @param body the body of the message 791 * @param subject the pseudo-subject of the message 792 * @param date the timestamp for the message 793 * @param deliveryReport whether a delivery report was requested for the message 794 * @return the URI for the new message 795 * @hide 796 */ 797 @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.R, trackingBug = 170729553) addMessage(ContentResolver resolver, String address, String body, String subject, Long date, boolean deliveryReport, long threadId)798 public static Uri addMessage(ContentResolver resolver, 799 String address, String body, String subject, Long date, 800 boolean deliveryReport, long threadId) { 801 return addMessageToUri(SubscriptionManager.getDefaultSmsSubscriptionId(), 802 resolver, CONTENT_URI, address, body, subject, date, 803 true, deliveryReport, threadId); 804 } 805 806 /** 807 * Add an SMS to the Out box. 808 * 809 * @param resolver the content resolver to use 810 * @param address the address of the sender 811 * @param body the body of the message 812 * @param subject the psuedo-subject of the message 813 * @param date the timestamp for the message 814 * @param deliveryReport whether a delivery report was requested for the message 815 * @param subId the subscription which the message belongs to 816 * @return the URI for the new message 817 * @hide 818 */ addMessage(int subId, ContentResolver resolver, String address, String body, String subject, Long date, boolean deliveryReport, long threadId)819 public static Uri addMessage(int subId, ContentResolver resolver, 820 String address, String body, String subject, Long date, 821 boolean deliveryReport, long threadId) { 822 return addMessageToUri(subId, resolver, CONTENT_URI, address, body, 823 subject, date, true, deliveryReport, threadId); 824 } 825 } 826 827 /** 828 * Contains a view of SMS conversations (also referred to as threads). This is similar to 829 * {@link Threads}, but only includes SMS messages and columns relevant to SMS 830 * conversations. 831 * <p> 832 * Note that this view ignores any information about MMS messages, it is a 833 * view of conversations as if MMS messages did not exist at all. This means that all 834 * relevant information, such as snippets and message count, will ignore any MMS messages 835 * that might be in the same thread through other views and present only data based on the 836 * SMS messages in that thread. 837 */ 838 public static final class Conversations 839 implements BaseColumns, TextBasedSmsColumns { 840 841 /** 842 * Not instantiable. 843 * @hide 844 */ Conversations()845 private Conversations() { 846 } 847 848 /** 849 * The {@code content://} style URL for this table. 850 */ 851 public static final Uri CONTENT_URI = Uri.parse("content://sms/conversations"); 852 853 /** 854 * The default sort order for this table. 855 */ 856 public static final String DEFAULT_SORT_ORDER = "date DESC"; 857 858 /** 859 * The first 45 characters of the body of the most recent message. 860 * <P>Type: TEXT</P> 861 */ 862 public static final String SNIPPET = "snippet"; 863 864 /** 865 * The number of messages in the conversation. 866 * <P>Type: INTEGER</P> 867 */ 868 public static final String MESSAGE_COUNT = "msg_count"; 869 } 870 871 /** 872 * Contains constants for SMS related Intents that are broadcast. 873 */ 874 public static final class Intents { 875 876 /** 877 * Not instantiable. 878 * @hide 879 */ Intents()880 private Intents() { 881 } 882 883 /** 884 * Set by BroadcastReceiver to indicate that the message was handled 885 * successfully. 886 */ 887 public static final int RESULT_SMS_HANDLED = 1; 888 889 /** 890 * Set by BroadcastReceiver to indicate a generic error while 891 * processing the message. 892 */ 893 public static final int RESULT_SMS_GENERIC_ERROR = 2; 894 895 /** 896 * Set as a "result" extra in the {@link #SMS_REJECTED_ACTION} intent to indicate 897 * insufficient memory to store the message. 898 */ 899 public static final int RESULT_SMS_OUT_OF_MEMORY = 3; 900 901 /** 902 * Set as a "result" extra in the {@link #SMS_REJECTED_ACTION} intent to indicate that 903 * the message, while possibly valid, is of a format or encoding that is not supported. 904 */ 905 public static final int RESULT_SMS_UNSUPPORTED = 4; 906 907 /** 908 * Set as a "result" extra in the {@link #SMS_REJECTED_ACTION} intent to indicate a 909 * duplicate incoming message. 910 */ 911 public static final int RESULT_SMS_DUPLICATED = 5; 912 913 /** 914 * Set as a "result" extra in the {@link #SMS_REJECTED_ACTION} intent to indicate a 915 * dispatch failure. 916 */ 917 public static final int RESULT_SMS_DISPATCH_FAILURE = 6; 918 919 /** 920 * Set as a "result" extra in the {@link #SMS_REJECTED_ACTION} intent to indicate a null 921 * PDU was received. 922 */ 923 public static final int RESULT_SMS_NULL_PDU = 7; 924 925 /** 926 * Set as a "result" extra in the {@link #SMS_REJECTED_ACTION} intent to indicate a null 927 * message was encountered. 928 */ 929 public static final int RESULT_SMS_NULL_MESSAGE = 8; 930 931 /** 932 * Set as a "result" extra in the {@link #SMS_REJECTED_ACTION} intent to indicate an sms 933 * was received while the phone was in encrypted state. 934 * <p> 935 * This result code is only used on devices that use Full Disk Encryption. Support for 936 * Full Disk Encryption was entirely removed in API level 33, having been replaced by 937 * File Based Encryption. Devices that use File Based Encryption never reject incoming 938 * SMS messages due to the encryption state. 939 */ 940 public static final int RESULT_SMS_RECEIVED_WHILE_ENCRYPTED = 9; 941 942 /** 943 * Set as a "result" extra in the {@link #SMS_REJECTED_ACTION} intent to indicate a 944 * telephony database error. 945 */ 946 public static final int RESULT_SMS_DATABASE_ERROR = 10; 947 948 /** 949 * Set as a "result" extra in the {@link #SMS_REJECTED_ACTION} intent to indicate an 950 * invalid uri. 951 */ 952 public static final int RESULT_SMS_INVALID_URI = 11; 953 954 /** 955 * Activity action: Ask the user to change the default 956 * SMS application. This will show a dialog that asks the 957 * user whether they want to replace the current default 958 * SMS application with the one specified in 959 * {@link #EXTRA_PACKAGE_NAME}. 960 * <p> 961 * This is no longer supported since Q, please use 962 * {@link android.app.role.RoleManager#createRequestRoleIntent(String)} with 963 * {@link android.app.role.RoleManager#ROLE_SMS} instead. 964 */ 965 @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) 966 public static final String ACTION_CHANGE_DEFAULT = 967 "android.provider.Telephony.ACTION_CHANGE_DEFAULT"; 968 969 /** 970 * The PackageName string passed in as an 971 * extra for {@link #ACTION_CHANGE_DEFAULT} 972 * 973 * @see #ACTION_CHANGE_DEFAULT 974 * <p> 975 * This is no longer supported since Q, please use 976 * {@link android.app.role.RoleManager#createRequestRoleIntent(String)} with 977 * {@link android.app.role.RoleManager#ROLE_SMS} instead. 978 */ 979 public static final String EXTRA_PACKAGE_NAME = "package"; 980 981 /** 982 * Broadcast Action: A new text-based SMS message has been received 983 * by the device. This intent will only be delivered to the default 984 * sms app. That app is responsible for writing the message and notifying 985 * the user. The intent will have the following extra values:</p> 986 * 987 * <ul> 988 * <li><em>"pdus"</em> - An Object[] of byte[]s containing the PDUs 989 * that make up the message.</li> 990 * <li><em>"format"</em> - A String describing the format of the PDUs. It can 991 * be either "3gpp" or "3gpp2".</li> 992 * <li><em>"subscription"</em> - An optional long value of the subscription id which 993 * received the message.</li> 994 * <li><em>"slot"</em> - An optional int value of the SIM slot containing the 995 * subscription.</li> 996 * <li><em>"phone"</em> - An optional int value of the phone id associated with the 997 * subscription.</li> 998 * <li><em>"errorCode"</em> - An optional int error code associated with receiving 999 * the message.</li> 1000 * </ul> 1001 * 1002 * <p>The extra values can be extracted using 1003 * {@link #getMessagesFromIntent(Intent)}.</p> 1004 * 1005 * <p>If a BroadcastReceiver encounters an error while processing 1006 * this intent it should set the result code appropriately.</p> 1007 * 1008 * <p class="note"><strong>Note:</strong> 1009 * The broadcast receiver that filters for this intent must declare 1010 * {@link android.Manifest.permission#BROADCAST_SMS} as a required permission in 1011 * the <a href="{@docRoot}guide/topics/manifest/receiver-element.html">{@code 1012 * <receiver>}</a> tag. 1013 * 1014 * <p>Requires {@link android.Manifest.permission#RECEIVE_SMS} to receive.</p> 1015 */ 1016 @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION) 1017 public static final String SMS_DELIVER_ACTION = 1018 "android.provider.Telephony.SMS_DELIVER"; 1019 1020 /** 1021 * Broadcast Action: A new text-based SMS message has been received 1022 * by the device. This intent will be delivered to all registered 1023 * receivers as a notification. These apps are not expected to write the 1024 * message or notify the user. The intent will have the following extra 1025 * values:</p> 1026 * 1027 * <ul> 1028 * <li><em>"pdus"</em> - An Object[] of byte[]s containing the PDUs 1029 * that make up the message.</li> 1030 * </ul> 1031 * 1032 * <p>The extra values can be extracted using 1033 * {@link #getMessagesFromIntent(Intent)}.</p> 1034 * 1035 * <p>If a BroadcastReceiver encounters an error while processing 1036 * this intent it should set the result code appropriately.</p> 1037 * 1038 * <p>Requires {@link android.Manifest.permission#RECEIVE_SMS} to receive.</p> 1039 */ 1040 @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION) 1041 public static final String SMS_RECEIVED_ACTION = 1042 "android.provider.Telephony.SMS_RECEIVED"; 1043 1044 /** 1045 * Broadcast Action: A new data based SMS message has been received 1046 * by the device. This intent will be delivered to all registered 1047 * receivers as a notification. The intent will have the following extra 1048 * values:</p> 1049 * 1050 * <ul> 1051 * <li><em>"pdus"</em> - An Object[] of byte[]s containing the PDUs 1052 * that make up the message.</li> 1053 * </ul> 1054 * 1055 * <p>The extra values can be extracted using 1056 * {@link #getMessagesFromIntent(Intent)}.</p> 1057 * 1058 * <p>If a BroadcastReceiver encounters an error while processing 1059 * this intent it should set the result code appropriately.</p> 1060 * 1061 * <p>Requires {@link android.Manifest.permission#RECEIVE_SMS} to receive.</p> 1062 */ 1063 @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION) 1064 public static final String DATA_SMS_RECEIVED_ACTION = 1065 "android.intent.action.DATA_SMS_RECEIVED"; 1066 1067 /** 1068 * Broadcast Action: A new WAP PUSH message has been received by the 1069 * device. This intent will only be delivered to the default 1070 * sms app. That app is responsible for writing the message and notifying 1071 * the user. The intent will have the following extra values:</p> 1072 * 1073 * <ul> 1074 * <li><em>"transactionId"</em> - (Integer) The WAP transaction ID</li> 1075 * <li><em>"pduType"</em> - (Integer) The WAP PDU type</li> 1076 * <li><em>"header"</em> - (byte[]) The header of the message</li> 1077 * <li><em>"data"</em> - (byte[]) The data payload of the message</li> 1078 * <li><em>"contentTypeParameters" </em> 1079 * -(HashMap<String,String>) Any parameters associated with the content type 1080 * (decoded from the WSP Content-Type header)</li> 1081 * <li><em>"subscription"</em> - An optional long value of the subscription id which 1082 * received the message.</li> 1083 * <li><em>"slot"</em> - An optional int value of the SIM slot containing the 1084 * subscription.</li> 1085 * <li><em>"phone"</em> - An optional int value of the phone id associated with the 1086 * subscription.</li> 1087 * </ul> 1088 * 1089 * <p>If a BroadcastReceiver encounters an error while processing 1090 * this intent it should set the result code appropriately.</p> 1091 * 1092 * <p>The contentTypeParameters extra value is map of content parameters keyed by 1093 * their names.</p> 1094 * 1095 * <p>If any unassigned well-known parameters are encountered, the key of the map will 1096 * be 'unassigned/0x...', where '...' is the hex value of the unassigned parameter. If 1097 * a parameter has No-Value the value in the map will be null.</p> 1098 * 1099 * <p>Requires {@link android.Manifest.permission#RECEIVE_MMS} or 1100 * {@link android.Manifest.permission#RECEIVE_WAP_PUSH} (depending on WAP PUSH type) to 1101 * receive.</p> 1102 * 1103 * <p class="note"><strong>Note:</strong> 1104 * The broadcast receiver that filters for this intent must declare 1105 * {@link android.Manifest.permission#BROADCAST_WAP_PUSH} as a required permission in 1106 * the <a href="{@docRoot}guide/topics/manifest/receiver-element.html">{@code 1107 * <receiver>}</a> tag. 1108 */ 1109 @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION) 1110 public static final String WAP_PUSH_DELIVER_ACTION = 1111 "android.provider.Telephony.WAP_PUSH_DELIVER"; 1112 1113 /** 1114 * Broadcast Action: A new WAP PUSH message has been received by the 1115 * device. This intent will be delivered to all registered 1116 * receivers as a notification. These apps are not expected to write the 1117 * message or notify the user. The intent will have the following extra 1118 * values:</p> 1119 * 1120 * <ul> 1121 * <li><em>"transactionId"</em> - (Integer) The WAP transaction ID</li> 1122 * <li><em>"pduType"</em> - (Integer) The WAP PDU type</li> 1123 * <li><em>"header"</em> - (byte[]) The header of the message</li> 1124 * <li><em>"data"</em> - (byte[]) The data payload of the message</li> 1125 * <li><em>"contentTypeParameters"</em> 1126 * - (HashMap<String,String>) Any parameters associated with the content type 1127 * (decoded from the WSP Content-Type header)</li> 1128 * </ul> 1129 * 1130 * <p>If a BroadcastReceiver encounters an error while processing 1131 * this intent it should set the result code appropriately.</p> 1132 * 1133 * <p>The contentTypeParameters extra value is map of content parameters keyed by 1134 * their names.</p> 1135 * 1136 * <p>If any unassigned well-known parameters are encountered, the key of the map will 1137 * be 'unassigned/0x...', where '...' is the hex value of the unassigned parameter. If 1138 * a parameter has No-Value the value in the map will be null.</p> 1139 * 1140 * <p>Requires {@link android.Manifest.permission#RECEIVE_MMS} or 1141 * {@link android.Manifest.permission#RECEIVE_WAP_PUSH} (depending on WAP PUSH type) to 1142 * receive.</p> 1143 */ 1144 @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION) 1145 public static final String WAP_PUSH_RECEIVED_ACTION = 1146 "android.provider.Telephony.WAP_PUSH_RECEIVED"; 1147 1148 /** 1149 * Broadcast Action: A new Cell Broadcast message has been received 1150 * by the device. The intent will have the following extra 1151 * values:</p> 1152 * 1153 * <ul> 1154 * <li><em>"message"</em> - An SmsCbMessage object containing the broadcast message 1155 * data. This is not an emergency alert, so ETWS and CMAS data will be null.</li> 1156 * </ul> 1157 * 1158 * <p>The extra values can be extracted using 1159 * {@link #getMessagesFromIntent(Intent)}.</p> 1160 * 1161 * <p>If a BroadcastReceiver encounters an error while processing 1162 * this intent it should set the result code appropriately.</p> 1163 * 1164 * <p>Requires {@link android.Manifest.permission#RECEIVE_SMS} to receive.</p> 1165 */ 1166 @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION) 1167 public static final String SMS_CB_RECEIVED_ACTION = 1168 "android.provider.Telephony.SMS_CB_RECEIVED"; 1169 1170 /** 1171 * Action: A SMS based carrier provision intent. Used to identify default 1172 * carrier provisioning app on the device. 1173 * @hide 1174 */ 1175 @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION) 1176 @TestApi 1177 public static final String SMS_CARRIER_PROVISION_ACTION = 1178 "android.provider.Telephony.SMS_CARRIER_PROVISION"; 1179 1180 /** 1181 * Broadcast Action: A new Emergency Broadcast message has been received 1182 * by the device. The intent will have the following extra 1183 * values:</p> 1184 * 1185 * <ul> 1186 * <li><em>"message"</em> - An {@link android.telephony.SmsCbMessage} object 1187 * containing the broadcast message data, including ETWS or CMAS warning notification 1188 * info if present.</li> 1189 * </ul> 1190 * 1191 * <p>The extra values can be extracted using 1192 * {@link #getMessagesFromIntent(Intent)}.</p> 1193 * 1194 * <p>If a BroadcastReceiver encounters an error while processing 1195 * this intent it should set the result code appropriately.</p> 1196 * 1197 * <p>Requires {@link android.Manifest.permission#RECEIVE_EMERGENCY_BROADCAST} to 1198 * receive.</p> 1199 * @hide 1200 */ 1201 @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION) 1202 @SystemApi 1203 public static final String ACTION_SMS_EMERGENCY_CB_RECEIVED = 1204 "android.provider.action.SMS_EMERGENCY_CB_RECEIVED"; 1205 1206 /** 1207 * Broadcast Action: A new CDMA SMS has been received containing Service Category 1208 * Program Data (updates the list of enabled broadcast channels). The intent will 1209 * have the following extra values:</p> 1210 * 1211 * <ul> 1212 * <li><em>"operations"</em> - An array of CdmaSmsCbProgramData objects containing 1213 * the service category operations (add/delete/clear) to perform.</li> 1214 * </ul> 1215 * 1216 * <p>The extra values can be extracted using 1217 * {@link #getMessagesFromIntent(Intent)}.</p> 1218 * 1219 * <p>If a BroadcastReceiver encounters an error while processing 1220 * this intent it should set the result code appropriately.</p> 1221 * 1222 * <p>Requires {@link android.Manifest.permission#RECEIVE_SMS} to receive.</p> 1223 */ 1224 @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION) 1225 public static final String SMS_SERVICE_CATEGORY_PROGRAM_DATA_RECEIVED_ACTION = 1226 "android.provider.Telephony.SMS_SERVICE_CATEGORY_PROGRAM_DATA_RECEIVED"; 1227 1228 /** 1229 * Broadcast Action: The SIM storage for SMS messages is full. If 1230 * space is not freed, messages targeted for the SIM (class 2) may 1231 * not be saved. 1232 * 1233 * <p>Requires {@link android.Manifest.permission#RECEIVE_SMS} to receive.</p> 1234 */ 1235 @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION) 1236 public static final String SIM_FULL_ACTION = 1237 "android.provider.Telephony.SIM_FULL"; 1238 1239 /** 1240 * Broadcast Action: An incoming SMS has been rejected by the 1241 * telephony framework. This intent is sent in lieu of any 1242 * of the RECEIVED_ACTION intents. The intent will have the 1243 * following extra value:</p> 1244 * 1245 * <ul> 1246 * <li><em>"result"</em> - An int result code, e.g. {@link #RESULT_SMS_OUT_OF_MEMORY} 1247 * indicating the error returned to the network.</li> 1248 * </ul> 1249 * 1250 * <p>Requires {@link android.Manifest.permission#RECEIVE_SMS} to receive.</p> 1251 */ 1252 @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION) 1253 public static final String SMS_REJECTED_ACTION = 1254 "android.provider.Telephony.SMS_REJECTED"; 1255 1256 /** 1257 * Broadcast Action: An incoming MMS has been downloaded. The intent is sent to all 1258 * users, except for secondary users where SMS has been disabled and to managed 1259 * profiles. 1260 * @hide 1261 */ 1262 @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION) 1263 public static final String MMS_DOWNLOADED_ACTION = 1264 "android.provider.Telephony.MMS_DOWNLOADED"; 1265 1266 /** 1267 * Broadcast Action: A debug code has been entered in the dialer. This intent is 1268 * broadcast by the system and OEM telephony apps may need to receive these broadcasts. 1269 * These "secret codes" are used to activate developer menus by dialing certain codes. 1270 * And they are of the form {@code *#*#<code>#*#*}. The intent will have the data 1271 * URI: {@code android_secret_code://<code>}. It is possible that a manifest 1272 * receiver would be woken up even if it is not currently running. 1273 * 1274 * <p>Requires {@code android.Manifest.permission#CONTROL_INCALL_EXPERIENCE} to 1275 * send and receive.</p> 1276 * @deprecated it is no longer supported, use {@link 1277 * TelephonyManager#ACTION_SECRET_CODE} instead 1278 */ 1279 @Deprecated 1280 @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION) 1281 public static final String SECRET_CODE_ACTION = 1282 "android.provider.Telephony.SECRET_CODE"; 1283 1284 /** 1285 * Broadcast action: When the default SMS package changes, 1286 * the previous default SMS package and the new default SMS 1287 * package are sent this broadcast to notify them of the change. 1288 * A boolean is specified in {@link #EXTRA_IS_DEFAULT_SMS_APP} to 1289 * indicate whether the package is the new default SMS package. 1290 */ 1291 @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION) 1292 public static final String ACTION_DEFAULT_SMS_PACKAGE_CHANGED = 1293 "android.provider.action.DEFAULT_SMS_PACKAGE_CHANGED"; 1294 1295 /** 1296 * The IsDefaultSmsApp boolean passed as an 1297 * extra for {@link #ACTION_DEFAULT_SMS_PACKAGE_CHANGED} to indicate whether the 1298 * SMS app is becoming the default SMS app or is no longer the default. 1299 * 1300 * @see #ACTION_DEFAULT_SMS_PACKAGE_CHANGED 1301 */ 1302 public static final String EXTRA_IS_DEFAULT_SMS_APP = 1303 "android.provider.extra.IS_DEFAULT_SMS_APP"; 1304 1305 /** 1306 * Broadcast action: When a change is made to the SmsProvider or 1307 * MmsProvider by a process other than the default SMS application, 1308 * this intent is broadcast to the default SMS application so it can 1309 * re-sync or update the change. The uri that was used to call the provider 1310 * can be retrieved from the intent with getData(). The actual affected uris 1311 * (which would depend on the selection specified) are not included. 1312 */ 1313 @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION) 1314 public static final String ACTION_EXTERNAL_PROVIDER_CHANGE = 1315 "android.provider.action.EXTERNAL_PROVIDER_CHANGE"; 1316 1317 /** 1318 * Broadcast action: When SMS-MMS db is being created. If file-based encryption is 1319 * supported, this broadcast indicates creation of the db in credential-encrypted 1320 * storage. A boolean is specified in {@link #EXTRA_IS_INITIAL_CREATE} to indicate if 1321 * this is the initial create of the db. 1322 * 1323 * @see #EXTRA_IS_INITIAL_CREATE 1324 * 1325 * @hide 1326 */ 1327 @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION) 1328 public static final String ACTION_SMS_MMS_DB_CREATED = 1329 "android.provider.action.SMS_MMS_DB_CREATED"; 1330 1331 /** 1332 * Boolean flag passed as an extra with {@link #ACTION_SMS_MMS_DB_CREATED} to indicate 1333 * whether the DB creation is the initial creation on the device, that is it is after a 1334 * factory-data reset or a new device. Any subsequent creations of the DB (which 1335 * happens only in error scenarios) will have this flag set to false. 1336 * 1337 * @see #ACTION_SMS_MMS_DB_CREATED 1338 * 1339 * @hide 1340 */ 1341 public static final String EXTRA_IS_INITIAL_CREATE = 1342 "android.provider.extra.IS_INITIAL_CREATE"; 1343 1344 /** 1345 * Broadcast intent action indicating that the telephony provider SMS MMS database is 1346 * corrupted. A boolean is specified in {@link #EXTRA_IS_CORRUPTED} to indicate if the 1347 * database is corrupted. Requires the 1348 * {@link android.Manifest.permission#READ_PRIVILEGED_PHONE_STATE permission. 1349 * 1350 * @hide 1351 */ 1352 @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION) 1353 public static final String ACTION_SMS_MMS_DB_LOST = 1354 "android.provider.action.SMS_MMS_DB_LOST"; 1355 1356 /** 1357 * Boolean flag passed as an extra with {@link #ACTION_SMS_MMS_DB_LOST} to indicate 1358 * whether the DB got corrupted or not. 1359 * 1360 * @see #ACTION_SMS_MMS_DB_LOST 1361 * 1362 * @hide 1363 */ 1364 public static final String EXTRA_IS_CORRUPTED = 1365 "android.provider.extra.IS_CORRUPTED"; 1366 1367 /** 1368 * Read the PDUs out of an {@link #SMS_RECEIVED_ACTION} or a 1369 * {@link #DATA_SMS_RECEIVED_ACTION} intent. 1370 * 1371 * @param intent the intent to read from 1372 * @return an array of SmsMessages for the PDUs 1373 */ getMessagesFromIntent(Intent intent)1374 public static SmsMessage[] getMessagesFromIntent(Intent intent) { 1375 Object[] messages; 1376 try { 1377 messages = (Object[]) intent.getSerializableExtra("pdus"); 1378 } catch (ClassCastException e) { 1379 Rlog.e(TAG, "getMessagesFromIntent: " + e); 1380 return null; 1381 } 1382 1383 if (messages == null) { 1384 Rlog.e(TAG, "pdus does not exist in the intent"); 1385 return null; 1386 } 1387 1388 String format = intent.getStringExtra("format"); 1389 int subId = intent.getIntExtra(SubscriptionManager.EXTRA_SUBSCRIPTION_INDEX, 1390 SubscriptionManager.INVALID_SUBSCRIPTION_ID); 1391 if (subId != SubscriptionManager.INVALID_SUBSCRIPTION_ID) { 1392 Rlog.v(TAG, "getMessagesFromIntent with valid subId : " + subId); 1393 } else { 1394 Rlog.v(TAG, "getMessagesFromIntent"); 1395 } 1396 1397 int pduCount = messages.length; 1398 SmsMessage[] msgs = new SmsMessage[pduCount]; 1399 1400 for (int i = 0; i < pduCount; i++) { 1401 byte[] pdu = (byte[]) messages[i]; 1402 msgs[i] = SmsMessage.createFromPdu(pdu, format); 1403 } 1404 return msgs; 1405 } 1406 } 1407 } 1408 1409 /** 1410 * Base column for the table that contain Carrier Public key. 1411 * @hide 1412 */ 1413 public interface CarrierColumns extends BaseColumns { 1414 1415 /** 1416 * Mobile Country Code (MCC). 1417 * <P> Type: TEXT </P> 1418 */ 1419 public static final String MCC = "mcc"; 1420 1421 /** 1422 * Mobile Network Code (MNC). 1423 * <P> Type: TEXT </P> 1424 */ 1425 public static final String MNC = "mnc"; 1426 1427 /** 1428 * KeyType whether the key is being used for WLAN or ePDG. 1429 * <P> Type: INTEGER </P> 1430 */ 1431 public static final String KEY_TYPE = "key_type"; 1432 1433 /** 1434 * The carrier public key that is used for the IMSI encryption. 1435 * <P> Type: TEXT </P> 1436 */ 1437 public static final String PUBLIC_KEY = "public_key"; 1438 1439 /** 1440 * The key identifier Attribute value pair that helps a server locate 1441 * the private key to decrypt the permanent identity. 1442 * <P> Type: TEXT </P> 1443 */ 1444 public static final String KEY_IDENTIFIER = "key_identifier"; 1445 1446 /** 1447 * Date-Time in UTC when the key will expire. 1448 * <P> Type: INTEGER (long) </P> 1449 */ 1450 public static final String EXPIRATION_TIME = "expiration_time"; 1451 1452 /** 1453 * Timestamp when this table was last modified, in milliseconds since 1454 * January 1, 1970 00:00:00.0 UTC. 1455 * <P> Type: INTEGER (long) </P> 1456 */ 1457 public static final String LAST_MODIFIED = "last_modified"; 1458 1459 /** 1460 * Carrier ID of the operetor. 1461 * <P> Type: TEXT </P> 1462 */ 1463 public static final String CARRIER_ID = "carrier_id"; 1464 /** 1465 * The {@code content://} style URL for this table. 1466 */ 1467 @NonNull 1468 public static final Uri CONTENT_URI = Uri.parse("content://carrier_information/carrier"); 1469 } 1470 1471 /** 1472 * Base columns for tables that contain MMSs. 1473 */ 1474 public interface BaseMmsColumns extends BaseColumns { 1475 1476 /** Message box: all messages. */ 1477 public static final int MESSAGE_BOX_ALL = 0; 1478 /** Message box: inbox. */ 1479 public static final int MESSAGE_BOX_INBOX = 1; 1480 /** Message box: sent messages. */ 1481 public static final int MESSAGE_BOX_SENT = 2; 1482 /** Message box: drafts. */ 1483 public static final int MESSAGE_BOX_DRAFTS = 3; 1484 /** Message box: outbox. */ 1485 public static final int MESSAGE_BOX_OUTBOX = 4; 1486 /** Message box: failed. */ 1487 public static final int MESSAGE_BOX_FAILED = 5; 1488 1489 /** 1490 * The thread ID of the message. 1491 * <P>Type: INTEGER (long)</P> 1492 */ 1493 public static final String THREAD_ID = "thread_id"; 1494 1495 /** 1496 * The date the message was received. 1497 * <P>Type: INTEGER (long)</P> 1498 */ 1499 public static final String DATE = "date"; 1500 1501 /** 1502 * The date the message was sent. 1503 * <P>Type: INTEGER (long)</P> 1504 */ 1505 public static final String DATE_SENT = "date_sent"; 1506 1507 /** 1508 * The box which the message belongs to, e.g. {@link #MESSAGE_BOX_INBOX}. 1509 * <P>Type: INTEGER</P> 1510 */ 1511 public static final String MESSAGE_BOX = "msg_box"; 1512 1513 /** 1514 * Has the message been read? 1515 * <P>Type: INTEGER (boolean)</P> 1516 */ 1517 public static final String READ = "read"; 1518 1519 /** 1520 * Has the message been seen by the user? The "seen" flag determines 1521 * whether we need to show a new message notification. 1522 * <P>Type: INTEGER (boolean)</P> 1523 */ 1524 public static final String SEEN = "seen"; 1525 1526 /** 1527 * Does the message have only a text part (can also have a subject) with 1528 * no picture, slideshow, sound, etc. parts? 1529 * <P>Type: INTEGER (boolean)</P> 1530 */ 1531 public static final String TEXT_ONLY = "text_only"; 1532 1533 /** 1534 * The {@code Message-ID} of the message. 1535 * <P>Type: TEXT</P> 1536 */ 1537 public static final String MESSAGE_ID = "m_id"; 1538 1539 /** 1540 * The subject of the message, if present. 1541 * <P>Type: TEXT</P> 1542 */ 1543 public static final String SUBJECT = "sub"; 1544 1545 /** 1546 * The character set of the subject, if present. 1547 * <P>Type: INTEGER</P> 1548 */ 1549 public static final String SUBJECT_CHARSET = "sub_cs"; 1550 1551 /** 1552 * The {@code Content-Type} of the message. 1553 * <P>Type: TEXT</P> 1554 */ 1555 public static final String CONTENT_TYPE = "ct_t"; 1556 1557 /** 1558 * The {@code Content-Location} of the message. 1559 * <P>Type: TEXT</P> 1560 */ 1561 public static final String CONTENT_LOCATION = "ct_l"; 1562 1563 /** 1564 * The expiry time of the message. 1565 * <P>Type: INTEGER (long)</P> 1566 */ 1567 public static final String EXPIRY = "exp"; 1568 1569 /** 1570 * The class of the message. 1571 * <P>Type: TEXT</P> 1572 */ 1573 public static final String MESSAGE_CLASS = "m_cls"; 1574 1575 /** 1576 * The type of the message defined by MMS spec. 1577 * <P>Type: INTEGER</P> 1578 */ 1579 public static final String MESSAGE_TYPE = "m_type"; 1580 1581 /** 1582 * The version of the specification that this message conforms to. 1583 * <P>Type: INTEGER</P> 1584 */ 1585 public static final String MMS_VERSION = "v"; 1586 1587 /** 1588 * The size of the message. 1589 * <P>Type: INTEGER</P> 1590 */ 1591 public static final String MESSAGE_SIZE = "m_size"; 1592 1593 /** 1594 * The priority of the message. 1595 * <P>Type: INTEGER</P> 1596 */ 1597 public static final String PRIORITY = "pri"; 1598 1599 /** 1600 * The {@code read-report} of the message. 1601 * <P>Type: INTEGER (boolean)</P> 1602 */ 1603 public static final String READ_REPORT = "rr"; 1604 1605 /** 1606 * Is read report allowed? 1607 * <P>Type: INTEGER (boolean)</P> 1608 */ 1609 public static final String REPORT_ALLOWED = "rpt_a"; 1610 1611 /** 1612 * The {@code response-status} of the message. 1613 * <P>Type: INTEGER</P> 1614 */ 1615 public static final String RESPONSE_STATUS = "resp_st"; 1616 1617 /** 1618 * The {@code status} of the message. 1619 * <P>Type: INTEGER</P> 1620 */ 1621 public static final String STATUS = "st"; 1622 1623 /** 1624 * The {@code transaction-id} of the message. 1625 * <P>Type: TEXT</P> 1626 */ 1627 public static final String TRANSACTION_ID = "tr_id"; 1628 1629 /** 1630 * The {@code retrieve-status} of the message. 1631 * <P>Type: INTEGER</P> 1632 */ 1633 public static final String RETRIEVE_STATUS = "retr_st"; 1634 1635 /** 1636 * The {@code retrieve-text} of the message. 1637 * <P>Type: TEXT</P> 1638 */ 1639 public static final String RETRIEVE_TEXT = "retr_txt"; 1640 1641 /** 1642 * The character set of the retrieve-text. 1643 * <P>Type: INTEGER</P> 1644 */ 1645 public static final String RETRIEVE_TEXT_CHARSET = "retr_txt_cs"; 1646 1647 /** 1648 * The {@code read-status} of the message. 1649 * <P>Type: INTEGER</P> 1650 */ 1651 public static final String READ_STATUS = "read_status"; 1652 1653 /** 1654 * The {@code content-class} of the message. 1655 * <P>Type: INTEGER</P> 1656 */ 1657 public static final String CONTENT_CLASS = "ct_cls"; 1658 1659 /** 1660 * The {@code delivery-report} of the message. 1661 * <P>Type: INTEGER</P> 1662 */ 1663 public static final String DELIVERY_REPORT = "d_rpt"; 1664 1665 /** 1666 * The {@code delivery-time-token} of the message. 1667 * <P>Type: INTEGER</P> 1668 * @deprecated this column is no longer supported. 1669 * @hide 1670 */ 1671 @Deprecated 1672 public static final String DELIVERY_TIME_TOKEN = "d_tm_tok"; 1673 1674 /** 1675 * The {@code delivery-time} of the message. 1676 * <P>Type: INTEGER</P> 1677 */ 1678 public static final String DELIVERY_TIME = "d_tm"; 1679 1680 /** 1681 * The {@code response-text} of the message. 1682 * <P>Type: TEXT</P> 1683 */ 1684 public static final String RESPONSE_TEXT = "resp_txt"; 1685 1686 /** 1687 * The {@code sender-visibility} of the message. 1688 * <P>Type: TEXT</P> 1689 * @deprecated this column is no longer supported. 1690 * @hide 1691 */ 1692 @Deprecated 1693 public static final String SENDER_VISIBILITY = "s_vis"; 1694 1695 /** 1696 * The {@code reply-charging} of the message. 1697 * <P>Type: INTEGER</P> 1698 * @deprecated this column is no longer supported. 1699 * @hide 1700 */ 1701 @Deprecated 1702 public static final String REPLY_CHARGING = "r_chg"; 1703 1704 /** 1705 * The {@code reply-charging-deadline-token} of the message. 1706 * <P>Type: INTEGER</P> 1707 * @deprecated this column is no longer supported. 1708 * @hide 1709 */ 1710 @Deprecated 1711 public static final String REPLY_CHARGING_DEADLINE_TOKEN = "r_chg_dl_tok"; 1712 1713 /** 1714 * The {@code reply-charging-deadline} of the message. 1715 * <P>Type: INTEGER</P> 1716 * @deprecated this column is no longer supported. 1717 * @hide 1718 */ 1719 @Deprecated 1720 public static final String REPLY_CHARGING_DEADLINE = "r_chg_dl"; 1721 1722 /** 1723 * The {@code reply-charging-id} of the message. 1724 * <P>Type: TEXT</P> 1725 * @deprecated this column is no longer supported. 1726 * @hide 1727 */ 1728 @Deprecated 1729 public static final String REPLY_CHARGING_ID = "r_chg_id"; 1730 1731 /** 1732 * The {@code reply-charging-size} of the message. 1733 * <P>Type: INTEGER</P> 1734 * @deprecated this column is no longer supported. 1735 * @hide 1736 */ 1737 @Deprecated 1738 public static final String REPLY_CHARGING_SIZE = "r_chg_sz"; 1739 1740 /** 1741 * The {@code previously-sent-by} of the message. 1742 * <P>Type: TEXT</P> 1743 * @deprecated this column is no longer supported. 1744 * @hide 1745 */ 1746 @Deprecated 1747 public static final String PREVIOUSLY_SENT_BY = "p_s_by"; 1748 1749 /** 1750 * The {@code previously-sent-date} of the message. 1751 * <P>Type: INTEGER</P> 1752 * @deprecated this column is no longer supported. 1753 * @hide 1754 */ 1755 @Deprecated 1756 public static final String PREVIOUSLY_SENT_DATE = "p_s_d"; 1757 1758 /** 1759 * The {@code store} of the message. 1760 * <P>Type: TEXT</P> 1761 * @deprecated this column is no longer supported. 1762 * @hide 1763 */ 1764 @Deprecated 1765 public static final String STORE = "store"; 1766 1767 /** 1768 * The {@code mm-state} of the message. 1769 * <P>Type: INTEGER</P> 1770 * @deprecated this column is no longer supported. 1771 * @hide 1772 */ 1773 @Deprecated 1774 public static final String MM_STATE = "mm_st"; 1775 1776 /** 1777 * The {@code mm-flags-token} of the message. 1778 * <P>Type: INTEGER</P> 1779 * @deprecated this column is no longer supported. 1780 * @hide 1781 */ 1782 @Deprecated 1783 public static final String MM_FLAGS_TOKEN = "mm_flg_tok"; 1784 1785 /** 1786 * The {@code mm-flags} of the message. 1787 * <P>Type: TEXT</P> 1788 * @deprecated this column is no longer supported. 1789 * @hide 1790 */ 1791 @Deprecated 1792 public static final String MM_FLAGS = "mm_flg"; 1793 1794 /** 1795 * The {@code store-status} of the message. 1796 * <P>Type: TEXT</P> 1797 * @deprecated this column is no longer supported. 1798 * @hide 1799 */ 1800 @Deprecated 1801 public static final String STORE_STATUS = "store_st"; 1802 1803 /** 1804 * The {@code store-status-text} of the message. 1805 * <P>Type: TEXT</P> 1806 * @deprecated this column is no longer supported. 1807 * @hide 1808 */ 1809 @Deprecated 1810 public static final String STORE_STATUS_TEXT = "store_st_txt"; 1811 1812 /** 1813 * The {@code stored} of the message. 1814 * <P>Type: TEXT</P> 1815 * @deprecated this column is no longer supported. 1816 * @hide 1817 */ 1818 @Deprecated 1819 public static final String STORED = "stored"; 1820 1821 /** 1822 * The {@code totals} of the message. 1823 * <P>Type: TEXT</P> 1824 * @deprecated this column is no longer supported. 1825 * @hide 1826 */ 1827 @Deprecated 1828 public static final String TOTALS = "totals"; 1829 1830 /** 1831 * The {@code mbox-totals} of the message. 1832 * <P>Type: TEXT</P> 1833 * @deprecated this column is no longer supported. 1834 * @hide 1835 */ 1836 @Deprecated 1837 public static final String MBOX_TOTALS = "mb_t"; 1838 1839 /** 1840 * The {@code mbox-totals-token} of the message. 1841 * <P>Type: INTEGER</P> 1842 * @deprecated this column is no longer supported. 1843 * @hide 1844 */ 1845 @Deprecated 1846 public static final String MBOX_TOTALS_TOKEN = "mb_t_tok"; 1847 1848 /** 1849 * The {@code quotas} of the message. 1850 * <P>Type: TEXT</P> 1851 * @deprecated this column is no longer supported. 1852 * @hide 1853 */ 1854 @Deprecated 1855 public static final String QUOTAS = "qt"; 1856 1857 /** 1858 * The {@code mbox-quotas} of the message. 1859 * <P>Type: TEXT</P> 1860 * @deprecated this column is no longer supported. 1861 * @hide 1862 */ 1863 @Deprecated 1864 public static final String MBOX_QUOTAS = "mb_qt"; 1865 1866 /** 1867 * The {@code mbox-quotas-token} of the message. 1868 * <P>Type: INTEGER</P> 1869 * @deprecated this column is no longer supported. 1870 * @hide 1871 */ 1872 @Deprecated 1873 public static final String MBOX_QUOTAS_TOKEN = "mb_qt_tok"; 1874 1875 /** 1876 * The {@code message-count} of the message. 1877 * <P>Type: INTEGER</P> 1878 * @deprecated this column is no longer supported. 1879 * @hide 1880 */ 1881 @Deprecated 1882 public static final String MESSAGE_COUNT = "m_cnt"; 1883 1884 /** 1885 * The {@code start} of the message. 1886 * <P>Type: INTEGER</P> 1887 * @deprecated this column is no longer supported. 1888 * @hide 1889 */ 1890 @Deprecated 1891 public static final String START = "start"; 1892 1893 /** 1894 * The {@code distribution-indicator} of the message. 1895 * <P>Type: TEXT</P> 1896 * @deprecated this column is no longer supported. 1897 * @hide 1898 */ 1899 @Deprecated 1900 public static final String DISTRIBUTION_INDICATOR = "d_ind"; 1901 1902 /** 1903 * The {@code element-descriptor} of the message. 1904 * <P>Type: TEXT</P> 1905 * @deprecated this column is no longer supported. 1906 * @hide 1907 */ 1908 @Deprecated 1909 public static final String ELEMENT_DESCRIPTOR = "e_des"; 1910 1911 /** 1912 * The {@code limit} of the message. 1913 * <P>Type: INTEGER</P> 1914 * @deprecated this column is no longer supported. 1915 * @hide 1916 */ 1917 @Deprecated 1918 public static final String LIMIT = "limit"; 1919 1920 /** 1921 * The {@code recommended-retrieval-mode} of the message. 1922 * <P>Type: INTEGER</P> 1923 * @deprecated this column is no longer supported. 1924 * @hide 1925 */ 1926 @Deprecated 1927 public static final String RECOMMENDED_RETRIEVAL_MODE = "r_r_mod"; 1928 1929 /** 1930 * The {@code recommended-retrieval-mode-text} of the message. 1931 * <P>Type: TEXT</P> 1932 * @deprecated this column is no longer supported. 1933 * @hide 1934 */ 1935 @Deprecated 1936 public static final String RECOMMENDED_RETRIEVAL_MODE_TEXT = "r_r_mod_txt"; 1937 1938 /** 1939 * The {@code status-text} of the message. 1940 * <P>Type: TEXT</P> 1941 * @deprecated this column is no longer supported. 1942 * @hide 1943 */ 1944 @Deprecated 1945 public static final String STATUS_TEXT = "st_txt"; 1946 1947 /** 1948 * The {@code applic-id} of the message. 1949 * <P>Type: TEXT</P> 1950 * @deprecated this column is no longer supported. 1951 * @hide 1952 */ 1953 @Deprecated 1954 public static final String APPLIC_ID = "apl_id"; 1955 1956 /** 1957 * The {@code reply-applic-id} of the message. 1958 * <P>Type: TEXT</P> 1959 * @deprecated this column is no longer supported. 1960 * @hide 1961 */ 1962 @Deprecated 1963 public static final String REPLY_APPLIC_ID = "r_apl_id"; 1964 1965 /** 1966 * The {@code aux-applic-id} of the message. 1967 * <P>Type: TEXT</P> 1968 * @deprecated this column is no longer supported. 1969 * @hide 1970 */ 1971 @Deprecated 1972 public static final String AUX_APPLIC_ID = "aux_apl_id"; 1973 1974 /** 1975 * The {@code drm-content} of the message. 1976 * <P>Type: TEXT</P> 1977 * @deprecated this column is no longer supported. 1978 * @hide 1979 */ 1980 @Deprecated 1981 public static final String DRM_CONTENT = "drm_c"; 1982 1983 /** 1984 * The {@code adaptation-allowed} of the message. 1985 * <P>Type: TEXT</P> 1986 * @deprecated this column is no longer supported. 1987 * @hide 1988 */ 1989 @Deprecated 1990 public static final String ADAPTATION_ALLOWED = "adp_a"; 1991 1992 /** 1993 * The {@code replace-id} of the message. 1994 * <P>Type: TEXT</P> 1995 * @deprecated this column is no longer supported. 1996 * @hide 1997 */ 1998 @Deprecated 1999 public static final String REPLACE_ID = "repl_id"; 2000 2001 /** 2002 * The {@code cancel-id} of the message. 2003 * <P>Type: TEXT</P> 2004 * @deprecated this column is no longer supported. 2005 * @hide 2006 */ 2007 @Deprecated 2008 public static final String CANCEL_ID = "cl_id"; 2009 2010 /** 2011 * The {@code cancel-status} of the message. 2012 * <P>Type: INTEGER</P> 2013 * @deprecated this column is no longer supported. 2014 * @hide 2015 */ 2016 @Deprecated 2017 public static final String CANCEL_STATUS = "cl_st"; 2018 2019 /** 2020 * Is the message locked? 2021 * <P>Type: INTEGER (boolean)</P> 2022 */ 2023 public static final String LOCKED = "locked"; 2024 2025 /** 2026 * The subscription to which the message belongs to. Its value will be 2027 * < 0 if the sub id cannot be determined. 2028 * <p>Type: INTEGER (long)</p> 2029 */ 2030 public static final String SUBSCRIPTION_ID = "sub_id"; 2031 2032 /** 2033 * The identity of the sender of a sent message. It is 2034 * usually the package name of the app which sends the message. 2035 * <p class="note"><strong>Note:</strong> 2036 * This column is read-only. It is set by the provider and can not be changed by apps. 2037 * <p>Type: TEXT</p> 2038 */ 2039 public static final String CREATOR = "creator"; 2040 } 2041 2042 /** 2043 * Columns for the "canonical_addresses" table used by MMS and SMS. 2044 */ 2045 public interface CanonicalAddressesColumns extends BaseColumns { 2046 /** 2047 * An address used in MMS or SMS. Email addresses are 2048 * converted to lower case and are compared by string 2049 * equality. Other addresses are compared using 2050 * PHONE_NUMBERS_EQUAL. 2051 * <P>Type: TEXT</P> 2052 */ 2053 public static final String ADDRESS = "address"; 2054 2055 /** 2056 * The subscription to which the message belongs to. Its value will be less than 0 2057 * if the sub id cannot be determined. 2058 * <p>Type: INTEGER (long) </p> 2059 * @hide 2060 */ 2061 public static final String SUBSCRIPTION_ID = "sub_id"; 2062 } 2063 2064 /** 2065 * Columns for the "threads" table used by MMS and SMS. 2066 */ 2067 public interface ThreadsColumns extends BaseColumns { 2068 2069 /** 2070 * The date at which the thread was created. 2071 * <P>Type: INTEGER (long)</P> 2072 */ 2073 public static final String DATE = "date"; 2074 2075 /** 2076 * A string encoding of the recipient IDs of the recipients of 2077 * the message, in numerical order and separated by spaces. 2078 * <P>Type: TEXT</P> 2079 */ 2080 public static final String RECIPIENT_IDS = "recipient_ids"; 2081 2082 /** 2083 * The message count of the thread. 2084 * <P>Type: INTEGER</P> 2085 */ 2086 public static final String MESSAGE_COUNT = "message_count"; 2087 2088 /** 2089 * Indicates whether all messages of the thread have been read. 2090 * <P>Type: INTEGER</P> 2091 */ 2092 public static final String READ = "read"; 2093 2094 /** 2095 * The snippet of the latest message in the thread. 2096 * <P>Type: TEXT</P> 2097 */ 2098 public static final String SNIPPET = "snippet"; 2099 2100 /** 2101 * The charset of the snippet. 2102 * <P>Type: INTEGER</P> 2103 */ 2104 public static final String SNIPPET_CHARSET = "snippet_cs"; 2105 2106 /** 2107 * Type of the thread, either {@link Threads#COMMON_THREAD} or 2108 * {@link Threads#BROADCAST_THREAD}. 2109 * <P>Type: INTEGER</P> 2110 */ 2111 public static final String TYPE = "type"; 2112 2113 /** 2114 * Indicates whether there is a transmission error in the thread. 2115 * <P>Type: INTEGER</P> 2116 */ 2117 public static final String ERROR = "error"; 2118 2119 /** 2120 * Indicates whether this thread contains any attachments. 2121 * <P>Type: INTEGER</P> 2122 */ 2123 public static final String HAS_ATTACHMENT = "has_attachment"; 2124 2125 /** 2126 * If the thread is archived 2127 * <P>Type: INTEGER (boolean)</P> 2128 */ 2129 public static final String ARCHIVED = "archived"; 2130 2131 /** 2132 * The subscription to which the message belongs to. Its value will be less than 0 2133 * if the sub id cannot be determined. 2134 * <p>Type: INTEGER (long) </p> 2135 * @hide 2136 */ 2137 public static final String SUBSCRIPTION_ID = "sub_id"; 2138 } 2139 2140 /** 2141 * Helper functions for the "threads" table used by MMS and SMS. 2142 * 2143 * Thread IDs are determined by the participants in a conversation and can be used to match 2144 * both SMS and MMS messages. 2145 * 2146 * To avoid issues where applications might cache a thread ID, the thread ID of a deleted thread 2147 * must not be reused to point at a new thread. 2148 */ 2149 public static final class Threads implements ThreadsColumns { 2150 2151 @UnsupportedAppUsage 2152 private static final String[] ID_PROJECTION = { BaseColumns._ID }; 2153 2154 /** 2155 * Private {@code content://} style URL for this table. Used by 2156 * {@link #getOrCreateThreadId(android.content.Context, java.util.Set)}. 2157 */ 2158 @UnsupportedAppUsage 2159 private static final Uri THREAD_ID_CONTENT_URI = Uri.parse( 2160 "content://mms-sms/threadID"); 2161 2162 /** 2163 * The {@code content://} style URL for this table, by conversation. 2164 */ 2165 public static final Uri CONTENT_URI = Uri.withAppendedPath( 2166 MmsSms.CONTENT_URI, "conversations"); 2167 2168 /** 2169 * The {@code content://} style URL for this table, for obsolete threads. 2170 */ 2171 public static final Uri OBSOLETE_THREADS_URI = Uri.withAppendedPath( 2172 CONTENT_URI, "obsolete"); 2173 2174 /** Thread type: common thread. */ 2175 public static final int COMMON_THREAD = 0; 2176 2177 /** Thread type: broadcast thread. */ 2178 public static final int BROADCAST_THREAD = 1; 2179 2180 /** 2181 * Not instantiable. 2182 * @hide 2183 */ Threads()2184 private Threads() { 2185 } 2186 2187 /** 2188 * This is a single-recipient version of {@code getOrCreateThreadId}. 2189 * It's convenient for use with SMS messages. 2190 * @param context the context object to use. 2191 * @param recipient the recipient to send to. 2192 */ getOrCreateThreadId(Context context, String recipient)2193 public static long getOrCreateThreadId(Context context, String recipient) { 2194 Set<String> recipients = new HashSet<String>(); 2195 2196 recipients.add(recipient); 2197 return getOrCreateThreadId(context, recipients); 2198 } 2199 2200 /** 2201 * Given a set of recipients return its thread ID. 2202 * <p> 2203 * If a thread exists containing the provided participants, return its thread ID. Otherwise, 2204 * this will create a new thread containing the provided participants and return its ID. 2205 */ getOrCreateThreadId( Context context, Set<String> recipients)2206 public static long getOrCreateThreadId( 2207 Context context, Set<String> recipients) { 2208 Uri.Builder uriBuilder = THREAD_ID_CONTENT_URI.buildUpon(); 2209 2210 for (String recipient : recipients) { 2211 if (Mms.isEmailAddress(recipient)) { 2212 recipient = Mms.extractAddrSpec(recipient); 2213 } 2214 2215 uriBuilder.appendQueryParameter("recipient", recipient); 2216 } 2217 2218 Uri uri = uriBuilder.build(); 2219 //if (DEBUG) Rlog.v(TAG, "getOrCreateThreadId uri: " + uri); 2220 2221 Cursor cursor = SqliteWrapper.query(context, context.getContentResolver(), 2222 uri, ID_PROJECTION, null, null, null); 2223 if (cursor != null) { 2224 try { 2225 if (cursor.moveToFirst()) { 2226 return cursor.getLong(0); 2227 } else { 2228 Rlog.e(TAG, "getOrCreateThreadId returned no rows!"); 2229 } 2230 } finally { 2231 cursor.close(); 2232 } 2233 } 2234 2235 Rlog.e(TAG, "getOrCreateThreadId failed with " + recipients.size() + " recipients"); 2236 throw new IllegalArgumentException("Unable to find or allocate a thread ID."); 2237 } 2238 } 2239 2240 /** 2241 * Contains all MMS messages. 2242 */ 2243 public static final class Mms implements BaseMmsColumns { 2244 2245 /** 2246 * Not instantiable. 2247 * @hide 2248 */ Mms()2249 private Mms() { 2250 } 2251 2252 /** 2253 * The {@code content://} URI for this table. 2254 */ 2255 public static final Uri CONTENT_URI = Uri.parse("content://mms"); 2256 2257 /** 2258 * Content URI for getting MMS report requests. 2259 */ 2260 public static final Uri REPORT_REQUEST_URI = Uri.withAppendedPath( 2261 CONTENT_URI, "report-request"); 2262 2263 /** 2264 * Content URI for getting MMS report status. 2265 */ 2266 public static final Uri REPORT_STATUS_URI = Uri.withAppendedPath( 2267 CONTENT_URI, "report-status"); 2268 2269 /** 2270 * The default sort order for this table. 2271 */ 2272 public static final String DEFAULT_SORT_ORDER = "date DESC"; 2273 2274 /** 2275 * Regex pattern for names and email addresses. 2276 * <ul> 2277 * <li><em>mailbox</em> = {@code name-addr}</li> 2278 * <li><em>name-addr</em> = {@code [display-name] angle-addr}</li> 2279 * <li><em>angle-addr</em> = {@code [CFWS] "<" addr-spec ">" [CFWS]}</li> 2280 * </ul> 2281 * @hide 2282 */ 2283 @UnsupportedAppUsage 2284 public static final Pattern NAME_ADDR_EMAIL_PATTERN = 2285 Pattern.compile("\\s*(\"[^\"]*\"|[^<>\"]+)\\s*<([^<>]+)>\\s*"); 2286 2287 /** 2288 * Helper method to query this table. 2289 * @hide 2290 */ query( ContentResolver cr, String[] projection)2291 public static Cursor query( 2292 ContentResolver cr, String[] projection) { 2293 return cr.query(CONTENT_URI, projection, null, null, DEFAULT_SORT_ORDER); 2294 } 2295 2296 /** 2297 * Helper method to query this table. 2298 * @hide 2299 */ query( ContentResolver cr, String[] projection, String where, String orderBy)2300 public static Cursor query( 2301 ContentResolver cr, String[] projection, 2302 String where, String orderBy) { 2303 return cr.query(CONTENT_URI, projection, 2304 where, null, orderBy == null ? DEFAULT_SORT_ORDER : orderBy); 2305 } 2306 2307 /** 2308 * Helper method to extract email address from address string. 2309 * @hide 2310 */ 2311 @UnsupportedAppUsage extractAddrSpec(String address)2312 public static String extractAddrSpec(String address) { 2313 Matcher match = NAME_ADDR_EMAIL_PATTERN.matcher(address); 2314 2315 if (match.matches()) { 2316 return match.group(2); 2317 } 2318 return address; 2319 } 2320 2321 /** 2322 * Is the specified address an email address? 2323 * 2324 * @param address the input address to test 2325 * @return true if address is an email address; false otherwise. 2326 * @hide 2327 */ 2328 @UnsupportedAppUsage isEmailAddress(String address)2329 public static boolean isEmailAddress(String address) { 2330 if (TextUtils.isEmpty(address)) { 2331 return false; 2332 } 2333 2334 String s = extractAddrSpec(address); 2335 Matcher match = Patterns.EMAIL_ADDRESS.matcher(s); 2336 return match.matches(); 2337 } 2338 2339 /** 2340 * Is the specified number a phone number? 2341 * 2342 * @param number the input number to test 2343 * @return true if number is a phone number; false otherwise. 2344 * @hide 2345 */ 2346 @UnsupportedAppUsage isPhoneNumber(String number)2347 public static boolean isPhoneNumber(String number) { 2348 if (TextUtils.isEmpty(number)) { 2349 return false; 2350 } 2351 2352 Matcher match = Patterns.PHONE.matcher(number); 2353 return match.matches(); 2354 } 2355 2356 /** 2357 * Contains all MMS messages in the MMS app inbox. 2358 */ 2359 public static final class Inbox implements BaseMmsColumns { 2360 2361 /** 2362 * Not instantiable. 2363 * @hide 2364 */ Inbox()2365 private Inbox() { 2366 } 2367 2368 /** 2369 * The {@code content://} style URL for this table. 2370 */ 2371 public static final Uri 2372 CONTENT_URI = Uri.parse("content://mms/inbox"); 2373 2374 /** 2375 * The default sort order for this table. 2376 */ 2377 public static final String DEFAULT_SORT_ORDER = "date DESC"; 2378 } 2379 2380 /** 2381 * Contains all MMS messages in the MMS app sent folder. 2382 */ 2383 public static final class Sent implements BaseMmsColumns { 2384 2385 /** 2386 * Not instantiable. 2387 * @hide 2388 */ Sent()2389 private Sent() { 2390 } 2391 2392 /** 2393 * The {@code content://} style URL for this table. 2394 */ 2395 public static final Uri 2396 CONTENT_URI = Uri.parse("content://mms/sent"); 2397 2398 /** 2399 * The default sort order for this table. 2400 */ 2401 public static final String DEFAULT_SORT_ORDER = "date DESC"; 2402 } 2403 2404 /** 2405 * Contains all MMS messages in the MMS app drafts folder. 2406 */ 2407 public static final class Draft implements BaseMmsColumns { 2408 2409 /** 2410 * Not instantiable. 2411 * @hide 2412 */ Draft()2413 private Draft() { 2414 } 2415 2416 /** 2417 * The {@code content://} style URL for this table. 2418 */ 2419 public static final Uri 2420 CONTENT_URI = Uri.parse("content://mms/drafts"); 2421 2422 /** 2423 * The default sort order for this table. 2424 */ 2425 public static final String DEFAULT_SORT_ORDER = "date DESC"; 2426 } 2427 2428 /** 2429 * Contains all MMS messages in the MMS app outbox. 2430 */ 2431 public static final class Outbox implements BaseMmsColumns { 2432 2433 /** 2434 * Not instantiable. 2435 * @hide 2436 */ Outbox()2437 private Outbox() { 2438 } 2439 2440 /** 2441 * The {@code content://} style URL for this table. 2442 */ 2443 public static final Uri 2444 CONTENT_URI = Uri.parse("content://mms/outbox"); 2445 2446 /** 2447 * The default sort order for this table. 2448 */ 2449 public static final String DEFAULT_SORT_ORDER = "date DESC"; 2450 } 2451 2452 /** 2453 * Contains address information for an MMS message. 2454 */ 2455 public static final class Addr implements BaseColumns { 2456 2457 /** 2458 * Not instantiable. 2459 * @hide 2460 */ Addr()2461 private Addr() { 2462 } 2463 2464 /** 2465 * The ID of MM which this address entry belongs to. 2466 * <P>Type: INTEGER (long)</P> 2467 */ 2468 public static final String MSG_ID = "msg_id"; 2469 2470 /** 2471 * The ID of contact entry in Phone Book. 2472 * <P>Type: INTEGER (long)</P> 2473 */ 2474 public static final String CONTACT_ID = "contact_id"; 2475 2476 /** 2477 * The address text. 2478 * <P>Type: TEXT</P> 2479 */ 2480 public static final String ADDRESS = "address"; 2481 2482 /** 2483 * Type of address: must be one of {@code PduHeaders.BCC}, 2484 * {@code PduHeaders.CC}, {@code PduHeaders.FROM}, {@code PduHeaders.TO}. 2485 * <P>Type: INTEGER</P> 2486 */ 2487 public static final String TYPE = "type"; 2488 2489 /** 2490 * Character set of this entry (MMS charset value). 2491 * <P>Type: INTEGER</P> 2492 */ 2493 public static final String CHARSET = "charset"; 2494 2495 /** 2496 * The subscription to which the message belongs to. Its value will be less than 0 2497 * if the sub id cannot be determined. 2498 * <p>Type: INTEGER (long) </p> 2499 * @hide 2500 */ 2501 public static final String SUBSCRIPTION_ID = "sub_id"; 2502 2503 /** 2504 * Generates a Addr {@link Uri} for message, used to perform Addr table operation 2505 * for mms. 2506 * 2507 * @param messageId the messageId used to generate Addr {@link Uri} dynamically 2508 * @return the addrUri used to perform Addr table operation for mms 2509 */ 2510 @NonNull getAddrUriForMessage(@onNull String messageId)2511 public static Uri getAddrUriForMessage(@NonNull String messageId) { 2512 Uri addrUri = Mms.CONTENT_URI.buildUpon() 2513 .appendPath(String.valueOf(messageId)).appendPath("addr").build(); 2514 return addrUri; 2515 } 2516 } 2517 2518 /** 2519 * Contains message parts. 2520 * 2521 * To avoid issues where applications might cache a part ID, the ID of a deleted part must 2522 * not be reused to point at a new part. 2523 */ 2524 public static final class Part implements BaseColumns { 2525 2526 /** 2527 * Not instantiable. 2528 * @hide 2529 */ Part()2530 private Part() { 2531 } 2532 2533 /** 2534 * The name of part table. 2535 */ 2536 private static final String TABLE_PART = "part"; 2537 2538 /** 2539 * The {@code content://} style URL for this table. Can be appended with a part ID to 2540 * address individual parts. 2541 */ 2542 @NonNull 2543 public static final Uri CONTENT_URI = Uri.withAppendedPath(Mms.CONTENT_URI, TABLE_PART); 2544 2545 /** 2546 * The identifier of the message which this part belongs to. 2547 * <P>Type: INTEGER</P> 2548 */ 2549 public static final String MSG_ID = "mid"; 2550 2551 /** 2552 * The order of the part. 2553 * <P>Type: INTEGER</P> 2554 */ 2555 public static final String SEQ = "seq"; 2556 2557 /** 2558 * The content type of the part. 2559 * <P>Type: TEXT</P> 2560 */ 2561 public static final String CONTENT_TYPE = "ct"; 2562 2563 /** 2564 * The name of the part. 2565 * <P>Type: TEXT</P> 2566 */ 2567 public static final String NAME = "name"; 2568 2569 /** 2570 * The charset of the part. 2571 * <P>Type: TEXT</P> 2572 */ 2573 public static final String CHARSET = "chset"; 2574 2575 /** 2576 * The file name of the part. 2577 * <P>Type: TEXT</P> 2578 */ 2579 public static final String FILENAME = "fn"; 2580 2581 /** 2582 * The content disposition of the part. 2583 * <P>Type: TEXT</P> 2584 */ 2585 public static final String CONTENT_DISPOSITION = "cd"; 2586 2587 /** 2588 * The content ID of the part. 2589 * <P>Type: INTEGER</P> 2590 */ 2591 public static final String CONTENT_ID = "cid"; 2592 2593 /** 2594 * The content location of the part. 2595 * <P>Type: INTEGER</P> 2596 */ 2597 public static final String CONTENT_LOCATION = "cl"; 2598 2599 /** 2600 * The start of content-type of the message. 2601 * <P>Type: INTEGER</P> 2602 */ 2603 public static final String CT_START = "ctt_s"; 2604 2605 /** 2606 * The type of content-type of the message. 2607 * <P>Type: TEXT</P> 2608 */ 2609 public static final String CT_TYPE = "ctt_t"; 2610 2611 /** 2612 * The location (on filesystem) of the binary data of the part. 2613 * <P>Type: INTEGER</P> 2614 */ 2615 public static final String _DATA = "_data"; 2616 2617 /** 2618 * The message text. 2619 * <P>Type: TEXT</P> 2620 */ 2621 public static final String TEXT = "text"; 2622 2623 /** 2624 * The subscription to which the message belongs to. Its value will be less than 0 2625 * if the sub id cannot be determined. 2626 * <p>Type: INTEGER (long) </p> 2627 * @hide 2628 */ 2629 public static final String SUBSCRIPTION_ID = "sub_id"; 2630 2631 /** 2632 * Generates a Part {@link Uri} for message, used to perform Part table operation 2633 * for mms. 2634 * 2635 * @param messageId the messageId used to generate Part {@link Uri} dynamically 2636 * @return the partUri used to perform Part table operation for mms 2637 */ 2638 @NonNull getPartUriForMessage(@onNull String messageId)2639 public static Uri getPartUriForMessage(@NonNull String messageId) { 2640 Uri partUri = Mms.CONTENT_URI.buildUpon() 2641 .appendPath(String.valueOf(messageId)).appendPath( 2642 TABLE_PART).build(); 2643 return partUri; 2644 } 2645 } 2646 2647 /** 2648 * Message send rate table. 2649 */ 2650 public static final class Rate { 2651 2652 /** 2653 * Not instantiable. 2654 * @hide 2655 */ Rate()2656 private Rate() { 2657 } 2658 2659 /** 2660 * The {@code content://} style URL for this table. 2661 */ 2662 public static final Uri CONTENT_URI = Uri.withAppendedPath( 2663 Mms.CONTENT_URI, "rate"); 2664 2665 /** 2666 * When a message was successfully sent. 2667 * <P>Type: INTEGER (long)</P> 2668 */ 2669 public static final String SENT_TIME = "sent_time"; 2670 2671 /** 2672 * The subscription to which the message belongs to. Its value will be less than 0 2673 * if the sub id cannot be determined. 2674 * <p>Type: INTEGER (long) </p> 2675 * @hide 2676 */ 2677 public static final String SUBSCRIPTION_ID = "sub_id"; 2678 } 2679 2680 /** 2681 * Intents class. 2682 */ 2683 public static final class Intents { 2684 2685 /** 2686 * Not instantiable. 2687 * @hide 2688 */ Intents()2689 private Intents() { 2690 } 2691 2692 /** 2693 * Indicates that the contents of specified URIs were changed. 2694 * The application which is showing or caching these contents 2695 * should be updated. 2696 */ 2697 @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION) 2698 public static final String CONTENT_CHANGED_ACTION 2699 = "android.intent.action.CONTENT_CHANGED"; 2700 2701 /** 2702 * An extra field which stores the URI of deleted contents. 2703 */ 2704 public static final String DELETED_CONTENTS = "deleted_contents"; 2705 } 2706 } 2707 2708 /** 2709 * Contains all MMS and SMS messages. 2710 */ 2711 public static final class MmsSms implements BaseColumns { 2712 2713 /** 2714 * Not instantiable. 2715 * @hide 2716 */ MmsSms()2717 private MmsSms() { 2718 } 2719 2720 /** 2721 * The column to distinguish SMS and MMS messages in query results. 2722 */ 2723 public static final String TYPE_DISCRIMINATOR_COLUMN = 2724 "transport_type"; 2725 2726 /** 2727 * The {@code content://} style URL for this table. 2728 */ 2729 public static final Uri CONTENT_URI = Uri.parse("content://mms-sms/"); 2730 2731 /** 2732 * The {@code content://} style URL for this table, by conversation. 2733 */ 2734 public static final Uri CONTENT_CONVERSATIONS_URI = Uri.parse( 2735 "content://mms-sms/conversations"); 2736 2737 /** 2738 * The {@code content://} style URL for this table, by phone number. 2739 */ 2740 public static final Uri CONTENT_FILTER_BYPHONE_URI = Uri.parse( 2741 "content://mms-sms/messages/byphone"); 2742 2743 /** 2744 * The {@code content://} style URL for undelivered messages in this table. 2745 */ 2746 public static final Uri CONTENT_UNDELIVERED_URI = Uri.parse( 2747 "content://mms-sms/undelivered"); 2748 2749 /** 2750 * The {@code content://} style URL for draft messages in this table. 2751 */ 2752 public static final Uri CONTENT_DRAFT_URI = Uri.parse( 2753 "content://mms-sms/draft"); 2754 2755 /** 2756 * The {@code content://} style URL for locked messages in this table. 2757 * <P>This {@link Uri} is used to check at most one locked message found in the union of MMS 2758 * and SMS messages. Also this will return only _id column in response.</P> 2759 */ 2760 public static final Uri CONTENT_LOCKED_URI = Uri.parse( 2761 "content://mms-sms/locked"); 2762 2763 /** 2764 * Pass in a query parameter called "pattern" which is the text to search for. 2765 * The sort order is fixed to be: {@code thread_id ASC, date DESC}. 2766 */ 2767 public static final Uri SEARCH_URI = Uri.parse( 2768 "content://mms-sms/search"); 2769 2770 // Constants for message protocol types. 2771 2772 /** SMS protocol type. */ 2773 public static final int SMS_PROTO = 0; 2774 2775 /** MMS protocol type. */ 2776 public static final int MMS_PROTO = 1; 2777 2778 // Constants for error types of pending messages. 2779 2780 /** Error type: no error. */ 2781 public static final int NO_ERROR = 0; 2782 2783 /** Error type: generic transient error. */ 2784 public static final int ERR_TYPE_GENERIC = 1; 2785 2786 /** Error type: SMS protocol transient error. */ 2787 public static final int ERR_TYPE_SMS_PROTO_TRANSIENT = 2; 2788 2789 /** Error type: MMS protocol transient error. */ 2790 public static final int ERR_TYPE_MMS_PROTO_TRANSIENT = 3; 2791 2792 /** Error type: transport failure. */ 2793 public static final int ERR_TYPE_TRANSPORT_FAILURE = 4; 2794 2795 /** Error type: permanent error (along with all higher error values). */ 2796 public static final int ERR_TYPE_GENERIC_PERMANENT = 10; 2797 2798 /** Error type: SMS protocol permanent error. */ 2799 public static final int ERR_TYPE_SMS_PROTO_PERMANENT = 11; 2800 2801 /** Error type: MMS protocol permanent error. */ 2802 public static final int ERR_TYPE_MMS_PROTO_PERMANENT = 12; 2803 2804 /** 2805 * Contains pending messages info. 2806 */ 2807 public static final class PendingMessages implements BaseColumns { 2808 2809 /** 2810 * Not instantiable. 2811 * @hide 2812 */ PendingMessages()2813 private PendingMessages() { 2814 } 2815 2816 public static final Uri CONTENT_URI = Uri.withAppendedPath( 2817 MmsSms.CONTENT_URI, "pending"); 2818 2819 /** 2820 * The type of transport protocol (MMS or SMS). 2821 * <P>Type: INTEGER</P> 2822 */ 2823 public static final String PROTO_TYPE = "proto_type"; 2824 2825 /** 2826 * The ID of the message to be sent or downloaded. 2827 * <P>Type: INTEGER (long)</P> 2828 */ 2829 public static final String MSG_ID = "msg_id"; 2830 2831 /** 2832 * The type of the message to be sent or downloaded. 2833 * This field is only valid for MM. For SM, its value is always set to 0. 2834 * <P>Type: INTEGER</P> 2835 */ 2836 public static final String MSG_TYPE = "msg_type"; 2837 2838 /** 2839 * The type of the error code. 2840 * <P>Type: INTEGER</P> 2841 */ 2842 public static final String ERROR_TYPE = "err_type"; 2843 2844 /** 2845 * The error code of sending/retrieving process. 2846 * <P>Type: INTEGER</P> 2847 */ 2848 public static final String ERROR_CODE = "err_code"; 2849 2850 /** 2851 * How many times we tried to send or download the message. 2852 * <P>Type: INTEGER</P> 2853 */ 2854 public static final String RETRY_INDEX = "retry_index"; 2855 2856 /** 2857 * The time to do next retry. 2858 * <P>Type: INTEGER (long)</P> 2859 */ 2860 public static final String DUE_TIME = "due_time"; 2861 2862 /** 2863 * The time we last tried to send or download the message. 2864 * <P>Type: INTEGER (long)</P> 2865 */ 2866 public static final String LAST_TRY = "last_try"; 2867 2868 /** 2869 * The subscription to which the message belongs to. Its value will be 2870 * < 0 if the sub id cannot be determined. 2871 * <p>Type: INTEGER (long) </p> 2872 */ 2873 public static final String SUBSCRIPTION_ID = "pending_sub_id"; 2874 } 2875 2876 /** 2877 * Words table used by provider for full-text searches. 2878 * @hide 2879 */ 2880 public static final class WordsTable { 2881 2882 /** 2883 * Not instantiable. 2884 * @hide 2885 */ WordsTable()2886 private WordsTable() {} 2887 2888 /** 2889 * Primary key. 2890 * <P>Type: INTEGER (long)</P> 2891 */ 2892 public static final String ID = "_id"; 2893 2894 /** 2895 * Source row ID. 2896 * <P>Type: INTEGER (long)</P> 2897 */ 2898 public static final String SOURCE_ROW_ID = "source_id"; 2899 2900 /** 2901 * Table ID (either 1 or 2). 2902 * <P>Type: INTEGER</P> 2903 */ 2904 public static final String TABLE_ID = "table_to_use"; 2905 2906 /** 2907 * The words to index. 2908 * <P>Type: TEXT</P> 2909 */ 2910 public static final String INDEXED_TEXT = "index_text"; 2911 2912 /** 2913 * The subscription to which the message belongs to. Its value will be less than 0 2914 * if the sub id cannot be determined. 2915 * <p>Type: INTEGER (long) </p> 2916 * @hide 2917 */ 2918 public static final String SUBSCRIPTION_ID = "sub_id"; 2919 } 2920 } 2921 2922 /** 2923 * Carriers class contains information about APNs, including MMSC information. 2924 */ 2925 public static final class Carriers implements BaseColumns { 2926 2927 /** 2928 * Not instantiable. 2929 * @hide 2930 */ Carriers()2931 private Carriers() {} 2932 2933 /** 2934 * The {@code content://} style URL for this table. 2935 * For MSIM, this will return APNs for the default subscription 2936 * {@link SubscriptionManager#getDefaultSubscriptionId()}. To specify subId for MSIM, 2937 * use {@link Uri#withAppendedPath(Uri, String)} to append with subscription id. 2938 */ 2939 @NonNull 2940 public static final Uri CONTENT_URI = Uri.parse("content://telephony/carriers"); 2941 2942 /** 2943 * The {@code content://} style URL for this table. Used for APN query based on current 2944 * subscription. Instead of specifying carrier matching information in the selection, 2945 * this API will return all matching APNs from current subscription carrier and queries 2946 * will be applied on top of that. If there is no match for MVNO (Mobile Virtual Network 2947 * Operator) APNs, return APNs from its MNO (based on mccmnc) instead. For MSIM, this will 2948 * return APNs for the default subscription 2949 * {@link SubscriptionManager#getDefaultSubscriptionId()}. To specify subId for MSIM, 2950 * use {@link Uri#withAppendedPath(Uri, String)} to append with subscription id. 2951 */ 2952 @NonNull 2953 public static final Uri SIM_APN_URI = Uri.parse( 2954 "content://telephony/carriers/sim_apn_list"); 2955 2956 /** 2957 * The {@code content://} style URL to be called from DevicePolicyManagerService, 2958 * can manage DPC-owned APNs. 2959 * @hide 2960 */ 2961 public static final @NonNull Uri DPC_URI = Uri.parse("content://telephony/carriers/dpc"); 2962 2963 /** 2964 * The {@code content://} style URL to be called from Telephony to query APNs. 2965 * When DPC-owned APNs are enforced, only DPC-owned APNs are returned, otherwise only 2966 * non-DPC-owned APNs are returned. For MSIM, this will return APNs for the default 2967 * subscription {@link SubscriptionManager#getDefaultSubscriptionId()}. To specify subId 2968 * for MSIM, use {@link Uri#withAppendedPath(Uri, String)} to append with subscription id. 2969 * @hide 2970 */ 2971 public static final Uri FILTERED_URI = Uri.parse("content://telephony/carriers/filtered"); 2972 2973 /** 2974 * The {@code content://} style URL to be called from DevicePolicyManagerService 2975 * or Telephony to manage whether DPC-owned APNs are enforced. 2976 * @hide 2977 */ 2978 public static final Uri ENFORCE_MANAGED_URI = Uri.parse( 2979 "content://telephony/carriers/enforce_managed"); 2980 2981 /** 2982 * The {@code content://} style URL for the perferred APN used for internet. 2983 * 2984 * @hide 2985 */ 2986 public static final Uri PREFERRED_APN_URI = Uri.parse( 2987 "content://telephony/carriers/preferapn/subId"); 2988 2989 /** 2990 * The {@code content://} style URL for the perferred APN set id. 2991 * 2992 * @hide 2993 */ 2994 public static final Uri PREFERRED_APN_SET_URI = Uri.parse( 2995 "content://telephony/carriers/preferapnset/subId"); 2996 2997 /** 2998 * The id of preferred APN. 2999 * 3000 * @see #PREFERRED_APN_URI 3001 * @hide 3002 */ 3003 public static final String APN_ID = "apn_id"; 3004 3005 /** 3006 * The column name for ENFORCE_MANAGED_URI, indicates whether DPC-owned APNs are enforced. 3007 * @hide 3008 */ 3009 public static final String ENFORCE_KEY = "enforced"; 3010 3011 /** 3012 * The default sort order for this table. 3013 */ 3014 public static final String DEFAULT_SORT_ORDER = "name ASC"; 3015 3016 /** 3017 * Entry name. 3018 * <P>Type: TEXT</P> 3019 */ 3020 public static final String NAME = "name"; 3021 3022 /** 3023 * APN name. 3024 * <P>Type: TEXT</P> 3025 */ 3026 public static final String APN = "apn"; 3027 3028 /** 3029 * Proxy address. 3030 * <P>Type: TEXT</P> 3031 */ 3032 public static final String PROXY = "proxy"; 3033 3034 /** 3035 * Proxy port. 3036 * <P>Type: TEXT</P> 3037 */ 3038 public static final String PORT = "port"; 3039 3040 /** 3041 * MMS proxy address. 3042 * <P>Type: TEXT</P> 3043 */ 3044 public static final String MMSPROXY = "mmsproxy"; 3045 3046 /** 3047 * MMS proxy port. 3048 * <P>Type: TEXT</P> 3049 */ 3050 public static final String MMSPORT = "mmsport"; 3051 3052 /** 3053 * Server address. 3054 * <P>Type: TEXT</P> 3055 */ 3056 public static final String SERVER = "server"; 3057 3058 /** 3059 * APN username. 3060 * <P>Type: TEXT</P> 3061 */ 3062 public static final String USER = "user"; 3063 3064 /** 3065 * APN password. 3066 * <P>Type: TEXT</P> 3067 */ 3068 public static final String PASSWORD = "password"; 3069 3070 /** 3071 * MMSC URL. 3072 * <P>Type: TEXT</P> 3073 */ 3074 public static final String MMSC = "mmsc"; 3075 3076 /** 3077 * Mobile Country Code (MCC). 3078 * <P>Type: TEXT</P> 3079 * @deprecated Use {@link #SIM_APN_URI} to query APN instead, this API will return 3080 * matching APNs based on current subscription carrier, thus no need to specify MCC and 3081 * other carrier matching information. In the future, Android will not support MCC for 3082 * APN query. 3083 */ 3084 public static final String MCC = "mcc"; 3085 3086 /** 3087 * Mobile Network Code (MNC). 3088 * <P>Type: TEXT</P> 3089 * @deprecated Use {@link #SIM_APN_URI} to query APN instead, this API will return 3090 * matching APNs based on current subscription carrier, thus no need to specify MNC and 3091 * other carrier matching information. In the future, Android will not support MNC for 3092 * APN query. 3093 */ 3094 public static final String MNC = "mnc"; 3095 3096 /** 3097 * Numeric operator ID (as String). Usually {@code MCC + MNC}. 3098 * <P>Type: TEXT</P> 3099 * @deprecated Use {@link #SIM_APN_URI} to query APN instead, this API will return 3100 * matching APNs based on current subscription carrier, thus no need to specify Numeric 3101 * and other carrier matching information. In the future, Android will not support Numeric 3102 * for APN query. 3103 */ 3104 public static final String NUMERIC = "numeric"; 3105 3106 /** 3107 * Authentication type. 3108 * <P>Type: INTEGER</P> 3109 */ 3110 public static final String AUTH_TYPE = "authtype"; 3111 3112 /** 3113 * Comma-delimited list of APN types. 3114 * <P>Type: TEXT</P> 3115 */ 3116 public static final String TYPE = "type"; 3117 3118 /** 3119 * The protocol to use to connect to this APN. 3120 * 3121 * One of the {@code PDP_type} values in TS 27.007 section 10.1.1. 3122 * For example: {@code IP}, {@code IPV6}, {@code IPV4V6}, or {@code PPP}. 3123 * <P>Type: TEXT</P> 3124 */ 3125 public static final String PROTOCOL = "protocol"; 3126 3127 /** 3128 * The protocol to use to connect to this APN when roaming. 3129 * The syntax is the same as protocol. 3130 * <P>Type: TEXT</P> 3131 */ 3132 public static final String ROAMING_PROTOCOL = "roaming_protocol"; 3133 3134 /** 3135 * Is this the current APN? 3136 * <P>Type: INTEGER (boolean)</P> 3137 */ 3138 public static final String CURRENT = "current"; 3139 3140 /** 3141 * Is this APN enabled? 3142 * <P>Type: INTEGER (boolean)</P> 3143 */ 3144 public static final String CARRIER_ENABLED = "carrier_enabled"; 3145 3146 /** 3147 * Radio Access Technology info. 3148 * To check what values are allowed, refer to {@link android.telephony.ServiceState}. 3149 * This should be spread to other technologies, 3150 * but is currently only used for LTE (14) and eHRPD (13). 3151 * <P>Type: INTEGER</P> 3152 * @deprecated this column is no longer supported, use {@link #NETWORK_TYPE_BITMASK} instead 3153 */ 3154 @Deprecated 3155 public static final String BEARER = "bearer"; 3156 3157 /** 3158 * Radio Access Technology bitmask. 3159 * To check what values can be contained, refer to {@link android.telephony.ServiceState}. 3160 * 0 indicates all techs otherwise first bit refers to RAT/bearer 1, second bit refers to 3161 * RAT/bearer 2 and so on. 3162 * Bitmask for a radio tech R is (1 << (R - 1)) 3163 * <P>Type: INTEGER</P> 3164 * @hide 3165 * @deprecated this column is no longer supported, use {@link #NETWORK_TYPE_BITMASK} instead 3166 */ 3167 @Deprecated 3168 public static final String BEARER_BITMASK = "bearer_bitmask"; 3169 3170 /** 3171 * Radio technology (network type) bitmask. 3172 * To check what values can be contained, refer to the NETWORK_TYPE_ constants in 3173 * {@link android.telephony.TelephonyManager}. 3174 * Bitmask for a radio tech R is (1 << (R - 1)) 3175 * <P>Type: INTEGER</P> 3176 */ 3177 public static final String NETWORK_TYPE_BITMASK = "network_type_bitmask"; 3178 3179 /** 3180 * Lingering radio technology (network type) bitmask. 3181 * To check what values can be contained, refer to the NETWORK_TYPE_ constants in 3182 * {@link android.telephony.TelephonyManager}. 3183 * Bitmask for a radio tech R is (1 << (R - 1)) 3184 * <P>Type: INTEGER (long)</P> 3185 * @hide 3186 */ 3187 public static final String LINGERING_NETWORK_TYPE_BITMASK = 3188 "lingering_network_type_bitmask"; 3189 3190 /** 3191 * Sets whether the PDU session brought up by this APN should always be on. 3192 * See 3GPP TS 23.501 section 5.6.13 3193 * <P>Type: INTEGER</P> 3194 * @hide 3195 */ 3196 public static final String ALWAYS_ON = "always_on"; 3197 3198 /** 3199 * MVNO type: 3200 * {@code SPN (Service Provider Name), IMSI, GID (Group Identifier Level 1)}. 3201 * <P>Type: TEXT</P> 3202 * @deprecated Use {@link #SIM_APN_URI} to query APN instead, this API will return 3203 * matching APNs based on current subscription carrier, thus no need to specify MVNO_TYPE 3204 * and other carrier matching information. In the future, Android will not support MVNO_TYPE 3205 * for APN query. 3206 */ 3207 public static final String MVNO_TYPE = "mvno_type"; 3208 3209 /** 3210 * MVNO data. 3211 * Use the following examples. 3212 * <ul> 3213 * <li>SPN: A MOBILE, BEN NL, ...</li> 3214 * <li>IMSI: 302720x94, 2060188, ...</li> 3215 * <li>GID: 4E, 33, ...</li> 3216 * </ul> 3217 * <P>Type: TEXT</P> 3218 * @deprecated Use {@link #SIM_APN_URI} to query APN instead, this API will return 3219 * matching APNs based on current subscription carrier, thus no need to specify 3220 * MVNO_MATCH_DATA and other carrier matching information. In the future, Android will not 3221 * support MVNO_MATCH_DATA for APN query. 3222 */ 3223 public static final String MVNO_MATCH_DATA = "mvno_match_data"; 3224 3225 /** 3226 * The subscription to which the APN belongs to 3227 * <p>Type: INTEGER (long) </p> 3228 */ 3229 public static final String SUBSCRIPTION_ID = "sub_id"; 3230 3231 /** 3232 * The profile_id to which the APN saved in modem. 3233 * <p>Type: INTEGER</p> 3234 *@hide 3235 */ 3236 public static final String PROFILE_ID = "profile_id"; 3237 3238 /** 3239 * If set to {@code true}, then the APN setting will persist to the modem. 3240 * <p>Type: INTEGER (boolean)</p> 3241 *@hide 3242 */ 3243 @SystemApi 3244 public static final String MODEM_PERSIST = "modem_cognitive"; 3245 3246 /** 3247 * The max number of connections of this APN. 3248 * <p>Type: INTEGER</p> 3249 *@hide 3250 */ 3251 @SystemApi 3252 public static final String MAX_CONNECTIONS = "max_conns"; 3253 3254 /** 3255 * The wait time for retrying the APN, in milliseconds. 3256 * <p>Type: INTEGER</p> 3257 *@hide 3258 */ 3259 @SystemApi 3260 public static final String WAIT_TIME_RETRY = "wait_time"; 3261 3262 /** 3263 * The max number of seconds this APN will support its maximum number of connections 3264 * as defined in {@link #MAX_CONNECTIONS}. 3265 * <p>Type: INTEGER</p> 3266 *@hide 3267 */ 3268 @SystemApi 3269 public static final String TIME_LIMIT_FOR_MAX_CONNECTIONS = "max_conns_time"; 3270 3271 /** 3272 * The MTU (maximum transmit unit) size of the mobile interface to which the APN is 3273 * connected, in bytes. 3274 * <p>Type: INTEGER </p> 3275 * @hide 3276 * @deprecated use {@link #MTU_V4} or {@link #MTU_V6} instead 3277 */ 3278 @SystemApi 3279 @Deprecated 3280 public static final String MTU = "mtu"; 3281 3282 /** 3283 * The MTU (maximum transmit unit) size of the mobile interface for IPv4 to which the APN is 3284 * connected, in bytes. 3285 * <p>Type: INTEGER </p> 3286 * @hide 3287 */ 3288 @SystemApi 3289 public static final String MTU_V4 = "mtu_v4"; 3290 3291 /** 3292 * The MTU (maximum transmit unit) size of the mobile interface for IPv6 to which the APN is 3293 * connected, in bytes. 3294 * <p>Type: INTEGER </p> 3295 * @hide 3296 */ 3297 @SystemApi 3298 public static final String MTU_V6 = "mtu_v6"; 3299 3300 /** 3301 * APN edit status. APN could be added/edited/deleted by a user or carrier. 3302 * see all possible returned APN edit status. 3303 * <ul> 3304 * <li>{@link #UNEDITED}</li> 3305 * <li>{@link #USER_EDITED}</li> 3306 * <li>{@link #USER_DELETED}</li> 3307 * <li>{@link #CARRIER_EDITED}</li> 3308 * <li>{@link #CARRIER_DELETED}</li> 3309 * </ul> 3310 * <p>Type: INTEGER </p> 3311 * @hide 3312 */ 3313 @SystemApi 3314 public static final String EDITED_STATUS = "edited"; 3315 3316 /** 3317 * {@code true} if this APN visible to the user, {@code false} otherwise. 3318 * <p>Type: INTEGER (boolean)</p> 3319 * @hide 3320 */ 3321 @SystemApi 3322 public static final String USER_VISIBLE = "user_visible"; 3323 3324 /** 3325 * {@code true} if the user allowed to edit this APN, {@code false} otherwise. 3326 * <p>Type: INTEGER (boolean)</p> 3327 * @hide 3328 */ 3329 @SystemApi 3330 public static final String USER_EDITABLE = "user_editable"; 3331 3332 /** 3333 * Integer value denoting an invalid APN id 3334 * @hide 3335 */ 3336 public static final int INVALID_APN_ID = -1; 3337 3338 /** 3339 * {@link #EDITED_STATUS APN edit status} indicates that this APN has not been edited or 3340 * fails to edit. 3341 * <p>Type: INTEGER </p> 3342 * @hide 3343 */ 3344 @SystemApi 3345 public static final @EditStatus int UNEDITED = 0; 3346 3347 /** 3348 * {@link #EDITED_STATUS APN edit status} indicates that this APN has been edited by users. 3349 * <p>Type: INTEGER </p> 3350 * @hide 3351 */ 3352 @SystemApi 3353 public static final @EditStatus int USER_EDITED = 1; 3354 3355 /** 3356 * {@link #EDITED_STATUS APN edit status} indicates that this APN has been deleted by users. 3357 * <p>Type: INTEGER </p> 3358 * @hide 3359 */ 3360 @SystemApi 3361 public static final @EditStatus int USER_DELETED = 2; 3362 3363 /** 3364 * {@link #EDITED_STATUS APN edit status} is an intermediate value used to indicate that an 3365 * entry deleted by the user is still present in the new APN database and therefore must 3366 * remain tagged as user deleted rather than completely removed from the database. 3367 * @hide 3368 */ 3369 public static final int USER_DELETED_BUT_PRESENT_IN_XML = 3; 3370 3371 /** 3372 * {@link #EDITED_STATUS APN edit status} indicates that this APN has been edited by 3373 * carriers. 3374 * <p>Type: INTEGER </p> 3375 * @hide 3376 */ 3377 @SystemApi 3378 public static final @EditStatus int CARRIER_EDITED = 4; 3379 3380 /** 3381 * {@link #EDITED_STATUS APN edit status} indicates that this APN has been deleted by 3382 * carriers. CARRIER_DELETED values are currently not used as there is no use case. 3383 * If they are used, delete() will have to change accordingly. Currently it is hardcoded to 3384 * USER_DELETED. 3385 * <p>Type: INTEGER </p> 3386 * @hide 3387 */ 3388 public static final @EditStatus int CARRIER_DELETED = 5; 3389 3390 /** 3391 * {@link #EDITED_STATUS APN edit status} is an intermediate value used to indicate that an 3392 * entry deleted by the carrier is still present in the new APN database and therefore must 3393 * remain tagged as user deleted rather than completely removed from the database. 3394 * @hide 3395 */ 3396 public static final int CARRIER_DELETED_BUT_PRESENT_IN_XML = 6; 3397 3398 /** 3399 * The owner of the APN. 3400 * <p>Type: INTEGER</p> 3401 * @hide 3402 */ 3403 public static final String OWNED_BY = "owned_by"; 3404 3405 /** 3406 * Possible value for the OWNED_BY field. 3407 * APN is owned by DPC. 3408 * @hide 3409 */ 3410 public static final int OWNED_BY_DPC = 0; 3411 3412 /** 3413 * Possible value for the OWNED_BY field. 3414 * APN is owned by other sources. 3415 * @hide 3416 */ 3417 public static final int OWNED_BY_OTHERS = 1; 3418 3419 /** 3420 * The APN set id. When the user manually selects an APN or the framework sets an APN as 3421 * preferred, the device can only use APNs with the same set id as the selected APN. 3422 * <p>Type: INTEGER</p> 3423 * @hide 3424 */ 3425 @SystemApi 3426 public static final String APN_SET_ID = "apn_set_id"; 3427 3428 /** 3429 * Possible value for the {@link #APN_SET_ID} field. By default APNs are added to set 0. 3430 * <p>Type: INTEGER</p> 3431 * @hide 3432 */ 3433 @SystemApi 3434 public static final int NO_APN_SET_ID = 0; 3435 3436 /** 3437 * Possible value for the {@link #APN_SET_ID} field. 3438 * APNs with MATCH_ALL_APN_SET_ID will be used regardless of any set ids of 3439 * the selected APN. 3440 * <p>Type: INTEGER</p> 3441 * @hide 3442 */ 3443 @SystemApi 3444 public static final int MATCH_ALL_APN_SET_ID = -1; 3445 3446 /** 3447 * A unique carrier id associated with this APN {@link TelephonyManager#getSimCarrierId()} 3448 * In case of matching carrier information, this should be used by default instead of 3449 * those fields of {@link #MCC}, {@link #MNC}, {@link #NUMERIC}, {@link #MVNO_TYPE}, 3450 * {@link #MVNO_MATCH_DATA}, etc. 3451 * <p>Type: STRING</p> 3452 */ 3453 public static final String CARRIER_ID = "carrier_id"; 3454 3455 /** 3456 * The skip 464xlat flag. Flag works as follows. 3457 * {@link #SKIP_464XLAT_DEFAULT}: the APN will skip only APN is IMS and no internet. 3458 * {@link #SKIP_464XLAT_DISABLE}: the APN will NOT skip 464xlat 3459 * {@link #SKIP_464XLAT_ENABLE}: the APN will skip 464xlat 3460 * <p>Type: INTEGER</p> 3461 * 3462 * @hide 3463 */ 3464 public static final String SKIP_464XLAT = "skip_464xlat"; 3465 3466 /** 3467 * Possible value for the {@link #SKIP_464XLAT} field. 3468 * <p>Type: INTEGER</p> 3469 * 3470 * @hide 3471 */ 3472 public static final int SKIP_464XLAT_DEFAULT = -1; 3473 3474 /** 3475 * Possible value for the {@link #SKIP_464XLAT} field. 3476 * <p>Type: INTEGER</p> 3477 * 3478 * @hide 3479 */ 3480 public static final int SKIP_464XLAT_DISABLE = 0; 3481 3482 /** 3483 * Possible value for the {@link #SKIP_464XLAT} field. 3484 * <p>Type: INTEGER</p> 3485 * 3486 * @hide 3487 */ 3488 public static final int SKIP_464XLAT_ENABLE = 1; 3489 3490 3491 /** @hide */ 3492 @IntDef({ 3493 UNEDITED, 3494 USER_EDITED, 3495 USER_DELETED, 3496 CARRIER_DELETED, 3497 CARRIER_EDITED, 3498 }) 3499 @Retention(RetentionPolicy.SOURCE) 3500 public @interface EditStatus {} 3501 3502 /** 3503 * Compat framework change ID for the APN db read permission change. 3504 * 3505 * In API level 30 and beyond, accessing the APN database will require the 3506 * {@link android.Manifest.permission#WRITE_APN_SETTINGS} permission. This change ID tracks 3507 * apps that are affected because they don't hold this permission. 3508 * @hide 3509 */ 3510 @ChangeId 3511 @EnabledAfter(targetSdkVersion = android.os.Build.VERSION_CODES.Q) 3512 public static final long APN_READING_PERMISSION_CHANGE_ID = 124107808L; 3513 } 3514 3515 /** 3516 * Contains received cell broadcast messages. More details are available in 3GPP TS 23.041. 3517 * @hide 3518 */ 3519 @SystemApi 3520 public static final class CellBroadcasts implements BaseColumns { 3521 3522 /** 3523 * Not instantiable. 3524 * @hide 3525 */ CellBroadcasts()3526 private CellBroadcasts() {} 3527 3528 /** 3529 * The {@code content://} URI for this table. 3530 * Only privileged framework components running on phone or network stack uid can 3531 * query or modify this table. 3532 */ 3533 @NonNull 3534 public static final Uri CONTENT_URI = Uri.parse("content://cellbroadcasts"); 3535 3536 /** 3537 * The {@code content://} URI for query cellbroadcast message history. 3538 * query results include following entries 3539 * <ul> 3540 * <li>{@link #_ID}</li> 3541 * <li>{@link #SLOT_INDEX}</li> 3542 * <li>{@link #GEOGRAPHICAL_SCOPE}</li> 3543 * <li>{@link #PLMN}</li> 3544 * <li>{@link #LAC}</li> 3545 * <li>{@link #CID}</li> 3546 * <li>{@link #SERIAL_NUMBER}</li> 3547 * <li>{@link #SERVICE_CATEGORY}</li> 3548 * <li>{@link #LANGUAGE_CODE}</li> 3549 * <li>{@link #MESSAGE_BODY}</li> 3550 * <li>{@link #DELIVERY_TIME}</li> 3551 * <li>{@link #MESSAGE_READ}</li> 3552 * <li>{@link #MESSAGE_FORMAT}</li> 3553 * <li>{@link #MESSAGE_PRIORITY}</li> 3554 * <li>{@link #ETWS_WARNING_TYPE}</li> 3555 * <li>{@link #CMAS_MESSAGE_CLASS}</li> 3556 * <li>{@link #CMAS_CATEGORY}</li> 3557 * <li>{@link #CMAS_RESPONSE_TYPE}</li> 3558 * <li>{@link #CMAS_SEVERITY}</li> 3559 * <li>{@link #CMAS_URGENCY}</li> 3560 * <li>{@link #CMAS_CERTAINTY}</li> 3561 * </ul> 3562 */ 3563 @RequiresPermission(Manifest.permission.READ_CELL_BROADCASTS) 3564 @NonNull 3565 public static final Uri MESSAGE_HISTORY_URI = Uri.parse("content://cellbroadcasts/history"); 3566 3567 /** 3568 * The authority for the legacy cellbroadcast provider. 3569 * This is used for OEM data migration. OEMs want to migrate message history or 3570 * sharepreference data to mainlined cellbroadcastreceiver app, should have a 3571 * contentprovider with authority: cellbroadcast-legacy. Mainlined cellbroadcastreceiver 3572 * will interact with this URI to retrieve data and persists to mainlined cellbroadcast app. 3573 * 3574 * @hide 3575 */ 3576 @SystemApi 3577 public static final @NonNull String AUTHORITY_LEGACY = "cellbroadcast-legacy"; 3578 3579 /** 3580 * A content:// style uri to the authority for the legacy cellbroadcast provider. 3581 * @hide 3582 */ 3583 @SystemApi 3584 public static final @NonNull Uri AUTHORITY_LEGACY_URI = 3585 Uri.parse("content://cellbroadcast-legacy"); 3586 3587 /** 3588 * Method name to {@link android.content.ContentProvider#call(String, String, Bundle) 3589 * for {@link #AUTHORITY_LEGACY}. Used to query cellbroadcast {@link Preference}, 3590 * containing following supported entries 3591 * <ul> 3592 * <li>{@link #ENABLE_AREA_UPDATE_INFO_PREF}</li> 3593 * <li>{@link #ENABLE_TEST_ALERT_PREF}</li> 3594 * <li>{@link #ENABLE_STATE_LOCAL_TEST_PREF}</li> 3595 * <li>{@link #ENABLE_PUBLIC_SAFETY_PREF}</li> 3596 * <li>{@link #ENABLE_CMAS_AMBER_PREF}</li> 3597 * <li>{@link #ENABLE_CMAS_SEVERE_THREAT_PREF}</li> 3598 * <li>{@link #ENABLE_CMAS_EXTREME_THREAT_PREF}</li> 3599 * <li>{@link #ENABLE_CMAS_PRESIDENTIAL_PREF}</li> 3600 * <li>{@link #ENABLE_ALERT_VIBRATION_PREF}</li> 3601 * <li>{@link #ENABLE_EMERGENCY_PERF}</li> 3602 * <li>{@link #ENABLE_CMAS_IN_SECOND_LANGUAGE_PREF}</li> 3603 * </ul> 3604 * @hide 3605 */ 3606 @SystemApi 3607 public static final @NonNull String CALL_METHOD_GET_PREFERENCE = "get_preference"; 3608 3609 /** 3610 * Arg name to {@link android.content.ContentProvider#call(String, String, Bundle)} 3611 * for {@link #AUTHORITY_LEGACY}. 3612 * Contains all supported shared preferences for cellbroadcast. 3613 * 3614 * @hide 3615 */ 3616 @SystemApi 3617 public static final class Preference { 3618 /** 3619 * Not Instantiatable. 3620 * @hide 3621 */ Preference()3622 private Preference() {} 3623 3624 /** Preference to enable area update info alert */ 3625 public static final @NonNull String ENABLE_AREA_UPDATE_INFO_PREF = 3626 "enable_area_update_info_alerts"; 3627 3628 /** Preference to enable test alert */ 3629 public static final @NonNull String ENABLE_TEST_ALERT_PREF = 3630 "enable_test_alerts"; 3631 3632 /** Preference to enable state local test alert */ 3633 public static final @NonNull String ENABLE_STATE_LOCAL_TEST_PREF 3634 = "enable_state_local_test_alerts"; 3635 3636 /** Preference to enable public safety alert */ 3637 public static final @NonNull String ENABLE_PUBLIC_SAFETY_PREF 3638 = "enable_public_safety_messages"; 3639 3640 /** Preference to enable amber alert */ 3641 public static final @NonNull String ENABLE_CMAS_AMBER_PREF 3642 = "enable_cmas_amber_alerts"; 3643 3644 /** Preference to enable severe threat alert */ 3645 public static final @NonNull String ENABLE_CMAS_SEVERE_THREAT_PREF 3646 = "enable_cmas_severe_threat_alerts"; 3647 3648 /** Preference to enable extreme threat alert */ 3649 public static final @NonNull String ENABLE_CMAS_EXTREME_THREAT_PREF = 3650 "enable_cmas_extreme_threat_alerts"; 3651 3652 /** Preference to enable presidential alert */ 3653 public static final @NonNull String ENABLE_CMAS_PRESIDENTIAL_PREF = 3654 "enable_cmas_presidential_alerts"; 3655 3656 /** Preference to enable alert vibration */ 3657 public static final @NonNull String ENABLE_ALERT_VIBRATION_PREF = 3658 "enable_alert_vibrate"; 3659 3660 /** Preference to enable emergency alert */ 3661 public static final @NonNull String ENABLE_EMERGENCY_PERF = 3662 "enable_emergency_alerts"; 3663 3664 /** Preference to enable receive alerts in second language */ 3665 public static final @NonNull String ENABLE_CMAS_IN_SECOND_LANGUAGE_PREF = 3666 "receive_cmas_in_second_language"; 3667 } 3668 3669 /** 3670 * The subscription which received this cell broadcast message. 3671 * <P>Type: INTEGER</P> 3672 */ 3673 public static final String SUBSCRIPTION_ID = "sub_id"; 3674 3675 /** 3676 * The slot which received this cell broadcast message. 3677 * <P>Type: INTEGER</P> 3678 */ 3679 public static final String SLOT_INDEX = "slot_index"; 3680 3681 /** 3682 * Message geographical scope. Valid values are: 3683 * <ul> 3684 * <li>{@link android.telephony.SmsCbMessage#GEOGRAPHICAL_SCOPE_CELL_WIDE}. meaning the 3685 * message is for the radio service cell</li> 3686 * <li>{@link android.telephony.SmsCbMessage#GEOGRAPHICAL_SCOPE_CELL_WIDE_IMMEDIATE}, 3687 * meaning the message is for the radio service cell and immediately displayed</li> 3688 * <li>{@link android.telephony.SmsCbMessage#GEOGRAPHICAL_SCOPE_PLMN_WIDE}, meaning the 3689 * message is for the PLMN (i.e. MCC/MNC)</li> 3690 * <li>{@link android.telephony.SmsCbMessage#GEOGRAPHICAL_SCOPE_LOCATION_AREA_WIDE}, 3691 * meaning the message is for the location area (in GSM) or service area (in UMTS)</li> 3692 * </ul> 3693 * 3694 * <p>A message meant for a particular scope is automatically dismissed when the device 3695 * exits that scope.</p> 3696 * <P>Type: INTEGER</P> 3697 */ 3698 public static final String GEOGRAPHICAL_SCOPE = "geo_scope"; 3699 3700 /** 3701 * Message serial number. 3702 * <p> 3703 * A 16-bit integer which identifies a particular CBS (cell 3704 * broadcast short message service) message. The core network is responsible for 3705 * allocating this value, and the value may be managed cyclically (3GPP TS 23.041 section 3706 * 9.2.1) once the serial message has been incremented a sufficient number of times. 3707 * </p> 3708 * <P>Type: INTEGER</P> 3709 */ 3710 public static final String SERIAL_NUMBER = "serial_number"; 3711 3712 /** 3713 * PLMN (i.e. MCC/MNC) of broadcast sender. {@code SERIAL_NUMBER + PLMN + LAC + CID} 3714 * uniquely identifies a broadcast for duplicate detection purposes. 3715 * <P>Type: TEXT</P> 3716 */ 3717 public static final String PLMN = "plmn"; 3718 3719 /** 3720 * Location area code (LAC). 3721 * <p>Code representing location area (GSM) or service area (UMTS) of broadcast sender. 3722 * Unused for CDMA. Only included if Geographical Scope of message is not PLMN wide (01). 3723 * This value is sent by the network based on the cell tower. 3724 * <P>Type: INTEGER</P> 3725 */ 3726 public static final String LAC = "lac"; 3727 3728 /** 3729 * Cell ID of message sender (GSM/UMTS). Unused for CDMA. Only included when the 3730 * Geographical Scope of message is cell wide (00 or 11). 3731 * <P>Type: INTEGER</P> 3732 */ 3733 public static final String CID = "cid"; 3734 3735 /** 3736 * Service category which represents the general topic of the message. 3737 * <p> 3738 * For GSM/UMTS: message identifier (see 3GPP TS 23.041 section 9.4.1.2.2) 3739 * For CDMA: a 16-bit CDMA service category (see 3GPP2 C.R1001-D section 9.3) 3740 * </p> 3741 * <P>Type: INTEGER</P> 3742 */ 3743 public static final String SERVICE_CATEGORY = "service_category"; 3744 3745 /** 3746 * Message language code. (See 3GPP TS 23.041 section 9.4.1.2.3 for details). 3747 * <P>Type: TEXT</P> 3748 */ 3749 public static final String LANGUAGE_CODE = "language"; 3750 3751 /** 3752 * Dats coding scheme of the message. 3753 * <p> 3754 * The data coding scheme (dcs) value defined in 3GPP TS 23.038 section 4 3755 * </p> 3756 * <P>Type: INTEGER</P> 3757 */ 3758 public static final String DATA_CODING_SCHEME = "dcs"; 3759 3760 /** 3761 * Message body. 3762 * <P>Type: TEXT</P> 3763 */ 3764 public static final String MESSAGE_BODY = "body"; 3765 3766 /** 3767 * Message delivery time. 3768 * <p>This value is a system timestamp using {@link System#currentTimeMillis}</p> 3769 * <P>Type: INTEGER (long)</P> 3770 */ 3771 public static final String DELIVERY_TIME = "date"; 3772 3773 /** 3774 * Has the message been viewed? 3775 * <P>Type: INTEGER (boolean)</P> 3776 */ 3777 public static final String MESSAGE_READ = "read"; 3778 3779 /** 3780 * Message format ({@link android.telephony.SmsCbMessage#MESSAGE_FORMAT_3GPP} or 3781 * {@link android.telephony.SmsCbMessage#MESSAGE_FORMAT_3GPP2}). 3782 * <P>Type: INTEGER</P> 3783 */ 3784 public static final String MESSAGE_FORMAT = "format"; 3785 3786 /** 3787 * Message priority. 3788 * <p>This includes 3789 * <ul> 3790 * <li>{@link android.telephony.SmsCbMessage#MESSAGE_PRIORITY_NORMAL}</li> 3791 * <li>{@link android.telephony.SmsCbMessage#MESSAGE_PRIORITY_INTERACTIVE}</li> 3792 * <li>{@link android.telephony.SmsCbMessage#MESSAGE_PRIORITY_URGENT}</li> 3793 * <li>{@link android.telephony.SmsCbMessage#MESSAGE_PRIORITY_EMERGENCY}</li> 3794 * </p> 3795 * </ul> 3796 * <P>Type: INTEGER</P> 3797 */ 3798 public static final String MESSAGE_PRIORITY = "priority"; 3799 3800 /** 3801 * ETWS (Earthquake and Tsunami Warning System) warning type (ETWS alerts only). 3802 * <p>See {@link android.telephony.SmsCbEtwsInfo}</p> 3803 * <P>Type: INTEGER</P> 3804 */ 3805 public static final String ETWS_WARNING_TYPE = "etws_warning_type"; 3806 3807 /** 3808 * ETWS (Earthquake and Tsunami Warning System, Japan only) primary message or not. The 3809 * primary message is sent as soon as the emergency occurs. It does not provide any 3810 * information except the emergency type (e.g. earthquake, tsunami). The ETWS secondary 3811 * message is sent afterwards and provides the details of the emergency. 3812 * 3813 * <p>See {@link android.telephony.SmsCbEtwsInfo}</p> 3814 * <P>Type: BOOLEAN</P> 3815 */ 3816 public static final String ETWS_IS_PRIMARY = "etws_is_primary"; 3817 3818 /** 3819 * CMAS (Commercial Mobile Alert System) message class (CMAS alerts only). 3820 * <p>See {@link android.telephony.SmsCbCmasInfo}</p> 3821 * <P>Type: INTEGER</P> 3822 */ 3823 public static final String CMAS_MESSAGE_CLASS = "cmas_message_class"; 3824 3825 /** 3826 * CMAS category (CMAS alerts only). 3827 * <P>Type: INTEGER</P> 3828 */ 3829 public static final String CMAS_CATEGORY = "cmas_category"; 3830 3831 /** 3832 * CMAS response type (CMAS alerts only). 3833 * <P>Type: INTEGER</P> 3834 */ 3835 public static final String CMAS_RESPONSE_TYPE = "cmas_response_type"; 3836 3837 /** 3838 * CMAS severity (CMAS alerts only). 3839 * <P>Type: INTEGER</P> 3840 */ 3841 public static final String CMAS_SEVERITY = "cmas_severity"; 3842 3843 /** 3844 * CMAS urgency (CMAS alerts only). 3845 * <P>Type: INTEGER</P> 3846 */ 3847 public static final String CMAS_URGENCY = "cmas_urgency"; 3848 3849 /** 3850 * CMAS certainty (CMAS alerts only). 3851 * <P>Type: INTEGER</P> 3852 */ 3853 public static final String CMAS_CERTAINTY = "cmas_certainty"; 3854 3855 /** The default sort order for this table. */ 3856 public static final String DEFAULT_SORT_ORDER = DELIVERY_TIME + " DESC"; 3857 3858 /** 3859 * The timestamp in millisecond, reported by {@link System#currentTimeMillis()}, when the 3860 * device received the message. 3861 * <P>Type: BIGINT</P> 3862 */ 3863 public static final String RECEIVED_TIME = "received_time"; 3864 3865 /** 3866 * The timestamp in millisecond, reported by {@link System#currentTimeMillis()}, when 3867 * location was checked last time. Note this is only applicable to geo-targeting message. 3868 * For non geo-targeting message. the field will be set to -1. 3869 * <P>Type: BIGINT</P> 3870 */ 3871 public static final String LOCATION_CHECK_TIME = "location_check_time"; 3872 /** 3873 * Indicates that whether the message has been broadcasted to the application. 3874 * <P>Type: BOOLEAN</P> 3875 */ 3876 // TODO: deprecate this in S. 3877 public static final String MESSAGE_BROADCASTED = "message_broadcasted"; 3878 3879 /** 3880 * Indicates that whether the message has been displayed to the user. 3881 * <P>Type: BOOLEAN</P> 3882 */ 3883 public static final String MESSAGE_DISPLAYED = "message_displayed"; 3884 3885 /** 3886 * The Warning Area Coordinates Elements. This element is used for geo-fencing purpose. 3887 * 3888 * The geometry and its coordinates are separated vertical bar, the first item is the 3889 * geometry type and the remaining items are the parameter of this geometry. 3890 * 3891 * Only circle and polygon are supported. The coordinates are represented in Horizontal 3892 * coordinates format. 3893 * 3894 * Coordinate encoding: 3895 * "latitude, longitude" 3896 * where -90.00000 <= latitude <= 90.00000 and -180.00000 <= longitude <= 180.00000 3897 * 3898 * Polygon encoding: 3899 * "polygon|lat1,lng1|lat2,lng2|...|latn,lngn" 3900 * lat1,lng1 ... latn,lngn are the vertices coordinate of the polygon. 3901 * 3902 * Circle encoding: 3903 * "circle|lat,lng|radius". 3904 * lat,lng is the center of the circle. The unit of circle's radius is meter. 3905 * 3906 * Example: 3907 * "circle|0,0|100" mean a circle which center located at (0,0) and its radius is 100 meter. 3908 * "polygon|0,1.5|0,1|1,1|1,0" mean a polygon has vertices (0,1.5),(0,1),(1,1),(1,0). 3909 * 3910 * There could be more than one geometry store in this field, they are separated by a 3911 * semicolon. 3912 * 3913 * Example: 3914 * "circle|0,0|100;polygon|0,0|0,1.5|1,1|1,0;circle|100.123,100|200.123" 3915 * 3916 * <P>Type: TEXT</P> 3917 */ 3918 public static final String GEOMETRIES = "geometries"; 3919 3920 /** 3921 * Geo-Fencing Maximum Wait Time in second. The range of the time is [0, 255]. A device 3922 * shall allow to determine its position meeting operator policy. If the device is unable to 3923 * determine its position meeting operator policy within the GeoFencing Maximum Wait Time, 3924 * it shall present the alert to the user and discontinue further positioning determination 3925 * for the alert. 3926 * 3927 * <P>Type: INTEGER</P> 3928 */ 3929 public static final String MAXIMUM_WAIT_TIME = "maximum_wait_time"; 3930 3931 /** 3932 * Query columns for instantiating com.android.cellbroadcastreceiver.CellBroadcastMessage. 3933 * @hide 3934 */ 3935 @NonNull 3936 public static final String[] QUERY_COLUMNS = { 3937 _ID, 3938 GEOGRAPHICAL_SCOPE, 3939 PLMN, 3940 LAC, 3941 CID, 3942 SERIAL_NUMBER, 3943 SERVICE_CATEGORY, 3944 LANGUAGE_CODE, 3945 MESSAGE_BODY, 3946 DELIVERY_TIME, 3947 MESSAGE_READ, 3948 MESSAGE_FORMAT, 3949 MESSAGE_PRIORITY, 3950 ETWS_WARNING_TYPE, 3951 CMAS_MESSAGE_CLASS, 3952 CMAS_CATEGORY, 3953 CMAS_RESPONSE_TYPE, 3954 CMAS_SEVERITY, 3955 CMAS_URGENCY, 3956 CMAS_CERTAINTY 3957 }; 3958 } 3959 3960 /** 3961 * Constants for interfacing with the ServiceStateProvider and the different fields of the 3962 * {@link ServiceState} class accessible through the provider. 3963 */ 3964 public static final class ServiceStateTable { 3965 3966 /** 3967 * Not instantiable. 3968 * @hide 3969 */ ServiceStateTable()3970 private ServiceStateTable() {} 3971 3972 /** 3973 * The authority string for the ServiceStateProvider 3974 */ 3975 public static final String AUTHORITY = "service-state"; 3976 3977 /** 3978 * The {@code content://} style URL for the ServiceStateProvider 3979 */ 3980 public static final Uri CONTENT_URI = Uri.parse("content://service-state/"); 3981 3982 /** 3983 * Generates a content {@link Uri} used to receive updates on a specific field in the 3984 * ServiceState provider. 3985 * <p> 3986 * Use this {@link Uri} with a {@link ContentObserver} to be notified of changes to the 3987 * {@link ServiceState} while your app is running. 3988 * You can also use a {@link android.app.job.JobService} to 3989 * ensure your app is notified of changes to the {@link Uri} even when it is not running. 3990 * Note, however, that using a {@link android.app.job.JobService} 3991 * does not guarantee timely delivery of 3992 * updates to the {@link Uri}. 3993 * 3994 * @param subscriptionId the subscriptionId to receive updates on 3995 * @param field the ServiceState field to receive updates on 3996 * @return the Uri used to observe {@link ServiceState} changes 3997 */ getUriForSubscriptionIdAndField(int subscriptionId, String field)3998 public static Uri getUriForSubscriptionIdAndField(int subscriptionId, String field) { 3999 return CONTENT_URI.buildUpon().appendEncodedPath(String.valueOf(subscriptionId)) 4000 .appendEncodedPath(field).build(); 4001 } 4002 4003 /** 4004 * Generates a content {@link Uri} used to receive updates on every field in the 4005 * ServiceState provider. 4006 * <p> 4007 * Use this {@link Uri} with a {@link ContentObserver} to be notified of changes to the 4008 * {@link ServiceState} while your app is running. You can also use a 4009 * {@link android.app.job.JobService} to 4010 * ensure your app is notified of changes to the {@link Uri} even when it is not running. 4011 * Note, however, that using a {@link android.app.job.JobService} 4012 * does not guarantee timely delivery of 4013 * updates to the {@link Uri}. 4014 * 4015 * @param subscriptionId the subscriptionId to receive updates on 4016 * @return the Uri used to observe {@link ServiceState} changes 4017 */ getUriForSubscriptionId(int subscriptionId)4018 public static Uri getUriForSubscriptionId(int subscriptionId) { 4019 return CONTENT_URI.buildUpon().appendEncodedPath(String.valueOf(subscriptionId)).build(); 4020 } 4021 4022 /** 4023 * An integer value indicating the current voice service state. 4024 * <p> 4025 * Valid values: {@link ServiceState#STATE_IN_SERVICE}, 4026 * {@link ServiceState#STATE_OUT_OF_SERVICE}, {@link ServiceState#STATE_EMERGENCY_ONLY}, 4027 * {@link ServiceState#STATE_POWER_OFF}. 4028 * <p> 4029 * This is the same as {@link ServiceState#getState()}. 4030 */ 4031 public static final String VOICE_REG_STATE = "voice_reg_state"; 4032 4033 /** 4034 * An integer value indicating the current data service state. 4035 * <p> 4036 * Valid values: {@link ServiceState#STATE_IN_SERVICE}, 4037 * {@link ServiceState#STATE_OUT_OF_SERVICE}, {@link ServiceState#STATE_EMERGENCY_ONLY}, 4038 * {@link ServiceState#STATE_POWER_OFF}. 4039 */ 4040 public static final String DATA_REG_STATE = "data_reg_state"; 4041 4042 /** 4043 * The current registered operator numeric id. 4044 * <p> 4045 * In GSM/UMTS, numeric format is 3 digit country code plus 2 or 3 digit 4046 * network code. 4047 * <p> 4048 * This is the same as {@link ServiceState#getOperatorNumeric()}. 4049 */ 4050 public static final String VOICE_OPERATOR_NUMERIC = "voice_operator_numeric"; 4051 4052 /** 4053 * The current network selection mode. 4054 * <p> 4055 * This is the same as {@link ServiceState#getIsManualSelection()}. 4056 */ 4057 public static final String IS_MANUAL_NETWORK_SELECTION = "is_manual_network_selection"; 4058 4059 /** 4060 * The current data network type. 4061 * <p> 4062 * This is the same as {@link TelephonyManager#getDataNetworkType()}. 4063 */ 4064 public static final String DATA_NETWORK_TYPE = "data_network_type"; 4065 4066 /** 4067 * An integer value indicating the current duplex mode if the radio technology is LTE, 4068 * LTE-CA or NR. 4069 * <p> 4070 * Valid values: {@link ServiceState#DUPLEX_MODE_UNKNOWN}, 4071 * {@link ServiceState#DUPLEX_MODE_FDD}, {@link ServiceState#DUPLEX_MODE_TDD}. 4072 * <p> 4073 * This is the same as {@link ServiceState#getDuplexMode()}. 4074 */ 4075 public static final String DUPLEX_MODE = "duplex_mode"; 4076 } 4077 4078 /** 4079 * Contains carrier identification information for the current subscriptions. 4080 */ 4081 public static final class CarrierId implements BaseColumns { 4082 /** 4083 * Not instantiable. 4084 * @hide 4085 */ CarrierId()4086 private CarrierId() {} 4087 4088 /** 4089 * The {@code content://} style URI for this provider. 4090 */ 4091 public static final Uri CONTENT_URI = Uri.parse("content://carrier_id"); 4092 4093 /** 4094 * The authority string for the CarrierId Provider 4095 * @hide 4096 */ 4097 public static final String AUTHORITY = "carrier_id"; 4098 4099 4100 /** 4101 * Generates a content {@link Uri} used to receive updates on carrier identity change 4102 * on the given subscriptionId 4103 * <p> 4104 * Use this {@link Uri} with a {@link ContentObserver} to be notified of changes to the 4105 * carrier identity {@link TelephonyManager#getSimCarrierId()} 4106 * while your app is running. You can also use a {@link android.app.job.JobService} 4107 * to ensure your app 4108 * is notified of changes to the {@link Uri} even when it is not running. 4109 * Note, however, that using a {@link android.app.job.JobService} does not guarantee 4110 * timely delivery of updates to the {@link Uri}. 4111 * 4112 * @param subscriptionId the subscriptionId to receive updates on 4113 * @return the Uri used to observe carrier identity changes 4114 */ getUriForSubscriptionId(int subscriptionId)4115 public static Uri getUriForSubscriptionId(int subscriptionId) { 4116 return CONTENT_URI.buildUpon().appendEncodedPath( 4117 String.valueOf(subscriptionId)).build(); 4118 } 4119 4120 /** 4121 * Generates a content {@link Uri} used to receive updates on specific carrier identity 4122 * change on the given subscriptionId returned by 4123 * {@link TelephonyManager#getSimSpecificCarrierId()}. 4124 * @see TelephonyManager#ACTION_SUBSCRIPTION_SPECIFIC_CARRIER_IDENTITY_CHANGED 4125 * <p> 4126 * Use this {@link Uri} with a {@link ContentObserver} to be notified of changes to the 4127 * specific carrier identity {@link TelephonyManager#getSimSpecificCarrierId()} 4128 * while your app is running. You can also use a {@link android.app.job.JobService} 4129 * to ensure your app 4130 * is notified of changes to the {@link Uri} even when it is not running. 4131 * Note, however, that using a {@link android.app.job.JobService} does not guarantee timely 4132 * delivery of updates to the {@link Uri}. 4133 * 4134 * @param subscriptionId the subscriptionId to receive updates on 4135 * @return the Uri used to observe specific carrier identity changes 4136 */ 4137 @NonNull getSpecificCarrierIdUriForSubscriptionId(int subscriptionId)4138 public static Uri getSpecificCarrierIdUriForSubscriptionId(int subscriptionId) { 4139 return Uri.withAppendedPath(Uri.withAppendedPath(CONTENT_URI, "specific"), 4140 String.valueOf(subscriptionId)); 4141 } 4142 4143 /** 4144 * A user facing carrier name. 4145 * @see TelephonyManager#getSimCarrierIdName() 4146 * <P>Type: TEXT </P> 4147 */ 4148 public static final String CARRIER_NAME = "carrier_name"; 4149 4150 /** 4151 * A unique carrier id 4152 * @see TelephonyManager#getSimCarrierId() 4153 * <P>Type: INTEGER </P> 4154 */ 4155 public static final String CARRIER_ID = "carrier_id"; 4156 4157 /** 4158 * A fine-grained carrier id. 4159 * The specific carrier ID would be used for configuration purposes, but apps wishing to 4160 * know about the carrier itself should use the regular carrier ID returned by 4161 * {@link TelephonyManager#getSimCarrierId()}. 4162 * 4163 * @see TelephonyManager#getSimSpecificCarrierId() 4164 * This is not a database column, only used to notify content observers for 4165 * {@link #getSpecificCarrierIdUriForSubscriptionId(int)} 4166 */ 4167 public static final String SPECIFIC_CARRIER_ID = "specific_carrier_id"; 4168 4169 /** 4170 * A user facing carrier name for specific carrier id {@link #SPECIFIC_CARRIER_ID}. 4171 * @see TelephonyManager#getSimSpecificCarrierIdName() 4172 * This is not a database column, only used to notify content observers for 4173 * {@link #getSpecificCarrierIdUriForSubscriptionId(int)} 4174 */ 4175 public static final String SPECIFIC_CARRIER_ID_NAME = "specific_carrier_id_name"; 4176 4177 /** 4178 * A unique parent carrier id. The parent-child 4179 * relationship can be used to further differentiate a single carrier by different networks, 4180 * by prepaid v.s. postpaid. It's an optional field. 4181 * A carrier id with a valid parent_carrier_id is considered fine-grained specific carrier 4182 * ID, will not be returned as {@link #CARRIER_ID} but {@link #SPECIFIC_CARRIER_ID}. 4183 * <P>Type: INTEGER </P> 4184 * @hide 4185 */ 4186 public static final String PARENT_CARRIER_ID = "parent_carrier_id"; 4187 4188 /** 4189 * Contains mappings between matching rules with carrier id for all carriers. 4190 * @hide 4191 */ 4192 public static final class All implements BaseColumns { 4193 4194 /** 4195 * Not instantiable. 4196 * @hide 4197 */ All()4198 private All() { 4199 } 4200 4201 /** 4202 * Numeric operator ID (as String). {@code MCC + MNC} 4203 * <P>Type: TEXT </P> 4204 */ 4205 public static final String MCCMNC = "mccmnc"; 4206 4207 /** 4208 * Group id level 1 (as String). 4209 * <P>Type: TEXT </P> 4210 */ 4211 public static final String GID1 = "gid1"; 4212 4213 /** 4214 * Group id level 2 (as String). 4215 * <P>Type: TEXT </P> 4216 */ 4217 public static final String GID2 = "gid2"; 4218 4219 /** 4220 * Public Land Mobile Network name. 4221 * <P>Type: TEXT </P> 4222 */ 4223 public static final String PLMN = "plmn"; 4224 4225 /** 4226 * Prefix xpattern of IMSI (International Mobile Subscriber Identity). 4227 * <P>Type: TEXT </P> 4228 */ 4229 public static final String IMSI_PREFIX_XPATTERN = "imsi_prefix_xpattern"; 4230 4231 /** 4232 * Service Provider Name. 4233 * <P>Type: TEXT </P> 4234 */ 4235 public static final String SPN = "spn"; 4236 4237 /** 4238 * Prefer APN name. 4239 * <P>Type: TEXT </P> 4240 */ 4241 public static final String APN = "apn"; 4242 4243 /** 4244 * Prefix of Integrated Circuit Card Identifier. 4245 * <P>Type: TEXT </P> 4246 */ 4247 public static final String ICCID_PREFIX = "iccid_prefix"; 4248 4249 /** 4250 * Certificate for carrier privilege access rules. 4251 * <P>Type: TEXT in hex string </P> 4252 */ 4253 public static final String PRIVILEGE_ACCESS_RULE = "privilege_access_rule"; 4254 4255 /** 4256 * The {@code content://} URI for this table. 4257 */ 4258 @NonNull 4259 public static final Uri CONTENT_URI = Uri.parse("content://carrier_id/all"); 4260 } 4261 } 4262 4263 /** 4264 * Contains SIM Information 4265 * @hide 4266 */ 4267 public static final class SimInfo { 4268 /** 4269 * Not instantiable. 4270 * @hide 4271 */ SimInfo()4272 private SimInfo() {} 4273 4274 /** 4275 * The {@code content://} style URI for this provider. 4276 * @hide 4277 */ 4278 @NonNull 4279 public static final Uri CONTENT_URI = Uri.parse("content://telephony/siminfo"); 4280 4281 /** 4282 * TelephonyProvider unique key column name is the subscription id. 4283 * <P>Type: TEXT (String)</P> 4284 * 4285 * @hide 4286 */ 4287 public static final String COLUMN_UNIQUE_KEY_SUBSCRIPTION_ID = "_id"; 4288 4289 /** 4290 * TelephonyProvider column name for a unique identifier for the subscription within the 4291 * specific subscription type. For example, it contains SIM ICC Identifier subscriptions 4292 * on Local SIMs. and Mac-address for Remote-SIM Subscriptions for Bluetooth devices. 4293 * <P>Type: TEXT (String)</P> 4294 * 4295 * @hide 4296 */ 4297 public static final String COLUMN_ICC_ID = "icc_id"; 4298 4299 /** 4300 * TelephonyProvider column name for user SIM_SlOT_INDEX 4301 * <P>Type: INTEGER (int)</P> 4302 * 4303 * @hide 4304 */ 4305 public static final String COLUMN_SIM_SLOT_INDEX = "sim_id"; 4306 4307 /** 4308 * SIM is not inserted 4309 * @hide 4310 */ 4311 public static final int SIM_NOT_INSERTED = -1; 4312 4313 /** 4314 * TelephonyProvider column name Subscription-type. 4315 * <P>Type: INTEGER (int)</P> {@link #SUBSCRIPTION_TYPE_LOCAL_SIM} for Local-SIM 4316 * Subscriptions, {@link #SUBSCRIPTION_TYPE_REMOTE_SIM} for Remote-SIM Subscriptions. 4317 * Default value is 0. 4318 * 4319 * @hide 4320 */ 4321 public static final String COLUMN_SUBSCRIPTION_TYPE = "subscription_type"; 4322 4323 /** 4324 * This constant is to designate a subscription as a Local-SIM Subscription. 4325 * <p> A Local-SIM can be a physical SIM inserted into a sim-slot in the device, or eSIM on 4326 * the device. 4327 * </p> 4328 * 4329 * @hide 4330 */ 4331 public static final int SUBSCRIPTION_TYPE_LOCAL_SIM = 0; 4332 4333 /** 4334 * This constant is to designate a subscription as a Remote-SIM Subscription. 4335 * <p> 4336 * A Remote-SIM subscription is for a SIM on a phone connected to this device via some 4337 * connectivity mechanism, for example bluetooth. Similar to Local SIM, this subscription 4338 * can be used for SMS, Voice and data by proxying data through the connected device. 4339 * Certain data of the SIM, such as IMEI, are not accessible for Remote SIMs. 4340 * </p> 4341 * 4342 * <p> 4343 * A Remote-SIM is available only as long the phone stays connected to this device. 4344 * When the phone disconnects, Remote-SIM subscription is removed from this device and is 4345 * no longer known. All data associated with the subscription, such as stored SMS, call 4346 * logs, contacts etc, are removed from this device. 4347 * </p> 4348 * 4349 * <p> 4350 * If the phone re-connects to this device, a new Remote-SIM subscription is created for 4351 * the phone. The Subscription Id associated with the new subscription is different from 4352 * the Subscription Id of the previous Remote-SIM subscription created (and removed) for the 4353 * phone; i.e., new Remote-SIM subscription treats the reconnected phone as a Remote-SIM 4354 * that was never seen before. 4355 * </p> 4356 * 4357 * @hide 4358 */ 4359 public static final int SUBSCRIPTION_TYPE_REMOTE_SIM = 1; 4360 4361 /** 4362 * TelephonyProvider column name data_enabled_override_rules. 4363 * It's a list of rules for overriding data enabled settings. The syntax is 4364 * For example, "mms=nonDefault" indicates enabling data for mms in non-default 4365 * subscription. 4366 * "default=nonDefault&inVoiceCall" indicates enabling data for internet in non-default 4367 * subscription and while is in voice call. 4368 * 4369 * Default value is empty string. 4370 * @deprecated This column is no longer supported. Use 4371 * {@link #COLUMN_ENABLED_MOBILE_DATA_POLICIES} instead. 4372 * @hide 4373 */ 4374 @Deprecated 4375 public static final String COLUMN_DATA_ENABLED_OVERRIDE_RULES = 4376 "data_enabled_override_rules"; 4377 4378 /** 4379 * TelephonyProvider column name enabled_mobile_data_policies. 4380 * A list of mobile data policies, each of which represented by an integer and joint by ",". 4381 * 4382 * Default value is empty string. 4383 * @hide 4384 */ 4385 public static final String COLUMN_ENABLED_MOBILE_DATA_POLICIES = 4386 "enabled_mobile_data_policies"; 4387 4388 /** 4389 * TelephonyProvider column name for user displayed name. 4390 * <P>Type: TEXT (String)</P> 4391 * 4392 * @hide 4393 */ 4394 public static final String COLUMN_DISPLAY_NAME = "display_name"; 4395 4396 /** 4397 * TelephonyProvider column name for the service provider name for the SIM. 4398 * <P>Type: TEXT (String)</P> 4399 * 4400 * @hide 4401 */ 4402 public static final String COLUMN_CARRIER_NAME = "carrier_name"; 4403 4404 /** 4405 * TelephonyProvider column name for source of the user displayed name. 4406 * <P>Type: INT (int)</P> with one of the NAME_SOURCE_XXXX values below 4407 * 4408 * @hide 4409 */ 4410 public static final String COLUMN_NAME_SOURCE = "name_source"; 4411 4412 /** 4413 * The name source is unknown. 4414 * @hide 4415 */ 4416 public static final int NAME_SOURCE_UNKNOWN = -1; 4417 4418 /** The name_source is from the carrier id. {@hide} */ 4419 public static final int NAME_SOURCE_CARRIER_ID = 0; 4420 4421 /** 4422 * The name_source is from SIM EF_SPN. 4423 * @hide 4424 */ 4425 public static final int NAME_SOURCE_SIM_SPN = 1; 4426 4427 /** 4428 * The name_source is from user input 4429 * @hide 4430 */ 4431 public static final int NAME_SOURCE_USER_INPUT = 2; 4432 4433 /** 4434 * The name_source is carrier (carrier app, carrier config, etc.) 4435 * @hide 4436 */ 4437 public static final int NAME_SOURCE_CARRIER = 3; 4438 4439 /** 4440 * The name_source is from SIM EF_PNN. 4441 * @hide 4442 */ 4443 public static final int NAME_SOURCE_SIM_PNN = 4; 4444 4445 /** 4446 * TelephonyProvider column name for the color of a SIM. 4447 * <P>Type: INTEGER (int)</P> 4448 * 4449 * @hide 4450 */ 4451 public static final String COLUMN_COLOR = "color"; 4452 4453 /** The default color of a SIM {@hide} */ 4454 public static final int COLOR_DEFAULT = 0; 4455 4456 /** 4457 * TelephonyProvider column name for the phone number of a SIM. 4458 * <P>Type: TEXT (String)</P> 4459 * 4460 * @hide 4461 */ 4462 public static final String COLUMN_NUMBER = "number"; 4463 4464 /** 4465 * TelephonyProvider column name for the number display format of a SIM. 4466 * <P>Type: INTEGER (int)</P> 4467 * 4468 * @hide 4469 */ 4470 public static final String COLUMN_DISPLAY_NUMBER_FORMAT = "display_number_format"; 4471 4472 /** 4473 * TelephonyProvider column name for the default display format of a SIM 4474 * @hide 4475 */ 4476 public static final int DISPLAY_NUMBER_DEFAULT = 1; 4477 4478 /** 4479 * TelephonyProvider column name for whether data roaming is enabled. 4480 * <P>Type: INTEGER (int)</P> 4481 * 4482 * @hide 4483 */ 4484 public static final String COLUMN_DATA_ROAMING = "data_roaming"; 4485 4486 /** Indicates that data roaming is enabled for a subscription {@hide} */ 4487 public static final int DATA_ROAMING_ENABLE = 1; 4488 4489 /** Indicates that data roaming is disabled for a subscription {@hide} */ 4490 public static final int DATA_ROAMING_DISABLE = 0; 4491 4492 /** 4493 * TelephonyProvider column name for subscription carrier id. 4494 * @see TelephonyManager#getSimCarrierId() 4495 * <p>Type: INTEGER (int) </p> 4496 * 4497 * @hide 4498 */ 4499 public static final String COLUMN_CARRIER_ID = "carrier_id"; 4500 4501 /** 4502 * A comma-separated list of EHPLMNs associated with the subscription 4503 * <P>Type: TEXT (String)</P> 4504 * 4505 * @hide 4506 */ 4507 public static final String COLUMN_EHPLMNS = "ehplmns"; 4508 4509 /** 4510 * A comma-separated list of HPLMNs associated with the subscription 4511 * <P>Type: TEXT (String)</P> 4512 * 4513 * @hide 4514 */ 4515 public static final String COLUMN_HPLMNS = "hplmns"; 4516 4517 /** 4518 * TelephonyProvider column name for the MCC associated with a SIM, stored as a string. 4519 * <P>Type: TEXT (String)</P> 4520 * 4521 * @hide 4522 */ 4523 public static final String COLUMN_MCC_STRING = "mcc_string"; 4524 4525 /** 4526 * TelephonyProvider column name for the MNC associated with a SIM, stored as a string. 4527 * <P>Type: TEXT (String)</P> 4528 * 4529 * @hide 4530 */ 4531 public static final String COLUMN_MNC_STRING = "mnc_string"; 4532 4533 /** 4534 * TelephonyProvider column name for the MCC associated with a SIM. 4535 * <P>Type: INTEGER (int)</P> 4536 * 4537 * @hide 4538 */ 4539 public static final String COLUMN_MCC = "mcc"; 4540 4541 /** 4542 * TelephonyProvider column name for the MNC associated with a SIM. 4543 * <P>Type: INTEGER (int)</P> 4544 * 4545 * @hide 4546 */ 4547 public static final String COLUMN_MNC = "mnc"; 4548 4549 /** 4550 * TelephonyProvider column name for the iso country code associated with a SIM. 4551 * <P>Type: TEXT (String)</P> 4552 * 4553 * @hide 4554 */ 4555 public static final String COLUMN_ISO_COUNTRY_CODE = "iso_country_code"; 4556 4557 /** 4558 * TelephonyProvider column name for the sim provisioning status associated with a SIM. 4559 * <P>Type: INTEGER (int)</P> 4560 * 4561 * @hide 4562 */ 4563 public static final String COLUMN_SIM_PROVISIONING_STATUS = "sim_provisioning_status"; 4564 4565 /** The sim is provisioned {@hide} */ 4566 public static final int SIM_PROVISIONED = 0; 4567 4568 /** 4569 * TelephonyProvider column name for whether a subscription is embedded (that is, present on 4570 * an eSIM). 4571 * <p>Type: INTEGER (int), 1 for embedded or 0 for non-embedded. 4572 * 4573 * @hide 4574 */ 4575 public static final String COLUMN_IS_EMBEDDED = "is_embedded"; 4576 4577 /** 4578 * TelephonyProvider column name for SIM card identifier. For UICC card it is the ICCID of 4579 * the current enabled profile on the card, while for eUICC card it is the EID of the card. 4580 * <P>Type: TEXT (String)</P> 4581 * 4582 * @hide 4583 */ 4584 public static final String COLUMN_CARD_ID = "card_id"; 4585 4586 /** 4587 * TelephonyProvider column name for the encoded {@link UiccAccessRule}s from 4588 * {@link UiccAccessRule#encodeRules}. Only present if {@link #COLUMN_IS_EMBEDDED} is 1. 4589 * <p>TYPE: BLOB 4590 * 4591 * @hide 4592 */ 4593 public static final String COLUMN_ACCESS_RULES = "access_rules"; 4594 4595 /** 4596 * TelephonyProvider column name for the encoded {@link UiccAccessRule}s from 4597 * {@link UiccAccessRule#encodeRules} but for the rules that come from CarrierConfigs. 4598 * Only present if there are access rules in CarrierConfigs 4599 * <p>TYPE: BLOB 4600 * 4601 * @hide 4602 */ 4603 public static final String COLUMN_ACCESS_RULES_FROM_CARRIER_CONFIGS = 4604 "access_rules_from_carrier_configs"; 4605 4606 /** 4607 * TelephonyProvider column name identifying whether an embedded subscription is on a 4608 * removable card. Such subscriptions are marked inaccessible as soon as the current card 4609 * is removed. Otherwise, they will remain accessible unless explicitly deleted. Only 4610 * present if {@link #COLUMN_IS_EMBEDDED} is 1. 4611 * <p>TYPE: INTEGER (int), 1 for removable or 0 for non-removable. 4612 * 4613 * @hide 4614 */ 4615 public static final String COLUMN_IS_REMOVABLE = "is_removable"; 4616 4617 /** TelephonyProvider column name for extreme threat in CB settings {@hide} */ 4618 public static final String COLUMN_CB_EXTREME_THREAT_ALERT = 4619 "enable_cmas_extreme_threat_alerts"; 4620 4621 /** TelephonyProvider column name for severe threat in CB settings {@hide} */ 4622 public static final String COLUMN_CB_SEVERE_THREAT_ALERT = 4623 "enable_cmas_severe_threat_alerts"; 4624 4625 /** TelephonyProvider column name for amber alert in CB settings {@hide} */ 4626 public static final String COLUMN_CB_AMBER_ALERT = "enable_cmas_amber_alerts"; 4627 4628 /** TelephonyProvider column name for emergency alert in CB settings {@hide} */ 4629 public static final String COLUMN_CB_EMERGENCY_ALERT = "enable_emergency_alerts"; 4630 4631 /** TelephonyProvider column name for alert sound duration in CB settings {@hide} */ 4632 public static final String COLUMN_CB_ALERT_SOUND_DURATION = "alert_sound_duration"; 4633 4634 /** TelephonyProvider column name for alert reminder interval in CB settings {@hide} */ 4635 public static final String COLUMN_CB_ALERT_REMINDER_INTERVAL = "alert_reminder_interval"; 4636 4637 /** TelephonyProvider column name for enabling vibrate in CB settings {@hide} */ 4638 public static final String COLUMN_CB_ALERT_VIBRATE = "enable_alert_vibrate"; 4639 4640 /** TelephonyProvider column name for enabling alert speech in CB settings {@hide} */ 4641 public static final String COLUMN_CB_ALERT_SPEECH = "enable_alert_speech"; 4642 4643 /** TelephonyProvider column name for ETWS test alert in CB settings {@hide} */ 4644 public static final String COLUMN_CB_ETWS_TEST_ALERT = "enable_etws_test_alerts"; 4645 4646 /** TelephonyProvider column name for enable channel50 alert in CB settings {@hide} */ 4647 public static final String COLUMN_CB_CHANNEL_50_ALERT = "enable_channel_50_alerts"; 4648 4649 /** TelephonyProvider column name for CMAS test alert in CB settings {@hide} */ 4650 public static final String COLUMN_CB_CMAS_TEST_ALERT = "enable_cmas_test_alerts"; 4651 4652 /** TelephonyProvider column name for Opt out dialog in CB settings {@hide} */ 4653 public static final String COLUMN_CB_OPT_OUT_DIALOG = "show_cmas_opt_out_dialog"; 4654 4655 /** 4656 * TelephonyProvider column name for enable Volte. 4657 * 4658 * If this setting is not initialized (set to -1) then we use the Carrier Config value 4659 * {@link CarrierConfigManager#KEY_ENHANCED_4G_LTE_ON_BY_DEFAULT_BOOL}. 4660 * 4661 * @hide 4662 */ 4663 public static final String COLUMN_ENHANCED_4G_MODE_ENABLED = "volte_vt_enabled"; 4664 4665 /** TelephonyProvider column name for enable VT (Video Telephony over IMS) {@hide} */ 4666 public static final String COLUMN_VT_IMS_ENABLED = "vt_ims_enabled"; 4667 4668 /** TelephonyProvider column name for enable Wifi calling {@hide} */ 4669 public static final String COLUMN_WFC_IMS_ENABLED = "wfc_ims_enabled"; 4670 4671 /** TelephonyProvider column name for Wifi calling mode {@hide} */ 4672 public static final String COLUMN_WFC_IMS_MODE = "wfc_ims_mode"; 4673 4674 /** TelephonyProvider column name for Wifi calling mode in roaming {@hide} */ 4675 public static final String COLUMN_WFC_IMS_ROAMING_MODE = "wfc_ims_roaming_mode"; 4676 4677 /** TelephonyProvider column name for enable Wifi calling in roaming {@hide} */ 4678 public static final String COLUMN_WFC_IMS_ROAMING_ENABLED = "wfc_ims_roaming_enabled"; 4679 4680 /** 4681 * TelephonyProvider column name for determining if the user has enabled IMS RCS User 4682 * Capability Exchange (UCE) for this subscription. 4683 * 4684 * @hide 4685 */ 4686 public static final String COLUMN_IMS_RCS_UCE_ENABLED = "ims_rcs_uce_enabled"; 4687 4688 /** 4689 * TelephonyProvider column name for determining if the user has enabled cross SIM calling 4690 * for this subscription. 4691 * 4692 * @hide 4693 */ 4694 public static final String COLUMN_CROSS_SIM_CALLING_ENABLED = "cross_sim_calling_enabled"; 4695 4696 /** 4697 * TelephonyProvider column name for whether a subscription is opportunistic, that is, 4698 * whether the network it connects to is limited in functionality or coverage. 4699 * For example, CBRS. 4700 * <p>Type: INTEGER (int), 1 for opportunistic or 0 for non-opportunistic. 4701 * 4702 * @hide 4703 */ 4704 public static final String COLUMN_IS_OPPORTUNISTIC = "is_opportunistic"; 4705 4706 /** 4707 * TelephonyProvider column name for group ID. Subscriptions with same group ID 4708 * are considered bundled together, and should behave as a single subscription at 4709 * certain scenarios. 4710 * 4711 * @hide 4712 */ 4713 public static final String COLUMN_GROUP_UUID = "group_uuid"; 4714 4715 /** 4716 * TelephonyProvider column name for group owner. It's the package name who created 4717 * the subscription group. 4718 * 4719 * @hide 4720 */ 4721 public static final String COLUMN_GROUP_OWNER = "group_owner"; 4722 4723 /** 4724 * TelephonyProvider column name for whether a subscription is metered or not, that is, 4725 * whether the network it connects to charges for subscription or not. For example, paid 4726 * CBRS or unpaid. 4727 * 4728 * @hide 4729 */ 4730 public static final String COLUMN_IS_METERED = "is_metered"; 4731 4732 /** 4733 * TelephonyProvider column name for the profile class of a subscription 4734 * Only present if {@link #COLUMN_IS_EMBEDDED} is 1. 4735 * <P>Type: INTEGER (int)</P> 4736 * 4737 * @hide 4738 */ 4739 public static final String COLUMN_PROFILE_CLASS = "profile_class"; 4740 4741 /** 4742 * TelephonyProvider column name for the port index of the active UICC port. 4743 * <P>Type: INTEGER (int)</P> 4744 * @hide 4745 */ 4746 public static final String COLUMN_PORT_INDEX = "port_index"; 4747 4748 /** 4749 * A testing profile can be pre-loaded or downloaded onto 4750 * the eUICC and provides connectivity to test equipment 4751 * for the purpose of testing the device and the eUICC. It 4752 * is not intended to store any operator credentials. 4753 * 4754 * @hide 4755 */ 4756 public static final int PROFILE_CLASS_TESTING = 0; 4757 4758 /** 4759 * A provisioning profile is pre-loaded onto the eUICC and 4760 * provides connectivity to a mobile network solely for the 4761 * purpose of provisioning profiles. 4762 * 4763 * @hide 4764 */ 4765 public static final int PROFILE_CLASS_PROVISIONING = 1; 4766 4767 /** 4768 * An operational profile can be pre-loaded or downloaded 4769 * onto the eUICC and provides services provided by the 4770 * operator. 4771 * 4772 * @hide 4773 */ 4774 public static final int PROFILE_CLASS_OPERATIONAL = 2; 4775 4776 /** 4777 * The profile class is unset. This occurs when profile class 4778 * info is not available. The subscription either has no profile 4779 * metadata or the profile metadata did not encode profile class. 4780 * 4781 * @hide 4782 */ 4783 public static final int PROFILE_CLASS_UNSET = -1; 4784 4785 /** 4786 * IMSI (International Mobile Subscriber Identity). 4787 * <P>Type: TEXT </P> 4788 * 4789 * @hide 4790 */ 4791 public static final String COLUMN_IMSI = "imsi"; 4792 4793 /** 4794 * Whether uicc applications is set to be enabled or disabled. By default it's enabled. 4795 * @hide 4796 */ 4797 public static final String COLUMN_UICC_APPLICATIONS_ENABLED = "uicc_applications_enabled"; 4798 4799 /** 4800 * TelephonyProvider column name for allowed network types. Indicate which network types 4801 * are allowed. Default is -1. 4802 * <P>Type: BIGINT (long) </P> 4803 * 4804 * @hide 4805 */ 4806 public static final String COLUMN_ALLOWED_NETWORK_TYPES = "allowed_network_types"; 4807 4808 /** 4809 * TelephonyProvider column name for allowed network types with all of reasons. Indicate 4810 * which network types are allowed for 4811 * {@link TelephonyManager#ALLOWED_NETWORK_TYPES_REASON_USER}, 4812 * {@link TelephonyManager#ALLOWED_NETWORK_TYPES_REASON_POWER}, 4813 * {@link TelephonyManager#ALLOWED_NETWORK_TYPES_REASON_CARRIER}, 4814 * {@link TelephonyManager#ALLOWED_NETWORK_TYPES_REASON_ENABLE_2G}. 4815 * <P>Type: TEXT </P> 4816 * 4817 * @hide 4818 */ 4819 public static final String COLUMN_ALLOWED_NETWORK_TYPES_FOR_REASONS = 4820 "allowed_network_types_for_reasons"; 4821 4822 /** 4823 * TelephonyProvider column name for RCS configuration. 4824 * <p>TYPE: BLOB 4825 * 4826 * @hide 4827 */ 4828 public static final String COLUMN_RCS_CONFIG = "rcs_config"; 4829 4830 /** 4831 * TelephonyProvider column name for device to device sharing status. 4832 * 4833 * @hide 4834 */ 4835 public static final String COLUMN_D2D_STATUS_SHARING = "d2d_sharing_status"; 4836 4837 /** 4838 * TelephonyProvider column name for VoIMS provisioning. Default is 0. 4839 * <P>Type: INTEGER </P> 4840 * 4841 * @hide 4842 */ 4843 public static final String COLUMN_VOIMS_OPT_IN_STATUS = "voims_opt_in_status"; 4844 4845 /** 4846 * TelephonyProvider column name for information selected contacts that allow device to 4847 * device sharing. 4848 * 4849 * @hide 4850 */ 4851 public static final String COLUMN_D2D_STATUS_SHARING_SELECTED_CONTACTS = 4852 "d2d_sharing_contacts"; 4853 4854 /** 4855 * TelephonyProvider column name for NR Advanced calling 4856 * Determines if the user has enabled VoNR settings for this subscription. 4857 * 4858 * @hide 4859 */ 4860 public static final String COLUMN_NR_ADVANCED_CALLING_ENABLED = 4861 "nr_advanced_calling_enabled"; 4862 4863 /** 4864 * TelephonyProvider column name for the phone number from source CARRIER 4865 * 4866 * @hide 4867 */ 4868 public static final String COLUMN_PHONE_NUMBER_SOURCE_CARRIER = 4869 "phone_number_source_carrier"; 4870 4871 /** 4872 * TelephonyProvider column name for the phone number from source IMS 4873 * 4874 * @hide 4875 */ 4876 public static final String COLUMN_PHONE_NUMBER_SOURCE_IMS = 4877 "phone_number_source_ims"; 4878 4879 /** 4880 * TelephonyProvider column name for last used TP - message Reference 4881 * 4882 * @hide 4883 */ 4884 public static final String COLUMN_TP_MESSAGE_REF = "tp_message_ref"; 4885 4886 /** 4887 * TelephonyProvider column name for the device's preferred usage setting. 4888 * 4889 * @hide 4890 */ 4891 public static final String COLUMN_USAGE_SETTING = "usage_setting"; 4892 4893 /** 4894 * TelephonyProvider column name for user handle associated with this sim. 4895 * 4896 * @hide 4897 */ 4898 public static final String COLUMN_USER_HANDLE = "user_handle"; 4899 4900 /** 4901 * TelephonyProvider column name for satellite enabled. 4902 * By default, it's disabled. 4903 * 4904 * @hide 4905 */ 4906 public static final String COLUMN_SATELLITE_ENABLED = "satellite_enabled"; 4907 4908 /** All columns in {@link SimInfo} table. */ 4909 private static final List<String> ALL_COLUMNS = List.of( 4910 COLUMN_UNIQUE_KEY_SUBSCRIPTION_ID, 4911 COLUMN_ICC_ID, 4912 COLUMN_SIM_SLOT_INDEX, 4913 COLUMN_DISPLAY_NAME, 4914 COLUMN_CARRIER_NAME, 4915 COLUMN_NAME_SOURCE, 4916 COLUMN_COLOR, 4917 COLUMN_NUMBER, 4918 COLUMN_DISPLAY_NUMBER_FORMAT, 4919 COLUMN_DATA_ROAMING, 4920 COLUMN_MCC, 4921 COLUMN_MNC, 4922 COLUMN_MCC_STRING, 4923 COLUMN_MNC_STRING, 4924 COLUMN_EHPLMNS, 4925 COLUMN_HPLMNS, 4926 COLUMN_SIM_PROVISIONING_STATUS, 4927 COLUMN_IS_EMBEDDED, 4928 COLUMN_CARD_ID, 4929 COLUMN_ACCESS_RULES, 4930 COLUMN_ACCESS_RULES_FROM_CARRIER_CONFIGS, 4931 COLUMN_IS_REMOVABLE, 4932 COLUMN_CB_EXTREME_THREAT_ALERT, 4933 COLUMN_CB_SEVERE_THREAT_ALERT, 4934 COLUMN_CB_AMBER_ALERT, 4935 COLUMN_CB_EMERGENCY_ALERT, 4936 COLUMN_CB_ALERT_SOUND_DURATION, 4937 COLUMN_CB_ALERT_REMINDER_INTERVAL, 4938 COLUMN_CB_ALERT_VIBRATE, 4939 COLUMN_CB_ALERT_SPEECH, 4940 COLUMN_CB_ETWS_TEST_ALERT, 4941 COLUMN_CB_CHANNEL_50_ALERT, 4942 COLUMN_CB_CMAS_TEST_ALERT, 4943 COLUMN_CB_OPT_OUT_DIALOG, 4944 COLUMN_ENHANCED_4G_MODE_ENABLED, 4945 COLUMN_VT_IMS_ENABLED, 4946 COLUMN_WFC_IMS_ENABLED, 4947 COLUMN_WFC_IMS_MODE, 4948 COLUMN_WFC_IMS_ROAMING_MODE, 4949 COLUMN_WFC_IMS_ROAMING_ENABLED, 4950 COLUMN_IS_OPPORTUNISTIC, 4951 COLUMN_GROUP_UUID, 4952 COLUMN_IS_METERED, 4953 COLUMN_ISO_COUNTRY_CODE, 4954 COLUMN_CARRIER_ID, 4955 COLUMN_PROFILE_CLASS, 4956 COLUMN_SUBSCRIPTION_TYPE, 4957 COLUMN_GROUP_OWNER, 4958 COLUMN_DATA_ENABLED_OVERRIDE_RULES, 4959 COLUMN_ENABLED_MOBILE_DATA_POLICIES, 4960 COLUMN_IMSI, 4961 COLUMN_UICC_APPLICATIONS_ENABLED, 4962 COLUMN_ALLOWED_NETWORK_TYPES, 4963 COLUMN_IMS_RCS_UCE_ENABLED, 4964 COLUMN_CROSS_SIM_CALLING_ENABLED, 4965 COLUMN_RCS_CONFIG, 4966 COLUMN_ALLOWED_NETWORK_TYPES_FOR_REASONS, 4967 COLUMN_D2D_STATUS_SHARING, 4968 COLUMN_VOIMS_OPT_IN_STATUS, 4969 COLUMN_D2D_STATUS_SHARING_SELECTED_CONTACTS, 4970 COLUMN_NR_ADVANCED_CALLING_ENABLED, 4971 COLUMN_PHONE_NUMBER_SOURCE_CARRIER, 4972 COLUMN_PHONE_NUMBER_SOURCE_IMS, 4973 COLUMN_PORT_INDEX, 4974 COLUMN_USAGE_SETTING, 4975 COLUMN_TP_MESSAGE_REF, 4976 COLUMN_USER_HANDLE, 4977 COLUMN_SATELLITE_ENABLED 4978 ); 4979 4980 /** 4981 * @return All columns in {@link SimInfo} table. 4982 * 4983 * @hide 4984 */ 4985 @NonNull getAllColumns()4986 public static List<String> getAllColumns() { 4987 return ALL_COLUMNS; 4988 } 4989 } 4990 4991 /** 4992 * Stores incoming satellite datagrams. 4993 * @hide 4994 */ 4995 public static final class SatelliteDatagrams { 4996 /** 4997 * Not instantiable. 4998 * @hide 4999 */ SatelliteDatagrams()5000 private SatelliteDatagrams() {} 5001 5002 /** 5003 * Provider name for Satellite Datagrams table. 5004 */ 5005 public static final String PROVIDER_NAME = "satellite"; 5006 5007 /** 5008 * Table name for Satellite Datagrams table. 5009 */ 5010 public static final String TABLE_NAME = "incoming_datagrams"; 5011 5012 /** 5013 * URL for satellite incoming datagrams table. 5014 */ 5015 private static final String URL = "content://" + PROVIDER_NAME + "/" + TABLE_NAME; 5016 5017 /** 5018 * The {@code content://} style URI for this provider. 5019 * @hide 5020 */ 5021 public static final Uri CONTENT_URI = Uri.parse(URL); 5022 5023 /** 5024 * SatelliteProvider unique key column name is the datagram id. 5025 * <P>Type: INTEGER (int)</P> 5026 * @hide 5027 */ 5028 public static final String COLUMN_UNIQUE_KEY_DATAGRAM_ID = "datagram_id"; 5029 5030 /** 5031 * SatelliteProvider column name for storing datagram. 5032 * <p>TYPE: BLOB 5033 * @hide 5034 */ 5035 public static final String COLUMN_DATAGRAM = "datagram"; 5036 5037 /** All columns in {@link SatelliteDatagrams} table. */ 5038 private static final List<String> ALL_COLUMNS = List.of( 5039 COLUMN_UNIQUE_KEY_DATAGRAM_ID, 5040 COLUMN_DATAGRAM 5041 ); 5042 5043 /** 5044 * @return All columns in {@link SatelliteDatagrams} table. 5045 * @hide 5046 */ 5047 @NonNull getAllColumns()5048 public static List<String> getAllColumns() { 5049 return ALL_COLUMNS; 5050 } 5051 } 5052 } 5053