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

Commit a20963b2 authored by android-build-team Robot's avatar android-build-team Robot
Browse files

Snap for 7290612 from eef5f6d4 to sc-release

Change-Id: I494b1594d5b02df503f4a4ca763371522fde92df
parents 3669777d eef5f6d4
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -22,7 +22,7 @@ checkstyle_hook = ${REPO_ROOT}/prebuilts/checkstyle/checkstyle.py --sha ${PREUPL

strings_lint_hook = ${REPO_ROOT}/frameworks/base/tools/stringslint/stringslint_sha.sh ${PREUPLOAD_COMMIT}

hidden_api_txt_checksorted_hook = ${REPO_ROOT}/frameworks/base/tools/hiddenapi/checksorted_sha.sh ${PREUPLOAD_COMMIT} ${REPO_ROOT}
hidden_api_txt_checksorted_hook = ${REPO_ROOT}/tools/platform-compat/hiddenapi/checksorted_sha.sh ${PREUPLOAD_COMMIT} ${REPO_ROOT}

hidden_api_txt_exclude_hook = ${REPO_ROOT}/frameworks/base/tools/hiddenapi/exclude.sh ${PREUPLOAD_COMMIT} ${REPO_ROOT}

+9 −0
Original line number Diff line number Diff line
@@ -96,6 +96,8 @@ stubs_defaults {
    ],
    api_levels_annotations_enabled: false,
    filter_packages: packages_to_document,
    defaults_visibility: ["//visibility:private"],
    visibility: ["//frameworks/base/api"],
}

/////////////////////////////////////////////////////////////////////
@@ -352,6 +354,8 @@ java_defaults {
        tag: ".jar",
        dest: "android-non-updatable.jar",
    },
    defaults_visibility: ["//visibility:private"],
    visibility: ["//visibility:private"],
}

java_library_static {
@@ -405,6 +409,8 @@ java_defaults {
    system_modules: "none",
    java_version: "1.8",
    compile_dex: true,
    defaults_visibility: ["//visibility:private"],
    visibility: ["//visibility:public"],
}

java_defaults {
@@ -417,6 +423,7 @@ java_defaults {
        tag: ".jar",
        dest: "android.jar",
    },
    defaults_visibility: ["//frameworks/base/services"],
}

java_library_static {
@@ -516,6 +523,7 @@ droidstubs {
        "metalava-manual",
    ],
    args: priv_apps,
    visibility: ["//visibility:private"],
}

java_library_static {
@@ -525,4 +533,5 @@ java_library_static {
    srcs: [
        ":hwbinder-stubs-docs",
    ],
    visibility: ["//visibility:public"],
}
+5 −4
Original line number Diff line number Diff line
@@ -26,6 +26,7 @@ import com.android.internal.util.Preconditions;

import java.util.Collections;
import java.util.Map;
import java.util.Objects;

/**
 * Provides results for AppSearch batch operations which encompass multiple documents.
@@ -180,7 +181,7 @@ public final class AppSearchBatchResult<KeyType, ValueType> implements Parcelabl
        public Builder<KeyType, ValueType> setSuccess(
                @NonNull KeyType key, @Nullable ValueType result) {
            Preconditions.checkState(!mBuilt, "Builder has already been used");
            Preconditions.checkNotNull(key);
            Objects.requireNonNull(key);
            return setResult(key, AppSearchResult.newSuccessfulResult(result));
        }

@@ -198,7 +199,7 @@ public final class AppSearchBatchResult<KeyType, ValueType> implements Parcelabl
                @AppSearchResult.ResultCode int resultCode,
                @Nullable String errorMessage) {
            Preconditions.checkState(!mBuilt, "Builder has already been used");
            Preconditions.checkNotNull(key);
            Objects.requireNonNull(key);
            return setResult(key, AppSearchResult.newFailedResult(resultCode, errorMessage));
        }

@@ -214,8 +215,8 @@ public final class AppSearchBatchResult<KeyType, ValueType> implements Parcelabl
        public Builder<KeyType, ValueType> setResult(
                @NonNull KeyType key, @NonNull AppSearchResult<ValueType> result) {
            Preconditions.checkState(!mBuilt, "Builder has already been used");
            Preconditions.checkNotNull(key);
            Preconditions.checkNotNull(result);
            Objects.requireNonNull(key);
            Objects.requireNonNull(result);
            if (result.isSuccess()) {
                mSuccesses.put(key, result.getResultValue());
                mFailures.remove(key);
+30 −7
Original line number Diff line number Diff line
@@ -19,9 +19,9 @@ package android.app.appsearch;
import android.annotation.CallbackExecutor;
import android.annotation.NonNull;
import android.annotation.UserIdInt;
import android.app.appsearch.exceptions.AppSearchException;
import android.app.appsearch.util.SchemaMigrationUtil;
import android.os.Bundle;
import android.os.ParcelableException;
import android.os.RemoteException;
import android.os.SystemClock;
import android.util.ArrayMap;
@@ -274,12 +274,14 @@ public final class AppSearchSession implements Closeable {
            mService.putDocuments(mPackageName, mDatabaseName, documentBundles, mUserId,
                    /*binderCallStartTimeMillis=*/ SystemClock.elapsedRealtime(),
                    new IAppSearchBatchResultCallback.Stub() {
                        @Override
                        public void onResult(AppSearchBatchResult result) {
                            executor.execute(() -> callback.onResult(result));
                        }

                        public void onSystemError(ParcelableException exception) {
                            executor.execute(() -> callback.onSystemError(exception.getCause()));
                        @Override
                        public void onSystemError(AppSearchResult result) {
                            executor.execute(() -> sendSystemErrorToCallback(result, callback));
                        }
                    });
            mIsMutated = true;
@@ -321,6 +323,7 @@ public final class AppSearchSession implements Closeable {
                    request.getProjectionsInternal(),
                    mUserId,
                    new IAppSearchBatchResultCallback.Stub() {
                        @Override
                        public void onResult(AppSearchBatchResult result) {
                            executor.execute(() -> {
                                AppSearchBatchResult.Builder<String, GenericDocument>
@@ -359,8 +362,9 @@ public final class AppSearchSession implements Closeable {
                            });
                        }

                        public void onSystemError(ParcelableException exception) {
                            executor.execute(() -> callback.onSystemError(exception.getCause()));
                        @Override
                        public void onSystemError(AppSearchResult result) {
                            executor.execute(() -> sendSystemErrorToCallback(result, callback));
                        }
                    });
        } catch (RemoteException e) {
@@ -515,12 +519,14 @@ public final class AppSearchSession implements Closeable {
            mService.removeByUri(mPackageName, mDatabaseName, request.getNamespace(),
                    new ArrayList<>(request.getUris()), mUserId,
                    new IAppSearchBatchResultCallback.Stub() {
                        @Override
                        public void onResult(AppSearchBatchResult result) {
                            executor.execute(() -> callback.onResult(result));
                        }

                        public void onSystemError(ParcelableException exception) {
                            executor.execute(() -> callback.onSystemError(exception.getCause()));
                        @Override
                        public void onSystemError(AppSearchResult result) {
                            executor.execute(() -> sendSystemErrorToCallback(result, callback));
                        }
                    });
            mIsMutated = true;
@@ -817,4 +823,21 @@ public final class AppSearchSession implements Closeable {
            }
        });
    }

    /**
     * Calls {@link BatchResultCallback#onSystemError} with a throwable derived from the given
     * failed {@link AppSearchResult}.
     *
     * <p>The {@link AppSearchResult} generally comes from
     * {@link IAppSearchBatchResultCallback#onSystemError}.
     *
     * <p>This method should be called from the callback executor thread.
     */
    private void sendSystemErrorToCallback(
            @NonNull AppSearchResult<?> failedResult, @NonNull BatchResultCallback<?, ?> callback) {
        Preconditions.checkArgument(!failedResult.isSuccess());
        Throwable throwable = new AppSearchException(
                failedResult.getResultCode(), failedResult.getErrorMessage());
        callback.onSystemError(throwable);
    }
}
+15 −5
Original line number Diff line number Diff line
@@ -36,13 +36,23 @@ public interface BatchResultCallback<KeyType, ValueType> {
    void onResult(@NonNull AppSearchBatchResult<KeyType, ValueType> result);

    /**
     * Called when a system error occurred.
     * Called when a system error occurs.
     *
     * @param throwable The cause throwable.
     * <p>This method is only called the infrastructure is fundamentally broken or unavailable, such
     * that none of the requests could be started. For example, it will be called if the AppSearch
     * service unexpectedly fails to initialize and can't be recovered by any means, or if
     * communicating to the server over Binder fails (e.g. system service crashed or device is
     * rebooting).
     *
     * <p>The error is not expected to be recoverable and there is no specific recommended action
     * other than displaying a permanent message to the user.
     *
     * <p>Normal errors that are caused by invalid inputs or recoverable/retriable situations
     * are reported associated with the input that caused them via the {@link #onResult} method.
     *
     * @param throwable an exception describing the system error
     */
    default void onSystemError(@Nullable Throwable throwable) {
        if (throwable != null) {
            throw new RuntimeException(throwable);
        }
        throw new RuntimeException("Unrecoverable system error", throwable);
    }
}
Loading