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