From 8fd17c67ce47c7c5b68c19249933faa8dd20777e Mon Sep 17 00:00:00 2001 From: Tingting Date: Wed, 14 Jul 2021 23:43:29 +0000 Subject: [PATCH] Add defaultAccount related API to ContactsContract. Add columns in ContactsContract.Settings to indicate the default account for new contacts. Test: ran m update-api to generate current.txt change. Bug: 188347310 Change-Id: I4333455e36079561b6bfcdd07375aa56659bb4db --- core/api/current.txt | 1 + core/java/android/provider/ContactsContract.java | 16 ++++++++++++++++ 2 files changed, 17 insertions(+) diff --git a/core/api/current.txt b/core/api/current.txt index 4c1476cc3b33f..859a91dd7daea 100644 --- a/core/api/current.txt +++ b/core/api/current.txt @@ -34824,6 +34824,7 @@ package android.provider { } public static final class ContactsContract.Settings implements android.provider.ContactsContract.SettingsColumns { + field public static final String ACTION_SET_DEFAULT_ACCOUNT = "android.provider.action.SET_DEFAULT_ACCOUNT"; field public static final String CONTENT_ITEM_TYPE = "vnd.android.cursor.item/setting"; field public static final String CONTENT_TYPE = "vnd.android.cursor.dir/setting"; field public static final android.net.Uri CONTENT_URI; diff --git a/core/java/android/provider/ContactsContract.java b/core/java/android/provider/ContactsContract.java index b3d60a58410f5..570d73d4293b2 100644 --- a/core/java/android/provider/ContactsContract.java +++ b/core/java/android/provider/ContactsContract.java @@ -8588,6 +8588,15 @@ public final class ContactsContract { * Type: INTEGER */ public static final String UNGROUPED_WITH_PHONES = "summ_phones"; + + /** + * Flag indicating if the account is the default account for new contacts. At most one + * account has this flag set at a time. It can only be set to 1 on a row with null data set. + *

+ * Type: INTEGER (boolean) + * @hide + */ + String IS_DEFAULT = "x_is_default"; } /** @@ -8681,6 +8690,13 @@ public final class ContactsContract { * The MIME-type of {@link #CONTENT_URI} providing a single setting. */ public static final String CONTENT_ITEM_TYPE = "vnd.android.cursor.item/setting"; + + /** + * Action used to launch the UI to set the default account for new contacts. + */ + @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) + public static final String ACTION_SET_DEFAULT_ACCOUNT = + "android.provider.action.SET_DEFAULT_ACCOUNT"; } /**