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

Commit 2875a0db authored by Walter Jang's avatar Walter Jang
Browse files

Don't attempt to use RawContacts.getLocalAccount APIs below R

Test: atest ContactsTests

Change-Id: Ic41d28bb1fa0a3bcd1fceda8b33baba2fdeeb2bc
parent 40c481fd
Loading
Loading
Loading
Loading
+7 −6
Original line number Diff line number Diff line
@@ -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(
        return android.os.Build.VERSION.SDK_INT < Build.VERSION_CODES.R
                ? getNullAccount()
                : new AccountWithDataSet(
                      RawContacts.getLocalAccountName(context),
                      RawContacts.getLocalAccountType(context),
                null
        );
                      null);
    }

    public Account getAccountOrNull() {
@@ -261,4 +263,3 @@ public class AccountWithDataSet implements Parcelable {
        return ret;
    }
}