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