diff options
author | Walter Jang <wjang@google.com> | 2021-01-15 16:16:58 -0800 |
---|---|---|
committer | Walter Jang <wjang@google.com> | 2021-01-15 16:19:15 -0800 |
commit | 2875a0db6e1d1f037dd90f1f5b0a20693ec1f139 (patch) | |
tree | 3f99f82a6999939381795de4df4ddfb22063f0e9 /src/com/android/contacts/model | |
parent | 40c481fdfcf78479fd8b8f6611d819b5110b91bf (diff) | |
download | Contacts-2875a0db6e1d1f037dd90f1f5b0a20693ec1f139.tar.gz |
Don't attempt to use RawContacts.getLocalAccount APIs below R
Test: atest ContactsTests
Change-Id: Ic41d28bb1fa0a3bcd1fceda8b33baba2fdeeb2bc
Diffstat (limited to 'src/com/android/contacts/model')
-rw-r--r-- | src/com/android/contacts/model/account/AccountWithDataSet.java | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/src/com/android/contacts/model/account/AccountWithDataSet.java b/src/com/android/contacts/model/account/AccountWithDataSet.java index 96717624e..358ef9c10 100644 --- a/src/com/android/contacts/model/account/AccountWithDataSet.java +++ b/src/com/android/contacts/model/account/AccountWithDataSet.java @@ -21,6 +21,7 @@ import android.content.ContentProviderOperation; import android.content.Context; import android.database.Cursor; import android.net.Uri; +import android.os.Build; import android.os.Parcel; import android.os.Parcelable; import android.provider.BaseColumns; @@ -87,11 +88,12 @@ public class AccountWithDataSet implements Parcelable { } public static AccountWithDataSet getLocalAccount(Context context) { - return new AccountWithDataSet( - RawContacts.getLocalAccountName(context), - RawContacts.getLocalAccountType(context), - null - ); + return android.os.Build.VERSION.SDK_INT < Build.VERSION_CODES.R + ? getNullAccount() + : new AccountWithDataSet( + RawContacts.getLocalAccountName(context), + RawContacts.getLocalAccountType(context), + null); } public Account getAccountOrNull() { @@ -261,4 +263,3 @@ public class AccountWithDataSet implements Parcelable { return ret; } } - |