Merge "Remove deprecated, hidden versions of changed public APIs." into sc-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
c630f87976
@@ -57,12 +57,8 @@ java_sdk_library {
|
|||||||
// This list must be kept in sync with jarjar.txt
|
// This list must be kept in sync with jarjar.txt
|
||||||
"modules-utils-preconditions",
|
"modules-utils-preconditions",
|
||||||
],
|
],
|
||||||
libs: ["unsupportedappusage"], // TODO(b/181887768) should be removed
|
|
||||||
defaults: ["framework-module-defaults"],
|
defaults: ["framework-module-defaults"],
|
||||||
permitted_packages: ["android.app.appsearch"],
|
permitted_packages: ["android.app.appsearch"],
|
||||||
aidl: {
|
|
||||||
include_dirs: ["frameworks/base/core/java"], // TODO(b/146218515) should be removed
|
|
||||||
},
|
|
||||||
jarjar_rules: "jarjar-rules.txt",
|
jarjar_rules: "jarjar-rules.txt",
|
||||||
apex_available: ["com.android.appsearch"],
|
apex_available: ["com.android.appsearch"],
|
||||||
impl_library_visibility: [
|
impl_library_visibility: [
|
||||||
|
|||||||
@@ -25,7 +25,6 @@ import android.app.appsearch.aidl.IAppSearchManager;
|
|||||||
import android.app.appsearch.aidl.IAppSearchResultCallback;
|
import android.app.appsearch.aidl.IAppSearchResultCallback;
|
||||||
import android.app.appsearch.exceptions.AppSearchException;
|
import android.app.appsearch.exceptions.AppSearchException;
|
||||||
import android.app.appsearch.util.SchemaMigrationUtil;
|
import android.app.appsearch.util.SchemaMigrationUtil;
|
||||||
import android.compat.annotation.UnsupportedAppUsage;
|
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.os.RemoteException;
|
import android.os.RemoteException;
|
||||||
import android.os.SystemClock;
|
import android.os.SystemClock;
|
||||||
@@ -308,19 +307,6 @@ public final class AppSearchSession implements Closeable {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated TODO(b/181887768): Exists for dogfood transition; must be removed.
|
|
||||||
* @hide
|
|
||||||
*/
|
|
||||||
@Deprecated
|
|
||||||
@UnsupportedAppUsage
|
|
||||||
public void getByUri(
|
|
||||||
@NonNull GetByUriRequest request,
|
|
||||||
@NonNull @CallbackExecutor Executor executor,
|
|
||||||
@NonNull BatchResultCallback<String, GenericDocument> callback) {
|
|
||||||
getByDocumentId(request.toGetByDocumentIdRequest(), executor, callback);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets {@link GenericDocument} objects by document IDs in a namespace from the {@link
|
* Gets {@link GenericDocument} objects by document IDs in a namespace from the {@link
|
||||||
* AppSearchSession} database.
|
* AppSearchSession} database.
|
||||||
@@ -520,19 +506,6 @@ public final class AppSearchSession implements Closeable {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated TODO(b/181887768): Exists for dogfood transition; must be removed.
|
|
||||||
* @hide
|
|
||||||
*/
|
|
||||||
@Deprecated
|
|
||||||
@UnsupportedAppUsage
|
|
||||||
public void remove(
|
|
||||||
@NonNull RemoveByUriRequest request,
|
|
||||||
@NonNull @CallbackExecutor Executor executor,
|
|
||||||
@NonNull BatchResultCallback<String, Void> callback) {
|
|
||||||
remove(request.toRemoveByDocumentIdRequest(), executor, callback);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Removes {@link GenericDocument} objects by document IDs in a namespace from the {@link
|
* Removes {@link GenericDocument} objects by document IDs in a namespace from the {@link
|
||||||
* AppSearchSession} database.
|
* AppSearchSession} database.
|
||||||
|
|||||||
@@ -22,7 +22,6 @@ import android.annotation.Nullable;
|
|||||||
import android.app.appsearch.exceptions.IllegalSchemaException;
|
import android.app.appsearch.exceptions.IllegalSchemaException;
|
||||||
import android.app.appsearch.util.BundleUtil;
|
import android.app.appsearch.util.BundleUtil;
|
||||||
import android.app.appsearch.util.IndentingStringBuilder;
|
import android.app.appsearch.util.IndentingStringBuilder;
|
||||||
import android.compat.annotation.UnsupportedAppUsage;
|
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.util.ArraySet;
|
import android.util.ArraySet;
|
||||||
|
|
||||||
@@ -643,60 +642,8 @@ public final class AppSearchSchema {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated TODO(b/181887768): Exists for dogfood transition; must be removed.
|
|
||||||
* @hide
|
|
||||||
*/
|
|
||||||
@Deprecated
|
|
||||||
public static class Int64PropertyConfig extends PropertyConfig {
|
|
||||||
@UnsupportedAppUsage
|
|
||||||
Int64PropertyConfig(@NonNull Bundle bundle) {
|
|
||||||
super(bundle);
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Builder for {@link Int64PropertyConfig}. */
|
|
||||||
public static final class Builder {
|
|
||||||
private final String mPropertyName;
|
|
||||||
private @Cardinality int mCardinality = CARDINALITY_OPTIONAL;
|
|
||||||
|
|
||||||
/** Creates a new {@link Int64PropertyConfig.Builder}. */
|
|
||||||
@UnsupportedAppUsage
|
|
||||||
public Builder(@NonNull String propertyName) {
|
|
||||||
mPropertyName = Objects.requireNonNull(propertyName);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The cardinality of the property (whether it is optional, required or repeated).
|
|
||||||
*
|
|
||||||
* <p>If this method is not called, the default cardinality is {@link
|
|
||||||
* PropertyConfig#CARDINALITY_OPTIONAL}.
|
|
||||||
*/
|
|
||||||
@SuppressWarnings("MissingGetterMatchingBuilder") // getter defined in superclass
|
|
||||||
@NonNull
|
|
||||||
@UnsupportedAppUsage
|
|
||||||
public Int64PropertyConfig.Builder setCardinality(@Cardinality int cardinality) {
|
|
||||||
Preconditions.checkArgumentInRange(
|
|
||||||
cardinality, CARDINALITY_REPEATED, CARDINALITY_REQUIRED, "cardinality");
|
|
||||||
mCardinality = cardinality;
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Constructs a new {@link Int64PropertyConfig} from the contents of this builder. */
|
|
||||||
@NonNull
|
|
||||||
@UnsupportedAppUsage
|
|
||||||
public Int64PropertyConfig build() {
|
|
||||||
Bundle bundle = new Bundle();
|
|
||||||
bundle.putString(NAME_FIELD, mPropertyName);
|
|
||||||
bundle.putInt(DATA_TYPE_FIELD, DATA_TYPE_LONG);
|
|
||||||
bundle.putInt(CARDINALITY_FIELD, mCardinality);
|
|
||||||
return new Int64PropertyConfig(bundle);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Configuration for a property containing a 64-bit integer. */
|
/** Configuration for a property containing a 64-bit integer. */
|
||||||
// TODO(b/181887768): This should extend directly from PropertyConfig
|
public static final class LongPropertyConfig extends PropertyConfig {
|
||||||
public static final class LongPropertyConfig extends Int64PropertyConfig {
|
|
||||||
LongPropertyConfig(@NonNull Bundle bundle) {
|
LongPropertyConfig(@NonNull Bundle bundle) {
|
||||||
super(bundle);
|
super(bundle);
|
||||||
}
|
}
|
||||||
@@ -896,8 +843,7 @@ public final class AppSearchSchema {
|
|||||||
/** Builder for {@link DocumentPropertyConfig}. */
|
/** Builder for {@link DocumentPropertyConfig}. */
|
||||||
public static final class Builder {
|
public static final class Builder {
|
||||||
private final String mPropertyName;
|
private final String mPropertyName;
|
||||||
// TODO(b/181887768): This should be final
|
private final String mSchemaType;
|
||||||
private String mSchemaType;
|
|
||||||
private @Cardinality int mCardinality = CARDINALITY_OPTIONAL;
|
private @Cardinality int mCardinality = CARDINALITY_OPTIONAL;
|
||||||
private boolean mShouldIndexNestedProperties = false;
|
private boolean mShouldIndexNestedProperties = false;
|
||||||
|
|
||||||
@@ -915,29 +861,6 @@ public final class AppSearchSchema {
|
|||||||
mSchemaType = Objects.requireNonNull(schemaType);
|
mSchemaType = Objects.requireNonNull(schemaType);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated TODO(b/181887768): Exists for dogfood transition; must be removed.
|
|
||||||
* @hide
|
|
||||||
*/
|
|
||||||
@Deprecated
|
|
||||||
@UnsupportedAppUsage
|
|
||||||
public Builder(@NonNull String propertyName) {
|
|
||||||
mPropertyName = Objects.requireNonNull(propertyName);
|
|
||||||
mSchemaType = null;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated TODO(b/181887768): Exists for dogfood transition; must be removed.
|
|
||||||
* @hide
|
|
||||||
*/
|
|
||||||
@Deprecated
|
|
||||||
@UnsupportedAppUsage
|
|
||||||
@NonNull
|
|
||||||
public Builder setSchemaType(@NonNull String schemaType) {
|
|
||||||
mSchemaType = Objects.requireNonNull(schemaType);
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The cardinality of the property (whether it is optional, required or repeated).
|
* The cardinality of the property (whether it is optional, required or repeated).
|
||||||
*
|
*
|
||||||
@@ -967,18 +890,6 @@ public final class AppSearchSchema {
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated TODO(b/181887768): Exists for dogfood transition; must be removed.
|
|
||||||
* @hide
|
|
||||||
*/
|
|
||||||
@Deprecated
|
|
||||||
@UnsupportedAppUsage
|
|
||||||
@NonNull
|
|
||||||
public DocumentPropertyConfig.Builder setIndexNestedProperties(
|
|
||||||
boolean indexNestedProperties) {
|
|
||||||
return setShouldIndexNestedProperties(indexNestedProperties);
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Constructs a new {@link PropertyConfig} from the contents of this builder. */
|
/** Constructs a new {@link PropertyConfig} from the contents of this builder. */
|
||||||
@NonNull
|
@NonNull
|
||||||
public DocumentPropertyConfig build() {
|
public DocumentPropertyConfig build() {
|
||||||
@@ -987,9 +898,7 @@ public final class AppSearchSchema {
|
|||||||
bundle.putInt(DATA_TYPE_FIELD, DATA_TYPE_DOCUMENT);
|
bundle.putInt(DATA_TYPE_FIELD, DATA_TYPE_DOCUMENT);
|
||||||
bundle.putInt(CARDINALITY_FIELD, mCardinality);
|
bundle.putInt(CARDINALITY_FIELD, mCardinality);
|
||||||
bundle.putBoolean(INDEX_NESTED_PROPERTIES_FIELD, mShouldIndexNestedProperties);
|
bundle.putBoolean(INDEX_NESTED_PROPERTIES_FIELD, mShouldIndexNestedProperties);
|
||||||
// TODO(b/181887768): Remove checkNotNull after the deprecated constructor (which
|
bundle.putString(SCHEMA_TYPE_FIELD, mSchemaType);
|
||||||
// is the only way to get null here) is removed
|
|
||||||
bundle.putString(SCHEMA_TYPE_FIELD, Objects.requireNonNull(mSchemaType));
|
|
||||||
return new DocumentPropertyConfig(bundle);
|
return new DocumentPropertyConfig(bundle);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -23,7 +23,6 @@ import android.annotation.Nullable;
|
|||||||
import android.annotation.SuppressLint;
|
import android.annotation.SuppressLint;
|
||||||
import android.app.appsearch.util.BundleUtil;
|
import android.app.appsearch.util.BundleUtil;
|
||||||
import android.app.appsearch.util.IndentingStringBuilder;
|
import android.app.appsearch.util.IndentingStringBuilder;
|
||||||
import android.compat.annotation.UnsupportedAppUsage;
|
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.os.Parcelable;
|
import android.os.Parcelable;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
@@ -131,17 +130,6 @@ public class GenericDocument {
|
|||||||
return mBundle;
|
return mBundle;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated TODO(b/181887768): Exists for dogfood transition; must be removed.
|
|
||||||
* @hide
|
|
||||||
*/
|
|
||||||
@Deprecated
|
|
||||||
@UnsupportedAppUsage
|
|
||||||
@NonNull
|
|
||||||
public String getUri() {
|
|
||||||
return getId();
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Returns the unique identifier of the {@link GenericDocument}. */
|
/** Returns the unique identifier of the {@link GenericDocument}. */
|
||||||
@NonNull
|
@NonNull
|
||||||
public String getId() {
|
public String getId() {
|
||||||
|
|||||||
@@ -1,200 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright 2020 The Android Open Source Project
|
|
||||||
*
|
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
* you may not use this file except in compliance with the License.
|
|
||||||
* You may obtain a copy of the License at
|
|
||||||
*
|
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
*
|
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
* See the License for the specific language governing permissions and
|
|
||||||
* limitations under the License.
|
|
||||||
*/
|
|
||||||
|
|
||||||
package android.app.appsearch;
|
|
||||||
|
|
||||||
import android.annotation.NonNull;
|
|
||||||
import android.compat.annotation.UnsupportedAppUsage;
|
|
||||||
import android.util.ArrayMap;
|
|
||||||
import android.util.ArraySet;
|
|
||||||
|
|
||||||
import com.android.internal.util.Preconditions;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.Collection;
|
|
||||||
import java.util.Collections;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.Objects;
|
|
||||||
import java.util.Set;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated TODO(b/181887768): Exists for dogfood transition; must be removed.
|
|
||||||
* @hide
|
|
||||||
*/
|
|
||||||
@Deprecated
|
|
||||||
public final class GetByUriRequest {
|
|
||||||
/**
|
|
||||||
* Schema type to be used in {@link GetByUriRequest.Builder#addProjection} to apply property
|
|
||||||
* paths to all results, excepting any types that have had their own, specific property paths
|
|
||||||
* set.
|
|
||||||
*/
|
|
||||||
public static final String PROJECTION_SCHEMA_TYPE_WILDCARD = "*";
|
|
||||||
|
|
||||||
private final String mNamespace;
|
|
||||||
private final Set<String> mIds;
|
|
||||||
private final Map<String, List<String>> mTypePropertyPathsMap;
|
|
||||||
|
|
||||||
GetByUriRequest(
|
|
||||||
@NonNull String namespace,
|
|
||||||
@NonNull Set<String> ids,
|
|
||||||
@NonNull Map<String, List<String>> typePropertyPathsMap) {
|
|
||||||
mNamespace = Objects.requireNonNull(namespace);
|
|
||||||
mIds = Objects.requireNonNull(ids);
|
|
||||||
mTypePropertyPathsMap = Objects.requireNonNull(typePropertyPathsMap);
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Returns the namespace attached to the request. */
|
|
||||||
@NonNull
|
|
||||||
public String getNamespace() {
|
|
||||||
return mNamespace;
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Returns the set of document IDs attached to the request. */
|
|
||||||
@NonNull
|
|
||||||
public Set<String> getUris() {
|
|
||||||
return Collections.unmodifiableSet(mIds);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns a map from schema type to property paths to be used for projection.
|
|
||||||
*
|
|
||||||
* <p>If the map is empty, then all properties will be retrieved for all results.
|
|
||||||
*
|
|
||||||
* <p>Calling this function repeatedly is inefficient. Prefer to retain the Map returned by this
|
|
||||||
* function, rather than calling it multiple times.
|
|
||||||
*/
|
|
||||||
@NonNull
|
|
||||||
public Map<String, List<String>> getProjections() {
|
|
||||||
Map<String, List<String>> copy = new ArrayMap<>();
|
|
||||||
for (Map.Entry<String, List<String>> entry : mTypePropertyPathsMap.entrySet()) {
|
|
||||||
copy.put(entry.getKey(), new ArrayList<>(entry.getValue()));
|
|
||||||
}
|
|
||||||
return copy;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns a map from schema type to property paths to be used for projection.
|
|
||||||
*
|
|
||||||
* <p>If the map is empty, then all properties will be retrieved for all results.
|
|
||||||
*
|
|
||||||
* <p>A more efficient version of {@link #getProjections}, but it returns a modifiable map. This
|
|
||||||
* is not meant to be unhidden and should only be used by internal classes.
|
|
||||||
*
|
|
||||||
* @hide
|
|
||||||
*/
|
|
||||||
@NonNull
|
|
||||||
public Map<String, List<String>> getProjectionsInternal() {
|
|
||||||
return mTypePropertyPathsMap;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated TODO(b/181887768): Exists for dogfood transition; must be removed.
|
|
||||||
* @hide
|
|
||||||
*/
|
|
||||||
@Deprecated
|
|
||||||
@NonNull
|
|
||||||
public GetByDocumentIdRequest toGetByDocumentIdRequest() {
|
|
||||||
GetByDocumentIdRequest.Builder builder =
|
|
||||||
new GetByDocumentIdRequest.Builder(mNamespace).addIds(mIds);
|
|
||||||
for (Map.Entry<String, List<String>> projection : mTypePropertyPathsMap.entrySet()) {
|
|
||||||
builder.addProjection(projection.getKey(), projection.getValue());
|
|
||||||
}
|
|
||||||
return builder.build();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Builder for {@link GetByUriRequest} objects.
|
|
||||||
*
|
|
||||||
* <p>Once {@link #build} is called, the instance can no longer be used.
|
|
||||||
*/
|
|
||||||
public static final class Builder {
|
|
||||||
private final String mNamespace;
|
|
||||||
private final Set<String> mIds = new ArraySet<>();
|
|
||||||
private final Map<String, List<String>> mProjectionTypePropertyPaths = new ArrayMap<>();
|
|
||||||
private boolean mBuilt = false;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated TODO(b/181887768): Exists for dogfood transition; must be removed.
|
|
||||||
* @hide
|
|
||||||
*/
|
|
||||||
@Deprecated
|
|
||||||
@UnsupportedAppUsage
|
|
||||||
public Builder(@NonNull String namespace) {
|
|
||||||
mNamespace = Objects.requireNonNull(namespace);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Adds one or more document IDs to the request.
|
|
||||||
*
|
|
||||||
* @throws IllegalStateException if the builder has already been used.
|
|
||||||
*/
|
|
||||||
@NonNull
|
|
||||||
public Builder addUris(@NonNull String... ids) {
|
|
||||||
Objects.requireNonNull(ids);
|
|
||||||
return addUris(Arrays.asList(ids));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated TODO(b/181887768): Exists for dogfood transition; must be removed.
|
|
||||||
* @hide
|
|
||||||
*/
|
|
||||||
@Deprecated
|
|
||||||
@UnsupportedAppUsage
|
|
||||||
@NonNull
|
|
||||||
public Builder addUris(@NonNull Collection<String> ids) {
|
|
||||||
Preconditions.checkState(!mBuilt, "Builder has already been used");
|
|
||||||
Objects.requireNonNull(ids);
|
|
||||||
mIds.addAll(ids);
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated TODO(b/181887768): Exists for dogfood transition; must be removed.
|
|
||||||
* @hide
|
|
||||||
*/
|
|
||||||
@Deprecated
|
|
||||||
@UnsupportedAppUsage
|
|
||||||
@NonNull
|
|
||||||
public Builder addProjection(
|
|
||||||
@NonNull String schemaType, @NonNull Collection<String> propertyPaths) {
|
|
||||||
Preconditions.checkState(!mBuilt, "Builder has already been used");
|
|
||||||
Objects.requireNonNull(schemaType);
|
|
||||||
Objects.requireNonNull(propertyPaths);
|
|
||||||
List<String> propertyPathsList = new ArrayList<>(propertyPaths.size());
|
|
||||||
for (String propertyPath : propertyPaths) {
|
|
||||||
Objects.requireNonNull(propertyPath);
|
|
||||||
propertyPathsList.add(propertyPath);
|
|
||||||
}
|
|
||||||
mProjectionTypePropertyPaths.put(schemaType, propertyPathsList);
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated TODO(b/181887768): Exists for dogfood transition; must be removed.
|
|
||||||
* @hide
|
|
||||||
*/
|
|
||||||
@Deprecated
|
|
||||||
@UnsupportedAppUsage
|
|
||||||
@NonNull
|
|
||||||
public GetByUriRequest build() {
|
|
||||||
Preconditions.checkState(!mBuilt, "Builder has already been used");
|
|
||||||
mBuilt = true;
|
|
||||||
return new GetByUriRequest(mNamespace, mIds, mProjectionTypePropertyPaths);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,125 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright 2020 The Android Open Source Project
|
|
||||||
*
|
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
* you may not use this file except in compliance with the License.
|
|
||||||
* You may obtain a copy of the License at
|
|
||||||
*
|
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
*
|
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
* See the License for the specific language governing permissions and
|
|
||||||
* limitations under the License.
|
|
||||||
*/
|
|
||||||
|
|
||||||
package android.app.appsearch;
|
|
||||||
|
|
||||||
import android.annotation.NonNull;
|
|
||||||
import android.compat.annotation.UnsupportedAppUsage;
|
|
||||||
import android.util.ArraySet;
|
|
||||||
|
|
||||||
import com.android.internal.util.Preconditions;
|
|
||||||
|
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.Collection;
|
|
||||||
import java.util.Collections;
|
|
||||||
import java.util.Objects;
|
|
||||||
import java.util.Set;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated TODO(b/181887768): Exists for dogfood transition; must be removed.
|
|
||||||
* @hide
|
|
||||||
*/
|
|
||||||
@Deprecated
|
|
||||||
public final class RemoveByUriRequest {
|
|
||||||
private final String mNamespace;
|
|
||||||
private final Set<String> mIds;
|
|
||||||
|
|
||||||
RemoveByUriRequest(String namespace, Set<String> ids) {
|
|
||||||
mNamespace = namespace;
|
|
||||||
mIds = ids;
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Returns the namespace to remove documents from. */
|
|
||||||
@NonNull
|
|
||||||
public String getNamespace() {
|
|
||||||
return mNamespace;
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Returns the set of document IDs attached to the request. */
|
|
||||||
@NonNull
|
|
||||||
public Set<String> getUris() {
|
|
||||||
return Collections.unmodifiableSet(mIds);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated TODO(b/181887768): Exists for dogfood transition; must be removed.
|
|
||||||
* @hide
|
|
||||||
*/
|
|
||||||
@Deprecated
|
|
||||||
@NonNull
|
|
||||||
public RemoveByDocumentIdRequest toRemoveByDocumentIdRequest() {
|
|
||||||
return new RemoveByDocumentIdRequest.Builder(mNamespace).addIds(mIds).build();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Builder for {@link RemoveByUriRequest} objects.
|
|
||||||
*
|
|
||||||
* <p>Once {@link #build} is called, the instance can no longer be used.
|
|
||||||
*/
|
|
||||||
public static final class Builder {
|
|
||||||
private final String mNamespace;
|
|
||||||
private final Set<String> mIds = new ArraySet<>();
|
|
||||||
private boolean mBuilt = false;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated TODO(b/181887768): Exists for dogfood transition; must be removed.
|
|
||||||
* @hide
|
|
||||||
*/
|
|
||||||
@Deprecated
|
|
||||||
@UnsupportedAppUsage
|
|
||||||
public Builder(@NonNull String namespace) {
|
|
||||||
mNamespace = Objects.requireNonNull(namespace);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Adds one or more document IDs to the request.
|
|
||||||
*
|
|
||||||
* @throws IllegalStateException if the builder has already been used.
|
|
||||||
*/
|
|
||||||
@NonNull
|
|
||||||
public Builder addUris(@NonNull String... ids) {
|
|
||||||
Objects.requireNonNull(ids);
|
|
||||||
return addUris(Arrays.asList(ids));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated TODO(b/181887768): Exists for dogfood transition; must be removed.
|
|
||||||
* @hide
|
|
||||||
*/
|
|
||||||
@Deprecated
|
|
||||||
@UnsupportedAppUsage
|
|
||||||
@NonNull
|
|
||||||
public Builder addUris(@NonNull Collection<String> ids) {
|
|
||||||
Preconditions.checkState(!mBuilt, "Builder has already been used");
|
|
||||||
Objects.requireNonNull(ids);
|
|
||||||
mIds.addAll(ids);
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated TODO(b/181887768): Exists for dogfood transition; must be removed.
|
|
||||||
* @hide
|
|
||||||
*/
|
|
||||||
@Deprecated
|
|
||||||
@UnsupportedAppUsage
|
|
||||||
@NonNull
|
|
||||||
public RemoveByUriRequest build() {
|
|
||||||
Preconditions.checkState(!mBuilt, "Builder has already been used");
|
|
||||||
mBuilt = true;
|
|
||||||
return new RemoveByUriRequest(mNamespace, mIds);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -18,7 +18,6 @@ package android.app.appsearch;
|
|||||||
|
|
||||||
import android.annotation.CurrentTimeMillisLong;
|
import android.annotation.CurrentTimeMillisLong;
|
||||||
import android.annotation.NonNull;
|
import android.annotation.NonNull;
|
||||||
import android.compat.annotation.UnsupportedAppUsage;
|
|
||||||
|
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
|
|
||||||
@@ -67,8 +66,7 @@ public final class ReportUsageRequest {
|
|||||||
/** Builder for {@link ReportUsageRequest} objects. */
|
/** Builder for {@link ReportUsageRequest} objects. */
|
||||||
public static final class Builder {
|
public static final class Builder {
|
||||||
private final String mNamespace;
|
private final String mNamespace;
|
||||||
// TODO(b/181887768): Make this final
|
private final String mDocumentId;
|
||||||
private String mDocumentId;
|
|
||||||
private Long mUsageTimestampMillis;
|
private Long mUsageTimestampMillis;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -84,40 +82,6 @@ public final class ReportUsageRequest {
|
|||||||
mDocumentId = Objects.requireNonNull(documentId);
|
mDocumentId = Objects.requireNonNull(documentId);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated TODO(b/181887768): Exists for dogfood transition; must be removed.
|
|
||||||
* @hide
|
|
||||||
*/
|
|
||||||
@Deprecated
|
|
||||||
@UnsupportedAppUsage
|
|
||||||
public Builder(@NonNull String namespace) {
|
|
||||||
mNamespace = Objects.requireNonNull(namespace);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated TODO(b/181887768): Exists for dogfood transition; must be removed.
|
|
||||||
* @hide
|
|
||||||
*/
|
|
||||||
@Deprecated
|
|
||||||
@UnsupportedAppUsage
|
|
||||||
@NonNull
|
|
||||||
public Builder setUri(@NonNull String uri) {
|
|
||||||
mDocumentId = uri;
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated TODO(b/181887768): Exists for dogfood transition; must be removed.
|
|
||||||
* @hide
|
|
||||||
*/
|
|
||||||
@Deprecated
|
|
||||||
@UnsupportedAppUsage
|
|
||||||
@NonNull
|
|
||||||
public ReportUsageRequest.Builder setUsageTimeMillis(
|
|
||||||
@CurrentTimeMillisLong long usageTimestampMillis) {
|
|
||||||
return setUsageTimestampMillis(usageTimestampMillis);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the timestamp in milliseconds of the usage report (the time at which the document
|
* Sets the timestamp in milliseconds of the usage report (the time at which the document
|
||||||
* was used).
|
* was used).
|
||||||
|
|||||||
@@ -18,7 +18,6 @@ package android.app.appsearch;
|
|||||||
|
|
||||||
import android.annotation.NonNull;
|
import android.annotation.NonNull;
|
||||||
import android.annotation.Nullable;
|
import android.annotation.Nullable;
|
||||||
import android.compat.annotation.UnsupportedAppUsage;
|
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
|
|
||||||
import com.android.internal.util.Preconditions;
|
import com.android.internal.util.Preconditions;
|
||||||
@@ -83,17 +82,6 @@ public final class SearchResult {
|
|||||||
return mDocument;
|
return mDocument;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated TODO(b/181887768): Exists for dogfood transition; must be removed.
|
|
||||||
* @hide
|
|
||||||
*/
|
|
||||||
@Deprecated
|
|
||||||
@UnsupportedAppUsage
|
|
||||||
@NonNull
|
|
||||||
public List<MatchInfo> getMatches() {
|
|
||||||
return getMatchInfos();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns a list of {@link MatchInfo}s providing information about how the document in {@link
|
* Returns a list of {@link MatchInfo}s providing information about how the document in {@link
|
||||||
* #getGenericDocument} matched the query.
|
* #getGenericDocument} matched the query.
|
||||||
@@ -196,17 +184,6 @@ public final class SearchResult {
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated TODO(b/181887768): Exists for dogfood transition; must be removed.
|
|
||||||
* @hide
|
|
||||||
*/
|
|
||||||
@Deprecated
|
|
||||||
@UnsupportedAppUsage
|
|
||||||
@NonNull
|
|
||||||
public Builder addMatch(@NonNull MatchInfo matchInfo) {
|
|
||||||
return addMatchInfo(matchInfo);
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Adds another match to this SearchResult. */
|
/** Adds another match to this SearchResult. */
|
||||||
@NonNull
|
@NonNull
|
||||||
public Builder addMatchInfo(@NonNull MatchInfo matchInfo) {
|
public Builder addMatchInfo(@NonNull MatchInfo matchInfo) {
|
||||||
|
|||||||
@@ -18,7 +18,6 @@ package android.app.appsearch;
|
|||||||
|
|
||||||
import android.annotation.NonNull;
|
import android.annotation.NonNull;
|
||||||
import android.annotation.Nullable;
|
import android.annotation.Nullable;
|
||||||
import android.compat.annotation.UnsupportedAppUsage;
|
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.util.ArraySet;
|
import android.util.ArraySet;
|
||||||
|
|
||||||
@@ -342,17 +341,6 @@ public class SetSchemaResponse {
|
|||||||
return mBundle.getString(NAMESPACE_FIELD, /*defaultValue=*/ "");
|
return mBundle.getString(NAMESPACE_FIELD, /*defaultValue=*/ "");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated TODO(b/181887768): Exists for dogfood transition; must be removed.
|
|
||||||
* @hide
|
|
||||||
*/
|
|
||||||
@Deprecated
|
|
||||||
@UnsupportedAppUsage
|
|
||||||
@NonNull
|
|
||||||
public String getUri() {
|
|
||||||
return getDocumentId();
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Returns the id of the {@link GenericDocument} that failed to be migrated. */
|
/** Returns the id of the {@link GenericDocument} that failed to be migrated. */
|
||||||
@NonNull
|
@NonNull
|
||||||
public String getDocumentId() {
|
public String getDocumentId() {
|
||||||
|
|||||||
@@ -52,7 +52,6 @@ java_library {
|
|||||||
libs: [
|
libs: [
|
||||||
"framework-appsearch.impl",
|
"framework-appsearch.impl",
|
||||||
"framework-statsd.stubs.module_lib",
|
"framework-statsd.stubs.module_lib",
|
||||||
"unsupportedappusage", // TODO(b/181887768) should be removed
|
|
||||||
],
|
],
|
||||||
defaults: ["framework-system-server-module-defaults"],
|
defaults: ["framework-system-server-module-defaults"],
|
||||||
permitted_packages: [
|
permitted_packages: [
|
||||||
|
|||||||
Reference in New Issue
Block a user