Loading apex/appsearch/framework/java/external/android/app/appsearch/GenericDocument.java +5 −30 Original line number Diff line number Diff line Loading @@ -50,9 +50,6 @@ import java.util.Set; public class GenericDocument { private static final String TAG = "AppSearchGenericDocumen"; /** The maximum number of elements in a repeatable field. */ private static final int MAX_REPEATED_PROPERTY_LENGTH = 100; /** The maximum {@link String#length} of a {@link String} field. */ private static final int MAX_STRING_LENGTH = 20_000; Loading Loading @@ -1187,8 +1184,8 @@ public class GenericDocument { * @param name the name associated with the {@code values}. Must match the name for this * property as given in {@link AppSearchSchema.PropertyConfig#getName}. * @param values the {@code String} values of the property. * @throws IllegalArgumentException if no values are provided, if provided values exceed * maximum repeated property length, or if a passed in {@code String} is {@code null}. * @throws IllegalArgumentException if no values are provided, or if a passed in {@code * String} is {@code null}. */ @NonNull public BuilderType setPropertyString(@NonNull String name, @NonNull String... values) { Loading @@ -1206,7 +1203,6 @@ public class GenericDocument { * @param name the name associated with the {@code values}. Must match the name for this * property as given in {@link AppSearchSchema.PropertyConfig#getName}. * @param values the {@code boolean} values of the property. * @throws IllegalArgumentException if values exceed maximum repeated property length. */ @NonNull public BuilderType setPropertyBoolean(@NonNull String name, @NonNull boolean... values) { Loading @@ -1223,7 +1219,6 @@ public class GenericDocument { * @param name the name associated with the {@code values}. Must match the name for this * property as given in {@link AppSearchSchema.PropertyConfig#getName}. * @param values the {@code long} values of the property. * @throws IllegalArgumentException if values exceed maximum repeated property length. */ @NonNull public BuilderType setPropertyLong(@NonNull String name, @NonNull long... values) { Loading @@ -1240,7 +1235,6 @@ public class GenericDocument { * @param name the name associated with the {@code values}. Must match the name for this * property as given in {@link AppSearchSchema.PropertyConfig#getName}. * @param values the {@code double} values of the property. * @throws IllegalArgumentException if values exceed maximum repeated property length. */ @NonNull public BuilderType setPropertyDouble(@NonNull String name, @NonNull double... values) { Loading @@ -1257,8 +1251,8 @@ public class GenericDocument { * @param name the name associated with the {@code values}. Must match the name for this * property as given in {@link AppSearchSchema.PropertyConfig#getName}. * @param values the {@code byte[]} of the property. * @throws IllegalArgumentException if no values are provided, if provided values exceed * maximum repeated property length, or if a passed in {@code byte[]} is {@code null}. * @throws IllegalArgumentException if no values are provided, or if a passed in {@code * byte[]} is {@code null}. */ @NonNull public BuilderType setPropertyBytes(@NonNull String name, @NonNull byte[]... values) { Loading @@ -1276,8 +1270,7 @@ public class GenericDocument { * @param name the name associated with the {@code values}. Must match the name for this * property as given in {@link AppSearchSchema.PropertyConfig#getName}. * @param values the {@link GenericDocument} values of the property. * @throws IllegalArgumentException if no values are provided, if provided values exceed if * provided values exceed maximum repeated property length, or if a passed in {@link * @throws IllegalArgumentException if no values are provided, or if a passed in {@link * GenericDocument} is {@code null}. */ @NonNull Loading Loading @@ -1308,7 +1301,6 @@ public class GenericDocument { private void putInPropertyBundle(@NonNull String name, @NonNull String[] values) throws IllegalArgumentException { validateRepeatedPropertyLength(name, values.length); for (int i = 0; i < values.length; i++) { if (values[i] == null) { throw new IllegalArgumentException("The String at " + i + " is null."); Loading @@ -1327,17 +1319,14 @@ public class GenericDocument { } private void putInPropertyBundle(@NonNull String name, @NonNull boolean[] values) { validateRepeatedPropertyLength(name, values.length); mProperties.putBooleanArray(name, values); } private void putInPropertyBundle(@NonNull String name, @NonNull double[] values) { validateRepeatedPropertyLength(name, values.length); mProperties.putDoubleArray(name, values); } private void putInPropertyBundle(@NonNull String name, @NonNull long[] values) { validateRepeatedPropertyLength(name, values.length); mProperties.putLongArray(name, values); } Loading @@ -1348,7 +1337,6 @@ public class GenericDocument { * into ArrayList<Bundle>, and each elements will contain a one dimension byte[]. */ private void putInPropertyBundle(@NonNull String name, @NonNull byte[][] values) { validateRepeatedPropertyLength(name, values.length); ArrayList<Bundle> bundles = new ArrayList<>(values.length); for (int i = 0; i < values.length; i++) { if (values[i] == null) { Loading @@ -1362,7 +1350,6 @@ public class GenericDocument { } private void putInPropertyBundle(@NonNull String name, @NonNull GenericDocument[] values) { validateRepeatedPropertyLength(name, values.length); Parcelable[] documentBundles = new Parcelable[values.length]; for (int i = 0; i < values.length; i++) { if (values[i] == null) { Loading @@ -1373,18 +1360,6 @@ public class GenericDocument { mProperties.putParcelableArray(name, documentBundles); } private static void validateRepeatedPropertyLength(@NonNull String name, int length) { if (length > MAX_REPEATED_PROPERTY_LENGTH) { throw new IllegalArgumentException( "Repeated property \"" + name + "\" has length " + length + ", which exceeds the limit of " + MAX_REPEATED_PROPERTY_LENGTH); } } /** Builds the {@link GenericDocument} object. */ @NonNull public GenericDocument build() { Loading apex/appsearch/framework/java/external/android/app/appsearch/SetSchemaRequest.java +9 −2 Original line number Diff line number Diff line Loading @@ -169,13 +169,14 @@ public final class SetSchemaRequest { /** Builder for {@link SetSchemaRequest} objects. */ public static final class Builder { private static final int DEFAULT_VERSION = 1; private ArraySet<AppSearchSchema> mSchemas = new ArraySet<>(); private ArraySet<String> mSchemasNotDisplayedBySystem = new ArraySet<>(); private ArrayMap<String, Set<PackageIdentifier>> mSchemasVisibleToPackages = new ArrayMap<>(); private ArrayMap<String, Migrator> mMigrators = new ArrayMap<>(); private boolean mForceOverride = false; private int mVersion = 1; private int mVersion = DEFAULT_VERSION; private boolean mBuilt = false; /** Loading Loading @@ -384,6 +385,9 @@ public final class SetSchemaRequest { * <p>The version number can stay the same, increase, or decrease relative to the current * version number that is already stored in the {@link AppSearchSession} database. * * <p>The version of an empty database will always be 0. You cannot set version to the * {@link SetSchemaRequest}, if it doesn't contains any {@link AppSearchSchema}. * * @param version A positive integer representing the version of the entire set of schemas * represents the version of the whole schema in the {@link AppSearchSession} database, * default version is 1. Loading Loading @@ -423,7 +427,10 @@ public final class SetSchemaRequest { throw new IllegalArgumentException( "Schema types " + referencedSchemas + " referenced, but were not added."); } if (mSchemas.isEmpty() && mVersion != DEFAULT_VERSION) { throw new IllegalArgumentException( "Cannot set version to the request if schema is empty."); } mBuilt = true; return new SetSchemaRequest( mSchemas, Loading apex/appsearch/service/java/com/android/server/appsearch/AppSearchManagerService.java +1 −1 Original line number Diff line number Diff line Loading @@ -60,8 +60,8 @@ import com.android.internal.annotations.GuardedBy; import com.android.server.LocalManagerRegistry; import com.android.server.SystemService; import com.android.server.appsearch.external.localstorage.stats.CallStats; import com.android.server.appsearch.external.localstorage.visibilitystore.VisibilityStore; import com.android.server.appsearch.util.PackageUtil; import com.android.server.appsearch.visibilitystore.VisibilityStore; import com.android.server.usage.StorageStatsManagerLocal; import com.android.server.usage.StorageStatsManagerLocal.StorageStatsAugmenter; Loading apex/appsearch/service/java/com/android/server/appsearch/AppSearchUserInstance.java +4 −4 Original line number Diff line number Diff line Loading @@ -19,7 +19,7 @@ import android.annotation.NonNull; import com.android.server.appsearch.external.localstorage.AppSearchImpl; import com.android.server.appsearch.stats.PlatformLogger; import com.android.server.appsearch.visibilitystore.VisibilityStore; import com.android.server.appsearch.visibilitystore.VisibilityStoreImpl; import java.util.Objects; Loading @@ -30,12 +30,12 @@ import java.util.Objects; public final class AppSearchUserInstance { private final PlatformLogger mLogger; private final AppSearchImpl mAppSearchImpl; private final VisibilityStore mVisibilityStore; private final VisibilityStoreImpl mVisibilityStore; AppSearchUserInstance( @NonNull PlatformLogger logger, @NonNull AppSearchImpl appSearchImpl, @NonNull VisibilityStore visibilityStore) { @NonNull VisibilityStoreImpl visibilityStore) { mLogger = Objects.requireNonNull(logger); mAppSearchImpl = Objects.requireNonNull(appSearchImpl); mVisibilityStore = Objects.requireNonNull(visibilityStore); Loading @@ -52,7 +52,7 @@ public final class AppSearchUserInstance { } @NonNull public VisibilityStore getVisibilityStore() { public VisibilityStoreImpl getVisibilityStore() { return mVisibilityStore; } } apex/appsearch/service/java/com/android/server/appsearch/AppSearchUserInstanceManager.java +3 −2 Original line number Diff line number Diff line Loading @@ -30,7 +30,7 @@ import com.android.server.appsearch.external.localstorage.AppSearchImpl; import com.android.server.appsearch.external.localstorage.FrameworkOptimizeStrategy; import com.android.server.appsearch.external.localstorage.stats.InitializeStats; import com.android.server.appsearch.stats.PlatformLogger; import com.android.server.appsearch.visibilitystore.VisibilityStore; import com.android.server.appsearch.visibilitystore.VisibilityStoreImpl; import java.io.File; import java.util.Map; Loading Loading @@ -178,7 +178,8 @@ public final class AppSearchUserInstanceManager { AppSearchImpl.create(icingDir, initStatsBuilder, new FrameworkOptimizeStrategy()); long prepareVisibilityStoreLatencyStartMillis = SystemClock.elapsedRealtime(); VisibilityStore visibilityStore = VisibilityStore.create(appSearchImpl, userContext); VisibilityStoreImpl visibilityStore = VisibilityStoreImpl.create(appSearchImpl, userContext); long prepareVisibilityStoreLatencyEndMillis = SystemClock.elapsedRealtime(); initStatsBuilder Loading Loading
apex/appsearch/framework/java/external/android/app/appsearch/GenericDocument.java +5 −30 Original line number Diff line number Diff line Loading @@ -50,9 +50,6 @@ import java.util.Set; public class GenericDocument { private static final String TAG = "AppSearchGenericDocumen"; /** The maximum number of elements in a repeatable field. */ private static final int MAX_REPEATED_PROPERTY_LENGTH = 100; /** The maximum {@link String#length} of a {@link String} field. */ private static final int MAX_STRING_LENGTH = 20_000; Loading Loading @@ -1187,8 +1184,8 @@ public class GenericDocument { * @param name the name associated with the {@code values}. Must match the name for this * property as given in {@link AppSearchSchema.PropertyConfig#getName}. * @param values the {@code String} values of the property. * @throws IllegalArgumentException if no values are provided, if provided values exceed * maximum repeated property length, or if a passed in {@code String} is {@code null}. * @throws IllegalArgumentException if no values are provided, or if a passed in {@code * String} is {@code null}. */ @NonNull public BuilderType setPropertyString(@NonNull String name, @NonNull String... values) { Loading @@ -1206,7 +1203,6 @@ public class GenericDocument { * @param name the name associated with the {@code values}. Must match the name for this * property as given in {@link AppSearchSchema.PropertyConfig#getName}. * @param values the {@code boolean} values of the property. * @throws IllegalArgumentException if values exceed maximum repeated property length. */ @NonNull public BuilderType setPropertyBoolean(@NonNull String name, @NonNull boolean... values) { Loading @@ -1223,7 +1219,6 @@ public class GenericDocument { * @param name the name associated with the {@code values}. Must match the name for this * property as given in {@link AppSearchSchema.PropertyConfig#getName}. * @param values the {@code long} values of the property. * @throws IllegalArgumentException if values exceed maximum repeated property length. */ @NonNull public BuilderType setPropertyLong(@NonNull String name, @NonNull long... values) { Loading @@ -1240,7 +1235,6 @@ public class GenericDocument { * @param name the name associated with the {@code values}. Must match the name for this * property as given in {@link AppSearchSchema.PropertyConfig#getName}. * @param values the {@code double} values of the property. * @throws IllegalArgumentException if values exceed maximum repeated property length. */ @NonNull public BuilderType setPropertyDouble(@NonNull String name, @NonNull double... values) { Loading @@ -1257,8 +1251,8 @@ public class GenericDocument { * @param name the name associated with the {@code values}. Must match the name for this * property as given in {@link AppSearchSchema.PropertyConfig#getName}. * @param values the {@code byte[]} of the property. * @throws IllegalArgumentException if no values are provided, if provided values exceed * maximum repeated property length, or if a passed in {@code byte[]} is {@code null}. * @throws IllegalArgumentException if no values are provided, or if a passed in {@code * byte[]} is {@code null}. */ @NonNull public BuilderType setPropertyBytes(@NonNull String name, @NonNull byte[]... values) { Loading @@ -1276,8 +1270,7 @@ public class GenericDocument { * @param name the name associated with the {@code values}. Must match the name for this * property as given in {@link AppSearchSchema.PropertyConfig#getName}. * @param values the {@link GenericDocument} values of the property. * @throws IllegalArgumentException if no values are provided, if provided values exceed if * provided values exceed maximum repeated property length, or if a passed in {@link * @throws IllegalArgumentException if no values are provided, or if a passed in {@link * GenericDocument} is {@code null}. */ @NonNull Loading Loading @@ -1308,7 +1301,6 @@ public class GenericDocument { private void putInPropertyBundle(@NonNull String name, @NonNull String[] values) throws IllegalArgumentException { validateRepeatedPropertyLength(name, values.length); for (int i = 0; i < values.length; i++) { if (values[i] == null) { throw new IllegalArgumentException("The String at " + i + " is null."); Loading @@ -1327,17 +1319,14 @@ public class GenericDocument { } private void putInPropertyBundle(@NonNull String name, @NonNull boolean[] values) { validateRepeatedPropertyLength(name, values.length); mProperties.putBooleanArray(name, values); } private void putInPropertyBundle(@NonNull String name, @NonNull double[] values) { validateRepeatedPropertyLength(name, values.length); mProperties.putDoubleArray(name, values); } private void putInPropertyBundle(@NonNull String name, @NonNull long[] values) { validateRepeatedPropertyLength(name, values.length); mProperties.putLongArray(name, values); } Loading @@ -1348,7 +1337,6 @@ public class GenericDocument { * into ArrayList<Bundle>, and each elements will contain a one dimension byte[]. */ private void putInPropertyBundle(@NonNull String name, @NonNull byte[][] values) { validateRepeatedPropertyLength(name, values.length); ArrayList<Bundle> bundles = new ArrayList<>(values.length); for (int i = 0; i < values.length; i++) { if (values[i] == null) { Loading @@ -1362,7 +1350,6 @@ public class GenericDocument { } private void putInPropertyBundle(@NonNull String name, @NonNull GenericDocument[] values) { validateRepeatedPropertyLength(name, values.length); Parcelable[] documentBundles = new Parcelable[values.length]; for (int i = 0; i < values.length; i++) { if (values[i] == null) { Loading @@ -1373,18 +1360,6 @@ public class GenericDocument { mProperties.putParcelableArray(name, documentBundles); } private static void validateRepeatedPropertyLength(@NonNull String name, int length) { if (length > MAX_REPEATED_PROPERTY_LENGTH) { throw new IllegalArgumentException( "Repeated property \"" + name + "\" has length " + length + ", which exceeds the limit of " + MAX_REPEATED_PROPERTY_LENGTH); } } /** Builds the {@link GenericDocument} object. */ @NonNull public GenericDocument build() { Loading
apex/appsearch/framework/java/external/android/app/appsearch/SetSchemaRequest.java +9 −2 Original line number Diff line number Diff line Loading @@ -169,13 +169,14 @@ public final class SetSchemaRequest { /** Builder for {@link SetSchemaRequest} objects. */ public static final class Builder { private static final int DEFAULT_VERSION = 1; private ArraySet<AppSearchSchema> mSchemas = new ArraySet<>(); private ArraySet<String> mSchemasNotDisplayedBySystem = new ArraySet<>(); private ArrayMap<String, Set<PackageIdentifier>> mSchemasVisibleToPackages = new ArrayMap<>(); private ArrayMap<String, Migrator> mMigrators = new ArrayMap<>(); private boolean mForceOverride = false; private int mVersion = 1; private int mVersion = DEFAULT_VERSION; private boolean mBuilt = false; /** Loading Loading @@ -384,6 +385,9 @@ public final class SetSchemaRequest { * <p>The version number can stay the same, increase, or decrease relative to the current * version number that is already stored in the {@link AppSearchSession} database. * * <p>The version of an empty database will always be 0. You cannot set version to the * {@link SetSchemaRequest}, if it doesn't contains any {@link AppSearchSchema}. * * @param version A positive integer representing the version of the entire set of schemas * represents the version of the whole schema in the {@link AppSearchSession} database, * default version is 1. Loading Loading @@ -423,7 +427,10 @@ public final class SetSchemaRequest { throw new IllegalArgumentException( "Schema types " + referencedSchemas + " referenced, but were not added."); } if (mSchemas.isEmpty() && mVersion != DEFAULT_VERSION) { throw new IllegalArgumentException( "Cannot set version to the request if schema is empty."); } mBuilt = true; return new SetSchemaRequest( mSchemas, Loading
apex/appsearch/service/java/com/android/server/appsearch/AppSearchManagerService.java +1 −1 Original line number Diff line number Diff line Loading @@ -60,8 +60,8 @@ import com.android.internal.annotations.GuardedBy; import com.android.server.LocalManagerRegistry; import com.android.server.SystemService; import com.android.server.appsearch.external.localstorage.stats.CallStats; import com.android.server.appsearch.external.localstorage.visibilitystore.VisibilityStore; import com.android.server.appsearch.util.PackageUtil; import com.android.server.appsearch.visibilitystore.VisibilityStore; import com.android.server.usage.StorageStatsManagerLocal; import com.android.server.usage.StorageStatsManagerLocal.StorageStatsAugmenter; Loading
apex/appsearch/service/java/com/android/server/appsearch/AppSearchUserInstance.java +4 −4 Original line number Diff line number Diff line Loading @@ -19,7 +19,7 @@ import android.annotation.NonNull; import com.android.server.appsearch.external.localstorage.AppSearchImpl; import com.android.server.appsearch.stats.PlatformLogger; import com.android.server.appsearch.visibilitystore.VisibilityStore; import com.android.server.appsearch.visibilitystore.VisibilityStoreImpl; import java.util.Objects; Loading @@ -30,12 +30,12 @@ import java.util.Objects; public final class AppSearchUserInstance { private final PlatformLogger mLogger; private final AppSearchImpl mAppSearchImpl; private final VisibilityStore mVisibilityStore; private final VisibilityStoreImpl mVisibilityStore; AppSearchUserInstance( @NonNull PlatformLogger logger, @NonNull AppSearchImpl appSearchImpl, @NonNull VisibilityStore visibilityStore) { @NonNull VisibilityStoreImpl visibilityStore) { mLogger = Objects.requireNonNull(logger); mAppSearchImpl = Objects.requireNonNull(appSearchImpl); mVisibilityStore = Objects.requireNonNull(visibilityStore); Loading @@ -52,7 +52,7 @@ public final class AppSearchUserInstance { } @NonNull public VisibilityStore getVisibilityStore() { public VisibilityStoreImpl getVisibilityStore() { return mVisibilityStore; } }
apex/appsearch/service/java/com/android/server/appsearch/AppSearchUserInstanceManager.java +3 −2 Original line number Diff line number Diff line Loading @@ -30,7 +30,7 @@ import com.android.server.appsearch.external.localstorage.AppSearchImpl; import com.android.server.appsearch.external.localstorage.FrameworkOptimizeStrategy; import com.android.server.appsearch.external.localstorage.stats.InitializeStats; import com.android.server.appsearch.stats.PlatformLogger; import com.android.server.appsearch.visibilitystore.VisibilityStore; import com.android.server.appsearch.visibilitystore.VisibilityStoreImpl; import java.io.File; import java.util.Map; Loading Loading @@ -178,7 +178,8 @@ public final class AppSearchUserInstanceManager { AppSearchImpl.create(icingDir, initStatsBuilder, new FrameworkOptimizeStrategy()); long prepareVisibilityStoreLatencyStartMillis = SystemClock.elapsedRealtime(); VisibilityStore visibilityStore = VisibilityStore.create(appSearchImpl, userContext); VisibilityStoreImpl visibilityStore = VisibilityStoreImpl.create(appSearchImpl, userContext); long prepareVisibilityStoreLatencyEndMillis = SystemClock.elapsedRealtime(); initStatsBuilder Loading