Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 897e38f1 authored by Liefu Liu's avatar Liefu Liu
Browse files

Added LocalAndSimContactWriteException in ContactsContract.

Bug: 379303491
Test: atest ContactsProviderTests and atest Contacts and atest CtsContactsProviderTestCases
Flag: android.provider.new_default_account_api_enabled

	modified:   api/current.txt
	modified:   java/android/provider/ContactsContract.java

Change-Id: I6d0cf10f2d868e168414fe04af34aeaa619ff9f2
parent 086602a8
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -37605,6 +37605,10 @@ package android.provider {
    field public static final String TERTIARY_PHONE_TYPE = "tertiary_phone_type";
  }
  @FlaggedApi("android.provider.new_default_account_api_enabled") public static class ContactsContract.LocalSimContactsWriteException extends java.lang.IllegalArgumentException {
    ctor public ContactsContract.LocalSimContactsWriteException(@NonNull String);
  }
  public static final class ContactsContract.PhoneLookup implements android.provider.BaseColumns android.provider.ContactsContract.ContactNameColumns android.provider.ContactsContract.ContactOptionsColumns android.provider.ContactsContract.ContactsColumns android.provider.ContactsContract.PhoneLookupColumns {
    field public static final android.net.Uri CONTENT_FILTER_URI;
    field public static final android.net.Uri ENTERPRISE_CONTENT_FILTER_URI;
+22 −0
Original line number Diff line number Diff line
@@ -10859,6 +10859,28 @@ public final class ContactsContract {
                "vnd.android.cursor.item/contact_metadata_sync_state";
    }

    /**
     * This exception is thrown when an attempt is made to perform a write operation
     * on a contact or contact group targeting a local account or a SIM account,
     * and the operation is not permitted under the current conditions.
     * The local account can be retrieved using {@link RawContacts#getLocalAccountName(Context)}
     * and {@link RawContacts#getLocalAccountType(Context)}.
     * SIM accounts can be retrieved using {@link SimContacts#getSimAccounts(ContentResolver)}.
     *
     * <p>Local and SIM accounts have limitations that may prevent write operations
     * due to their nature, underlying implementation, or the current system state.
     * For example, the SIM card may be full, read-only, or not present.
     *
     * <p>The specific conditions under which write operations are permitted on
     * local or SIM accounts can vary.
     */
    @FlaggedApi(Flags.FLAG_NEW_DEFAULT_ACCOUNT_API_ENABLED)
    public static class LocalSimContactsWriteException extends IllegalArgumentException {
        public LocalSimContactsWriteException(@NonNull String s) {
            super(s);
        }
    }

    private static Bundle nullSafeCall(@NonNull ContentResolver resolver, @NonNull Uri uri,
            @NonNull String method, @Nullable String arg, @Nullable Bundle extras) {
        try (ContentProviderClient client = resolver.acquireContentProviderClient(uri)) {