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

Commit 52cf8b9a authored by Treehugger Robot's avatar Treehugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Update Runtime metadata property config" into main

parents 49c29114 8fd307a2
Loading
Loading
Loading
Loading
+5 −8
Original line number Diff line number Diff line
@@ -137,8 +137,10 @@ public class AppFunctionRuntimeMetadata extends GenericDocument {
                                                .TOKENIZER_TYPE_VERBATIM)
                                .build())
                .addProperty(
                        new AppSearchSchema.BooleanPropertyConfig.Builder(PROPERTY_ENABLED)
                        new AppSearchSchema.LongPropertyConfig.Builder(PROPERTY_ENABLED)
                                .setCardinality(AppSearchSchema.PropertyConfig.CARDINALITY_OPTIONAL)
                                .setIndexingType(
                                        AppSearchSchema.LongPropertyConfig.INDEXING_TYPE_RANGE)
                                .build())
                .addProperty(
                        new AppSearchSchema.StringPropertyConfig.Builder(
@@ -212,19 +214,14 @@ public class AppFunctionRuntimeMetadata extends GenericDocument {
        }

        /**
         * Sets an indicator specifying if the function is enabled or not. This would override the
         * default enabled state in the static metadata ({@link
         * AppFunctionStaticMetadataHelper#STATIC_PROPERTY_ENABLED_BY_DEFAULT}). Sets this to null
         * to clear the override.
         * TODO(369683073) Replace the tristate Boolean with IntDef EnabledState.
         * Sets an indicator specifying the function enabled state.
         */
        @NonNull
        public Builder setEnabled(@EnabledState int enabledState) {
            if (enabledState != APP_FUNCTION_STATE_DEFAULT
                    && enabledState != APP_FUNCTION_STATE_ENABLED
                    && enabledState != APP_FUNCTION_STATE_DISABLED) {
                throw new IllegalArgumentException(
                        "Value of EnabledState is unsupported.");
                throw new IllegalArgumentException("Value of EnabledState is unsupported.");
            }
            setPropertyLong(PROPERTY_ENABLED, enabledState);
            return this;