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

Commit 72ac81f5 authored by Alexander Dorokhine's avatar Alexander Dorokhine Committed by Android (Google) Code Review
Browse files

Merge "Update framework from jetpack" into sc-dev

parents 0d97d8ad a6d8d8e6
Loading
Loading
Loading
Loading
+5 −5
Original line number Diff line number Diff line
@@ -98,13 +98,13 @@ package android.app.appsearch {
    method @NonNull public android.app.appsearch.AppSearchSchema.DoublePropertyConfig.Builder setCardinality(int);
  }

  public static final class AppSearchSchema.Int64PropertyConfig extends android.app.appsearch.AppSearchSchema.PropertyConfig {
  public static final class AppSearchSchema.LongPropertyConfig extends android.app.appsearch.AppSearchSchema.PropertyConfig {
  }

  public static final class AppSearchSchema.Int64PropertyConfig.Builder {
    ctor public AppSearchSchema.Int64PropertyConfig.Builder(@NonNull String);
    method @NonNull public android.app.appsearch.AppSearchSchema.Int64PropertyConfig build();
    method @NonNull public android.app.appsearch.AppSearchSchema.Int64PropertyConfig.Builder setCardinality(int);
  public static final class AppSearchSchema.LongPropertyConfig.Builder {
    ctor public AppSearchSchema.LongPropertyConfig.Builder(@NonNull String);
    method @NonNull public android.app.appsearch.AppSearchSchema.LongPropertyConfig build();
    method @NonNull public android.app.appsearch.AppSearchSchema.LongPropertyConfig.Builder setCardinality(int);
  }

  public abstract static class AppSearchSchema.PropertyConfig {
+59 −7
Original line number Diff line number Diff line
@@ -182,7 +182,7 @@ public final class AppSearchSchema {
        @IntDef(
                value = {
                    DATA_TYPE_STRING,
                    DATA_TYPE_INT64,
                    DATA_TYPE_LONG,
                    DATA_TYPE_DOUBLE,
                    DATA_TYPE_BOOLEAN,
                    DATA_TYPE_BYTES,
@@ -195,7 +195,7 @@ public final class AppSearchSchema {
        public static final int DATA_TYPE_STRING = 1;

        /** @hide */
        public static final int DATA_TYPE_INT64 = 2;
        public static final int DATA_TYPE_LONG = 2;

        /** @hide */
        public static final int DATA_TYPE_DOUBLE = 3;
@@ -315,8 +315,8 @@ public final class AppSearchSchema {
            switch (propertyBundle.getInt(PropertyConfig.DATA_TYPE_FIELD)) {
                case PropertyConfig.DATA_TYPE_STRING:
                    return new StringPropertyConfig(propertyBundle);
                case PropertyConfig.DATA_TYPE_INT64:
                    return new Int64PropertyConfig(propertyBundle);
                case PropertyConfig.DATA_TYPE_LONG:
                    return new LongPropertyConfig(propertyBundle);
                case PropertyConfig.DATA_TYPE_DOUBLE:
                    return new DoublePropertyConfig(propertyBundle);
                case PropertyConfig.DATA_TYPE_BOOLEAN:
@@ -485,8 +485,13 @@ public final class AppSearchSchema {
        }
    }

    /** Configuration for a property containing a 64-bit integer. */
    public static final class Int64PropertyConfig extends PropertyConfig {
    /**
     * @deprecated TODO(b/181887768): Exists for dogfood transition; must be removed.
     * @hide
     */
    @Deprecated
    @UnsupportedAppUsage(implicitMember = "")
    public static class Int64PropertyConfig extends PropertyConfig {
        Int64PropertyConfig(@NonNull Bundle bundle) {
            super(bundle);
        }
@@ -497,6 +502,7 @@ public final class AppSearchSchema {
            private @Cardinality int mCardinality = CARDINALITY_OPTIONAL;

            /** Creates a new {@link Int64PropertyConfig.Builder}. */
            @UnsupportedAppUsage
            public Builder(@NonNull String propertyName) {
                mPropertyName = Objects.requireNonNull(propertyName);
            }
@@ -509,6 +515,7 @@ public final class AppSearchSchema {
             */
            @SuppressWarnings("MissingGetterMatchingBuilder") // getter defined in superclass
            @NonNull
            @UnsupportedAppUsage
            public Int64PropertyConfig.Builder setCardinality(@Cardinality int cardinality) {
                Preconditions.checkArgumentInRange(
                        cardinality, CARDINALITY_REPEATED, CARDINALITY_REQUIRED, "cardinality");
@@ -518,16 +525,61 @@ public final class AppSearchSchema {

            /** 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_INT64);
                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. */
    // TODO(b/181887768): This should extend directly from PropertyConfig
    public static final class LongPropertyConfig extends Int64PropertyConfig {
        LongPropertyConfig(@NonNull Bundle bundle) {
            super(bundle);
        }

        /** Builder for {@link LongPropertyConfig}. */
        public static final class Builder {
            private final String mPropertyName;
            private @Cardinality int mCardinality = CARDINALITY_OPTIONAL;

            /** Creates a new {@link LongPropertyConfig.Builder}. */
            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
            public LongPropertyConfig.Builder setCardinality(@Cardinality int cardinality) {
                Preconditions.checkArgumentInRange(
                        cardinality, CARDINALITY_REPEATED, CARDINALITY_REQUIRED, "cardinality");
                mCardinality = cardinality;
                return this;
            }

            /** Constructs a new {@link LongPropertyConfig} from the contents of this builder. */
            @NonNull
            public LongPropertyConfig 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 LongPropertyConfig(bundle);
            }
        }
    }

    /** Configuration for a property containing a double-precision decimal number. */
    public static final class DoublePropertyConfig extends PropertyConfig {
        DoublePropertyConfig(@NonNull Bundle bundle) {
+1 −2
Original line number Diff line number Diff line
@@ -103,8 +103,7 @@ public final class AppSearchLoggerHelper {
        toStatsBuilder
                .setNativeLatencyMillis(fromNativeStats.getLatencyMs())
                .setTermCount(fromNativeStats.getNumTerms())
                // TODO(b/173532925) query length missing in native
                // .setNativeQueryLength(0)
                .setQueryLength(fromNativeStats.getQueryLength())
                .setFilteredNamespaceCount(fromNativeStats.getNumNamespacesFiltered())
                .setFilteredSchemaTypeCount(fromNativeStats.getNumSchemaTypesFiltered())
                .setRequestedPageSize(fromNativeStats.getRequestedPageSize())
+1 −1
Original line number Diff line number Diff line
@@ -199,7 +199,7 @@ public final class GenericDocumentToProtoConverter {
            case AppSearchSchema.PropertyConfig.DATA_TYPE_STRING:
                documentBuilder.setPropertyString(propertyName, EMPTY_STRING_ARRAY);
                break;
            case AppSearchSchema.PropertyConfig.DATA_TYPE_INT64:
            case AppSearchSchema.PropertyConfig.DATA_TYPE_LONG:
                documentBuilder.setPropertyLong(propertyName, EMPTY_LONG_ARRAY);
                break;
            case AppSearchSchema.PropertyConfig.DATA_TYPE_DOUBLE:
+1 −1
Original line number Diff line number Diff line
@@ -133,7 +133,7 @@ public final class SchemaToProtoConverter {
            case STRING:
                return toStringPropertyConfig(proto);
            case INT64:
                return new AppSearchSchema.Int64PropertyConfig.Builder(proto.getPropertyName())
                return new AppSearchSchema.LongPropertyConfig.Builder(proto.getPropertyName())
                        .setCardinality(proto.getCardinality().getNumber())
                        .build();
            case DOUBLE:
Loading