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

Commit 7cc0c30d authored by Terry Wang's avatar Terry Wang
Browse files

Refactor AppSearch to split into AppSearchDocument and AppSearchEmail.

This change is a no-op refactor.

Bug: 143789408
Test: atest FrameworksCoreTests:android.app.appsearch
Change-Id: I36faca03a830fa87d0a40373d3f5ddd6dbdd6640
parent 0111ea77
Loading
Loading
Loading
Loading
+0 −854

File deleted.

Preview size limit exceeded, changes collapsed.

+589 −0

File added.

Preview size limit exceeded, changes collapsed.

+255 −0

File added.

Preview size limit exceeded, changes collapsed.

+6 −6
Original line number Diff line number Diff line
@@ -18,7 +18,6 @@ package android.app.appsearch;
import android.annotation.CallbackExecutor;
import android.annotation.NonNull;
import android.annotation.SystemService;
import android.app.appsearch.AppSearch.Document;
import android.content.Context;
import android.os.RemoteException;

@@ -150,25 +149,26 @@ public class AppSearchManager {
    }

    /**
     * Index {@link android.app.appsearch.AppSearch.Document Documents} into AppSearch.
     * Index {@link AppSearchDocument Documents} into AppSearch.
     *
     * <p>You should not call this method directly; instead, use the
     * {@code AppSearch#putDocuments()} API provided by JetPack.
     *
     * <p>Each {@link AppSearch.Document Document's} {@code schemaType} field must be set to the
     * <p>Each {@link AppSearchDocument Document's} {@code schemaType} field must be set to the
     * name of a schema type previously registered via the {@link #setSchema} method.
     *
     * @param documents {@link Document Documents} that need to be indexed.
     * @param documents {@link AppSearchDocument Documents} that need to be indexed.
     * @return An {@link AppSearchBatchResult} mapping the document URIs to {@link Void} if they
     *     were successfully indexed, or a {@link Throwable} describing the failure if they could
     *     not be indexed.
     * @hide
     */
    public AppSearchBatchResult<String, Void> putDocuments(@NonNull List<Document> documents) {
    public AppSearchBatchResult<String, Void> putDocuments(
            @NonNull List<AppSearchDocument> documents) {
        // TODO(b/146386470): Transmit these documents as a RemoteStream instead of sending them in
        // one big list.
        List<byte[]> documentsBytes = new ArrayList<>(documents.size());
        for (Document document : documents) {
        for (AppSearchDocument document : documents) {
            documentsBytes.add(document.getProto().toByteArray());
        }
        AndroidFuture<AppSearchBatchResult> future = new AndroidFuture<>();
+2 −2
Original line number Diff line number Diff line
@@ -70,7 +70,7 @@ public final class MatchInfo {

    private final String mPropertyPath;
    private final SnippetMatchProto mSnippetMatch;
    private final AppSearch.Document mDocument;
    private final AppSearchDocument mDocument;
    /**
     * List of content with same property path in a document when there are multiple matches in
     * repeated sections.
@@ -79,7 +79,7 @@ public final class MatchInfo {

    /** @hide */
    public MatchInfo(@NonNull String propertyPath, @NonNull SnippetMatchProto snippetMatch,
            @NonNull AppSearch.Document document) {
            @NonNull AppSearchDocument document) {
        mPropertyPath = propertyPath;
        mSnippetMatch = snippetMatch;
        mDocument = document;
Loading