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

Commit 00affc8e authored by Sal Savage's avatar Sal Savage
Browse files

Storage Refactor: Introduce PbapClientContactsStorage

This change combines the concepts of our Account Manager and Storage
interfaces (not currently centralized) into a single storage abstraction
called PbapClientContactsStorage.

This object owns storage accounts (a wrapper on Account Manager
accounts), storage interfaces, intialization (clearing of stale accounts
and data, etc.), and clean up (final bulk deletion of data on stop).

It's to be owned by PbapClientService, who will start and stop it (i.e.
own the lifecycle). State Machines will use a reference to this object
to create accounts, get notified when their account is ready, store
download results, and clean up contacts and call history upon
disconnect. This will come in a future change with a new State Machine

Bug: 376461939
Bug: 365626536
Test: atest com.android.bluetooth.pbapclient
Change-Id: Ibd14f91ca5f5e85b9ab78dbb61b2ab175f73a692
parent be9589e2
Loading
Loading
Loading
Loading
+11 −0
Original line number Diff line number Diff line
@@ -353,6 +353,17 @@
            column="31"/>
    </issue>

    <issue
        id="SimpleDateFormat"
        message="To get local formatting use `getDateInstance()`, `getDateTimeInstance()`, or `getTimeInstance()`, or use `new SimpleDateFormat(String template, Locale locale)` with for example `Locale.US` for ASCII dates."
        errorLine1="                SimpleDateFormat parser = new SimpleDateFormat(TIMESTAMP_FORMAT);"
        errorLine2="                                          ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
        <location
            file="packages/modules/Bluetooth/android/app/src/com/android/bluetooth/pbapclient/PbapClientContactsStorage.java"
            line="485"
            column="43"/>
    </issue>

    <issue
        id="SimpleDateFormat"
        message="To get local formatting use `getDateInstance()`, `getDateTimeInstance()`, or `getTimeInstance()`, or use `new SimpleDateFormat(String template, Locale locale)` with for example `Locale.US` for ASCII dates."
+584 −0

File added.

Preview size limit exceeded, changes collapsed.

+36 −6

File changed.

Preview size limit exceeded, changes collapsed.

+5 −0
Original line number Diff line number Diff line
@@ -30,6 +30,7 @@ import android.util.Log;
import android.util.Pair;

import com.android.bluetooth.BluetoothMethodProxy;
import com.android.bluetooth.flags.Flags;
import com.android.internal.annotations.VisibleForTesting;
import com.android.vcard.VCardEntry;
import com.android.vcard.VCardEntry.PhoneData;
@@ -52,6 +53,10 @@ public class CallLogPullRequest extends PullRequest {

    public CallLogPullRequest(
            Context context, String path, Map<String, Integer> map, Account account) {
        if (Flags.pbapClientStorageRefactor()) {
            Log.w(TAG, "This object should not be used. Use PbapClientContactsStorage");
        }

        mContext = context;
        this.path = path;
        mCallCounter = map;
+5 −0
Original line number Diff line number Diff line
@@ -23,6 +23,7 @@ import android.os.RemoteException;
import android.provider.ContactsContract;
import android.util.Log;

import com.android.bluetooth.flags.Flags;
import com.android.internal.annotations.VisibleForTesting;
import com.android.vcard.VCardEntry;

@@ -37,6 +38,10 @@ public class PhonebookPullRequest extends PullRequest {
    public boolean complete = false;

    public PhonebookPullRequest(Context context) {
        if (Flags.pbapClientStorageRefactor()) {
            Log.w(TAG, "This object should not be used. Use PbapClientContactsStorage");
        }

        mContext = context;
        path = PbapPhonebook.LOCAL_PHONEBOOK_PATH;
    }
Loading