Merge "Fix height calculation for label in OutlinedTextField" into androidx-main
diff --git a/.github/actions/build-single-project/action.yml b/.github/actions/build-single-project/action.yml
index ab4317f1..19a8cb4 100644
--- a/.github/actions/build-single-project/action.yml
+++ b/.github/actions/build-single-project/action.yml
@@ -38,6 +38,9 @@
- name: "Install Cmake"
shell: bash
run: echo "yes" | $ANDROID_SDK_ROOT/cmdline-tools/latest/bin/sdkmanager --install "cmake;3.22.1"
+ - name: "Install Android SDK Build-Tools"
+ shell: bash
+ run: echo "yes" | $ANDROID_SDK_ROOT/cmdline-tools/latest/bin/sdkmanager --install "build-tools;34.0.0-rc3"
- name: "Set environment variables"
shell: bash
run: |
diff --git a/.github/ci-control/ci-config.json b/.github/ci-control/ci-config.json
index 2d07c46..dfb2af6 100644
--- a/.github/ci-control/ci-config.json
+++ b/.github/ci-control/ci-config.json
@@ -7,11 +7,13 @@
],
"compose" : {
"include" : [
+ "compose-runtime"
],
"default": false
},
"main" : {
"exclude" : [
+ "compose-runtime",
"room"
],
"default": true
diff --git a/activity/activity-compose/integration-tests/activity-demos/src/main/AndroidManifest.xml b/activity/activity-compose/integration-tests/activity-demos/src/main/AndroidManifest.xml
deleted file mode 100644
index deac81d..0000000
--- a/activity/activity-compose/integration-tests/activity-demos/src/main/AndroidManifest.xml
+++ /dev/null
@@ -1,17 +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.
- -->
-
-<manifest />
diff --git a/activity/activity-compose/samples/src/main/AndroidManifest.xml b/activity/activity-compose/samples/src/main/AndroidManifest.xml
deleted file mode 100644
index deac81d..0000000
--- a/activity/activity-compose/samples/src/main/AndroidManifest.xml
+++ /dev/null
@@ -1,17 +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.
- -->
-
-<manifest />
diff --git a/activity/activity-compose/src/main/AndroidManifest.xml b/activity/activity-compose/src/main/AndroidManifest.xml
deleted file mode 100644
index 9cd4123..0000000
--- a/activity/activity-compose/src/main/AndroidManifest.xml
+++ /dev/null
@@ -1,17 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
- 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.
- -->
-<manifest />
diff --git a/activity/activity-ktx/src/main/AndroidManifest.xml b/activity/activity-ktx/src/main/AndroidManifest.xml
deleted file mode 100644
index dd3d3a3..0000000
--- a/activity/activity-ktx/src/main/AndroidManifest.xml
+++ /dev/null
@@ -1,16 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2018 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.
--->
-<manifest />
diff --git a/annotation/annotation-experimental/src/main/AndroidManifest.xml b/annotation/annotation-experimental/src/main/AndroidManifest.xml
deleted file mode 100644
index b303288..0000000
--- a/annotation/annotation-experimental/src/main/AndroidManifest.xml
+++ /dev/null
@@ -1,17 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
- Copyright 2019 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.
--->
-<manifest />
diff --git a/appactions/interaction/interaction-capabilities-communication/src/main/java/androidx/appactions/interaction/capabilities/communication/CreateCall.kt b/appactions/interaction/interaction-capabilities-communication/src/main/java/androidx/appactions/interaction/capabilities/communication/CreateCall.kt
index b1fcd9c..f3cb73c 100644
--- a/appactions/interaction/interaction-capabilities-communication/src/main/java/androidx/appactions/interaction/capabilities/communication/CreateCall.kt
+++ b/appactions/interaction/interaction-capabilities-communication/src/main/java/androidx/appactions/interaction/capabilities/communication/CreateCall.kt
@@ -209,12 +209,12 @@
)
.bindOptionalOutput(
"call",
- { output -> Optional.ofNullable(output.call) },
+ Output::call,
ParamValueConverter.of(CALL_TYPE_SPEC)::toParamValue
)
.bindOptionalOutput(
"executionStatus",
- { output -> Optional.ofNullable(output.executionStatus) },
+ Output::executionStatus,
ExecutionStatus::toParamValue
)
.build()
diff --git a/appactions/interaction/interaction-capabilities-communication/src/main/java/androidx/appactions/interaction/capabilities/communication/CreateMessage.kt b/appactions/interaction/interaction-capabilities-communication/src/main/java/androidx/appactions/interaction/capabilities/communication/CreateMessage.kt
index 61ceb00..f7318ef 100644
--- a/appactions/interaction/interaction-capabilities-communication/src/main/java/androidx/appactions/interaction/capabilities/communication/CreateMessage.kt
+++ b/appactions/interaction/interaction-capabilities-communication/src/main/java/androidx/appactions/interaction/capabilities/communication/CreateMessage.kt
@@ -211,12 +211,12 @@
)
.bindOptionalOutput(
"message",
- { output -> Optional.ofNullable(output.message) },
+ Output::message,
ParamValueConverter.of(MESSAGE_TYPE_SPEC)::toParamValue
)
.bindOptionalOutput(
"executionStatus",
- { output -> Optional.ofNullable(output.executionStatus) },
+ Output::executionStatus,
ExecutionStatus::toParamValue
)
.build()
diff --git a/appactions/interaction/interaction-capabilities-core/build.gradle b/appactions/interaction/interaction-capabilities-core/build.gradle
index 6683d10..5bca53c 100644
--- a/appactions/interaction/interaction-capabilities-core/build.gradle
+++ b/appactions/interaction/interaction-capabilities-core/build.gradle
@@ -25,8 +25,6 @@
dependencies {
api(project(path: ":appactions:interaction:interaction-proto", configuration: "shadowJar"))
- annotationProcessor(libs.autoValue)
-
api(libs.autoValueAnnotations)
implementation(libs.guavaListenableFuture)
implementation(libs.kotlinCoroutinesCore)
@@ -34,7 +32,6 @@
implementation("androidx.concurrent:concurrent-futures:1.1.0")
implementation("androidx.concurrent:concurrent-futures-ktx:1.1.0")
- testAnnotationProcessor(libs.autoValue)
testImplementation(project(":appactions:interaction:interaction-capabilities-testing"))
testImplementation(libs.junit)
testImplementation(libs.truth)
diff --git a/appactions/interaction/interaction-capabilities-core/src/main/java/androidx/appactions/interaction/capabilities/core/impl/ArgumentsWrapper.kt b/appactions/interaction/interaction-capabilities-core/src/main/java/androidx/appactions/interaction/capabilities/core/impl/ArgumentsWrapper.kt
index 3eece1d..8aaadae 100644
--- a/appactions/interaction/interaction-capabilities-core/src/main/java/androidx/appactions/interaction/capabilities/core/impl/ArgumentsWrapper.kt
+++ b/appactions/interaction/interaction-capabilities-core/src/main/java/androidx/appactions/interaction/capabilities/core/impl/ArgumentsWrapper.kt
@@ -54,7 +54,7 @@
) {
null
} else {
- RequestMetadata.newBuilder().setRequestType(fulfillment.type).build()
+ RequestMetadata(fulfillment.type)
}
}
diff --git a/appactions/interaction/interaction-capabilities-core/src/main/java/androidx/appactions/interaction/capabilities/core/impl/RequestMetadata.java b/appactions/interaction/interaction-capabilities-core/src/main/java/androidx/appactions/interaction/capabilities/core/impl/RequestMetadata.java
deleted file mode 100644
index 868a7d8..0000000
--- a/appactions/interaction/interaction-capabilities-core/src/main/java/androidx/appactions/interaction/capabilities/core/impl/RequestMetadata.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * Copyright 2023 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 androidx.appactions.interaction.capabilities.core.impl;
-
-import androidx.annotation.NonNull;
-import androidx.annotation.RestrictTo;
-import androidx.appactions.interaction.proto.FulfillmentRequest.Fulfillment;
-
-import com.google.auto.value.AutoValue;
-
-/** Represents metadata from the Assistant FulfillmentRequest. */
-@AutoValue
-@RestrictTo(RestrictTo.Scope.LIBRARY_GROUP)
-public abstract class RequestMetadata {
-
- /** Create a Builder instance for building a RequestMetadata instance. */
- @NonNull
- public static Builder newBuilder() {
- return new AutoValue_RequestMetadata.Builder();
- }
-
- /** The Type of request Assistant is sending on this FulfillmentRequest. */
- @NonNull
- public abstract Fulfillment.Type requestType();
-
- /** Builder for RequestMetadata. */
- @AutoValue.Builder
- public abstract static class Builder {
- /** Sets the FulfillmentRequest.Type. */
- @NonNull
- public abstract Builder setRequestType(@NonNull Fulfillment.Type requestType);
-
- /** Builds the RequestMetadata instance. */
- @NonNull
- public abstract RequestMetadata build();
- }
-}
diff --git a/appactions/interaction/interaction-capabilities-core/src/main/java/androidx/appactions/interaction/capabilities/core/impl/RequestMetadata.kt b/appactions/interaction/interaction-capabilities-core/src/main/java/androidx/appactions/interaction/capabilities/core/impl/RequestMetadata.kt
new file mode 100644
index 0000000..37be7ca
--- /dev/null
+++ b/appactions/interaction/interaction-capabilities-core/src/main/java/androidx/appactions/interaction/capabilities/core/impl/RequestMetadata.kt
@@ -0,0 +1,32 @@
+/*
+ * Copyright 2023 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 androidx.appactions.interaction.capabilities.core.impl
+
+import androidx.annotation.RestrictTo
+import androidx.appactions.interaction.proto.FulfillmentRequest.Fulfillment
+
+@RestrictTo(RestrictTo.Scope.LIBRARY)
+data class RequestMetadata internal constructor(
+ val requestType: Fulfillment.Type
+) {
+ companion object {
+ @JvmStatic
+ fun create(requestType: Fulfillment.Type): RequestMetadata {
+ return RequestMetadata(requestType)
+ }
+ }
+}
\ No newline at end of file
diff --git a/appactions/interaction/interaction-capabilities-core/src/main/java/androidx/appactions/interaction/capabilities/core/impl/converters/CheckedInterfaces.java b/appactions/interaction/interaction-capabilities-core/src/main/java/androidx/appactions/interaction/capabilities/core/impl/converters/CheckedInterfaces.java
index 056c6e8..eba3f11 100644
--- a/appactions/interaction/interaction-capabilities-core/src/main/java/androidx/appactions/interaction/capabilities/core/impl/converters/CheckedInterfaces.java
+++ b/appactions/interaction/interaction-capabilities-core/src/main/java/androidx/appactions/interaction/capabilities/core/impl/converters/CheckedInterfaces.java
@@ -37,7 +37,7 @@
* @param <R>
*/
@FunctionalInterface
- public interface Function<T, R> {
+ interface Function<T, R> {
R apply(T t) throws StructConversionException;
}
diff --git a/appactions/interaction/interaction-capabilities-core/src/main/java/androidx/appactions/interaction/capabilities/core/impl/converters/FieldBinding.java b/appactions/interaction/interaction-capabilities-core/src/main/java/androidx/appactions/interaction/capabilities/core/impl/converters/FieldBinding.java
deleted file mode 100644
index 2e2f22a..0000000
--- a/appactions/interaction/interaction-capabilities-core/src/main/java/androidx/appactions/interaction/capabilities/core/impl/converters/FieldBinding.java
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- * Copyright 2023 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 androidx.appactions.interaction.capabilities.core.impl.converters;
-
-import androidx.appactions.interaction.protobuf.Value;
-
-import com.google.auto.value.AutoValue;
-
-import java.util.Optional;
-import java.util.function.Function;
-
-@AutoValue
-abstract class FieldBinding<T, BuilderT> {
-
- static <T, BuilderT> FieldBinding<T, BuilderT> create(
- String name,
- Function<T, Optional<Value>> valueGetter,
- CheckedInterfaces.BiConsumer<BuilderT, Optional<Value>> valueSetter) {
- return new AutoValue_FieldBinding<>(name, valueGetter, valueSetter);
- }
-
- abstract String name();
-
- abstract Function<T, Optional<Value>> valueGetter();
-
- abstract CheckedInterfaces.BiConsumer<BuilderT, Optional<Value>> valueSetter();
-}
diff --git a/appactions/interaction/interaction-capabilities-core/src/main/java/androidx/appactions/interaction/capabilities/core/impl/converters/FieldBinding.kt b/appactions/interaction/interaction-capabilities-core/src/main/java/androidx/appactions/interaction/capabilities/core/impl/converters/FieldBinding.kt
new file mode 100644
index 0000000..2e97ad9
--- /dev/null
+++ b/appactions/interaction/interaction-capabilities-core/src/main/java/androidx/appactions/interaction/capabilities/core/impl/converters/FieldBinding.kt
@@ -0,0 +1,38 @@
+/*
+ * Copyright 2023 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 androidx.appactions.interaction.capabilities.core.impl.converters
+
+import androidx.appactions.interaction.protobuf.Value
+import java.util.Optional
+import java.util.function.Function
+
+internal data class FieldBinding<T, BuilderT> constructor(
+ val name: String,
+ val valueGetter: Function<T, Optional<Value>>,
+ val valueSetter: CheckedInterfaces.BiConsumer<BuilderT, Optional<Value>>
+) {
+ companion object {
+ @JvmStatic
+ fun <T, BuilderT> create(
+ name: String,
+ valueGetter: Function<T, Optional<Value>>,
+ valueSetter: CheckedInterfaces.BiConsumer<BuilderT, Optional<Value>>
+ ): FieldBinding<T, BuilderT> {
+ return FieldBinding(name, valueGetter, valueSetter)
+ }
+ }
+}
\ No newline at end of file
diff --git a/appactions/interaction/interaction-capabilities-core/src/main/java/androidx/appactions/interaction/capabilities/core/impl/converters/TypeSpecImpl.java b/appactions/interaction/interaction-capabilities-core/src/main/java/androidx/appactions/interaction/capabilities/core/impl/converters/TypeSpecImpl.java
index 48f5a0c..f101314 100644
--- a/appactions/interaction/interaction-capabilities-core/src/main/java/androidx/appactions/interaction/capabilities/core/impl/converters/TypeSpecImpl.java
+++ b/appactions/interaction/interaction-capabilities-core/src/main/java/androidx/appactions/interaction/capabilities/core/impl/converters/TypeSpecImpl.java
@@ -74,9 +74,9 @@
public Value toValue(@NonNull T obj) {
Struct.Builder structBuilder = Struct.newBuilder();
for (FieldBinding<T, BuilderT> binding : mBindings) {
- binding.valueGetter()
+ binding.getValueGetter()
.apply(obj)
- .ifPresent(value -> structBuilder.putFields(binding.name(), value));
+ .ifPresent(value -> structBuilder.putFields(binding.getName(), value));
}
return Value.newBuilder().setStructValue(structBuilder).build();
}
@@ -101,8 +101,8 @@
BuilderT builder = mBuilderSupplier.get();
Map<String, Value> fieldsMap = struct.getFieldsMap();
for (FieldBinding<T, BuilderT> binding : mBindings) {
- Optional<Value> fieldValue = Optional.ofNullable(fieldsMap.get(binding.name()));
- binding.valueSetter().accept(builder, fieldValue);
+ Optional<Value> fieldValue = Optional.ofNullable(fieldsMap.get(binding.getName()));
+ binding.getValueSetter().accept(builder, fieldValue);
}
return mBuilderFinalizer.apply(builder);
}
diff --git a/appactions/interaction/interaction-capabilities-core/src/main/java/androidx/appactions/interaction/capabilities/core/impl/spec/ActionSpec.java b/appactions/interaction/interaction-capabilities-core/src/main/java/androidx/appactions/interaction/capabilities/core/impl/spec/ActionSpec.java
deleted file mode 100644
index eb8d0ad..0000000
--- a/appactions/interaction/interaction-capabilities-core/src/main/java/androidx/appactions/interaction/capabilities/core/impl/spec/ActionSpec.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * Copyright 2023 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 androidx.appactions.interaction.capabilities.core.impl.spec;
-
-import androidx.annotation.NonNull;
-import androidx.appactions.interaction.capabilities.core.impl.exceptions.StructConversionException;
-import androidx.appactions.interaction.capabilities.core.properties.Property;
-import androidx.appactions.interaction.proto.AppActionsContext.AppAction;
-import androidx.appactions.interaction.proto.FulfillmentResponse.StructuredOutput;
-import androidx.appactions.interaction.proto.ParamValue;
-
-import java.util.List;
-import java.util.Map;
-
-/**
- * A specification for an action, describing it from the app's point of view.
- *
- * @param <ArgumentsT> typed representation of action's arguments.
- * @param <OutputT> typed action's execution output.
- */
-public interface ActionSpec<ArgumentsT, OutputT> {
-
- /** Converts the property to the {@code AppAction} proto. */
- @NonNull
- AppAction convertPropertyToProto(@NonNull Map<String,
- Property<?>> property);
-
- /** Builds this action's arguments from an ArgumentsWrapper instance. */
- @NonNull
- ArgumentsT buildArguments(@NonNull Map<String, List<ParamValue>> args)
- throws StructConversionException;
-
- /** Converts the output to the {@code StructuredOutput} proto. */
- @NonNull
- StructuredOutput convertOutputToProto(OutputT output);
-}
diff --git a/appactions/interaction/interaction-capabilities-core/src/main/java/androidx/appactions/interaction/capabilities/core/impl/spec/ActionSpec.kt b/appactions/interaction/interaction-capabilities-core/src/main/java/androidx/appactions/interaction/capabilities/core/impl/spec/ActionSpec.kt
new file mode 100644
index 0000000..450d3d3
--- /dev/null
+++ b/appactions/interaction/interaction-capabilities-core/src/main/java/androidx/appactions/interaction/capabilities/core/impl/spec/ActionSpec.kt
@@ -0,0 +1,42 @@
+/*
+ * Copyright 2023 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 androidx.appactions.interaction.capabilities.core.impl.spec
+
+import androidx.appactions.interaction.capabilities.core.impl.exceptions.StructConversionException
+import androidx.appactions.interaction.capabilities.core.properties.Property
+import androidx.appactions.interaction.proto.AppActionsContext
+import androidx.appactions.interaction.proto.FulfillmentResponse
+import androidx.appactions.interaction.proto.ParamValue
+
+/**
+ * A specification for an action, describing it from the app's point of view.
+ *
+ * @param ArgumentsT typed representation of action's arguments.
+ * @param OutputT typed action's execution output.
+ */
+interface ActionSpec<ArgumentsT, OutputT> {
+
+ /** Converts the property to the `AppAction` proto. */
+ fun convertPropertyToProto(property: Map<String, Property<*>>): AppActionsContext.AppAction
+
+ /** Builds this action's arguments from an ArgumentsWrapper instance. */
+ @Throws(StructConversionException::class)
+ fun buildArguments(args: Map<String, List<ParamValue>>): ArgumentsT
+
+ /** Converts the output to the `StructuredOutput` proto. */
+ fun convertOutputToProto(output: OutputT): FulfillmentResponse.StructuredOutput
+}
\ No newline at end of file
diff --git a/appactions/interaction/interaction-capabilities-core/src/main/java/androidx/appactions/interaction/capabilities/core/impl/spec/ActionSpecBuilder.java b/appactions/interaction/interaction-capabilities-core/src/main/java/androidx/appactions/interaction/capabilities/core/impl/spec/ActionSpecBuilder.java
deleted file mode 100644
index df268de..0000000
--- a/appactions/interaction/interaction-capabilities-core/src/main/java/androidx/appactions/interaction/capabilities/core/impl/spec/ActionSpecBuilder.java
+++ /dev/null
@@ -1,294 +0,0 @@
-/*
- * Copyright 2023 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 androidx.appactions.interaction.capabilities.core.impl.spec;
-
-import static androidx.appactions.interaction.capabilities.core.impl.utils.ImmutableCollectors.toImmutableList;
-
-import androidx.annotation.NonNull;
-import androidx.appactions.interaction.capabilities.core.impl.BuilderOf;
-import androidx.appactions.interaction.capabilities.core.impl.converters.EntityConverter;
-import androidx.appactions.interaction.capabilities.core.impl.converters.ParamValueConverter;
-import androidx.appactions.interaction.capabilities.core.impl.converters.SlotTypeConverter;
-import androidx.appactions.interaction.capabilities.core.impl.spec.ParamBinding.ArgumentSetter;
-import androidx.appactions.interaction.capabilities.core.properties.Property;
-import androidx.appactions.interaction.proto.AppActionsContext.IntentParameter;
-import androidx.appactions.interaction.proto.ParamValue;
-
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Optional;
-import java.util.function.BiConsumer;
-import java.util.function.Function;
-import java.util.function.Supplier;
-
-/**
- * A builder for the {@code ActionSpec}.
- */
-public final class ActionSpecBuilder<ArgumentsT, ArgumentsBuilderT extends BuilderOf<ArgumentsT>,
- OutputT> {
-
- private final String mCapabilityName;
- private final Supplier<ArgumentsBuilderT> mArgumentBuilderSupplier;
- private final ArrayList<ParamBinding<ArgumentsT, ArgumentsBuilderT>>
- mParamBindingList = new ArrayList<>();
- private final Map<String, Function<OutputT, List<ParamValue>>> mOutputBindings =
- new HashMap<>();
-
- private ActionSpecBuilder(
- String capabilityName, Supplier<ArgumentsBuilderT> argumentBuilderSupplier) {
- this.mCapabilityName = capabilityName;
- this.mArgumentBuilderSupplier = argumentBuilderSupplier;
- }
-
- /**
- * Creates an empty {@code ActionSpecBuilder} with the given capability name. ArgumentsT is set
- * to Object as a placeholder, which must be replaced by calling setArgument.
- */
- @NonNull
- public static ActionSpecBuilder<Object, BuilderOf<Object>, Void> ofCapabilityNamed(
- @NonNull String capabilityName) {
- return new ActionSpecBuilder<>(capabilityName, () -> Object::new);
- }
-
- /** Sets the property type and returns a new {@code ActionSpecBuilder}. */
-
- /** Sets the argument type and its builder and returns a new {@code ActionSpecBuilder}. */
- @NonNull
- public <NewArgumentsT, NewArgumentsBuilderT extends BuilderOf<NewArgumentsT>>
- ActionSpecBuilder<NewArgumentsT, NewArgumentsBuilderT, OutputT> setArguments(
- @NonNull Class<NewArgumentsT> unused,
- @NonNull Supplier<NewArgumentsBuilderT> argumentBuilderSupplier) {
- return new ActionSpecBuilder<>(this.mCapabilityName, argumentBuilderSupplier);
- }
-
- @NonNull
- public <NewOutputT>
- ActionSpecBuilder<ArgumentsT, ArgumentsBuilderT, NewOutputT> setOutput(
- @NonNull Class<NewOutputT> unused) {
- return new ActionSpecBuilder<>(this.mCapabilityName, this.mArgumentBuilderSupplier);
- }
-
- /**
- * Binds the parameter name, getter and setter.
- *
- * @param paramName the name of this action' parameter.
- * @param paramGetter a getter of the param-specific info from the property.
- * @param argumentSetter a setter to the argument with the input from {@code ParamValue}.
- * @return the builder itself.
- */
- @NonNull
- private ActionSpecBuilder<ArgumentsT, ArgumentsBuilderT, OutputT>
- bindParameterInternal(
- @NonNull String paramName,
- @NonNull Function<Map<String, Property<?>>,
- Optional<IntentParameter>> paramGetter,
- @NonNull ArgumentSetter<ArgumentsBuilderT> argumentSetter) {
- mParamBindingList.add(ParamBinding.create(paramName, paramGetter, argumentSetter));
- return this;
- }
-
- /**
- * Binds the parameter name, getter, and setter for a {@link Property}.
- *
- * <p>This parameter is required for any capability built from the generated {@link ActionSpec}.
- *
- * @param paramName the name of this action' parameter.
- * @param propertyGetter a getter of the Property from the property, which must be able to
- * fetch a non-null {@code Property} from {@code PropertyT}.
- * @param paramConsumer a setter to set the string value in the argument builder.
- * @param paramValueConverter converter FROM assistant ParamValue proto
- * @param entityConverter converter TO assistant Entity proto
- * @return the builder itself.
- */
- @NonNull
- public <T, PossibleValueT>
- ActionSpecBuilder<ArgumentsT, ArgumentsBuilderT, OutputT> bindParameter(
- @NonNull String paramName,
- @NonNull
- Function<Map<String, Property<?>>,
- Property<PossibleValueT>>
- propertyGetter,
- @NonNull BiConsumer<? super ArgumentsBuilderT, T> paramConsumer,
- @NonNull ParamValueConverter<T> paramValueConverter,
- @NonNull EntityConverter<PossibleValueT> entityConverter) {
- return bindOptionalParameter(
- paramName,
- property -> Optional.of(propertyGetter.apply(property)),
- paramConsumer,
- paramValueConverter,
- entityConverter);
- }
-
- /**
- * Binds the parameter name, getter, and setter for a {@link Property}.
- *
- * <p>This parameter is optional for any capability built from the generated {@link ActionSpec}.
- * If the Property Optional is not set, this parameter will not exist in the parameter
- * definition of the capability.
- *
- * @param paramName the name of this action' parameter.
- * @param optionalPropertyGetter an optional getter of the Property from the property,
- * which may be able to fetch a non-null {@code Property} from {@code PropertyT},
- * or get {@link Optional#empty}.
- * @param paramConsumer a setter to set the string value in the argument builder.
- * @param paramValueConverter converter FROM assistant ParamValue proto
- * @param entityConverter converter TO assistant Entity proto
- * @return the builder itself.
- */
- @NonNull
- public <T, PossibleValueT>
- ActionSpecBuilder<ArgumentsT, ArgumentsBuilderT, OutputT>
- bindOptionalParameter(
- @NonNull String paramName,
- @NonNull
- Function<
- Map<String, Property<?>>,
- Optional<Property<PossibleValueT>>>
- optionalPropertyGetter,
- @NonNull BiConsumer<? super ArgumentsBuilderT, T> paramConsumer,
- @NonNull ParamValueConverter<T> paramValueConverter,
- @NonNull EntityConverter<PossibleValueT> entityConverter) {
- return bindParameterInternal(
- paramName,
- property ->
- optionalPropertyGetter
- .apply(property)
- .map(p -> buildIntentParameter(paramName, p, entityConverter)),
- (argBuilder, paramList) -> {
- if (!paramList.isEmpty()) {
- paramConsumer.accept(
- argBuilder,
- SlotTypeConverter.ofSingular(paramValueConverter)
- .convert(paramList));
- }
- });
- }
-
- /**
- * This is similar to {@link ActionSpecBuilder#bindOptionalParameter} but for setting a list of
- * entities instead.
- *
- * <p>This parameter is optional for any capability built from the generated {@link ActionSpec}.
- * If the Property Optional is not set, this parameter will not exist in the parameter
- * definition of the capability.
- */
- @NonNull
- public <T, PossibleValueT>
- ActionSpecBuilder<ArgumentsT, ArgumentsBuilderT, OutputT>
- bindRepeatedParameter(
- @NonNull String paramName,
- @NonNull
- Function<
- Map<String, Property<?>>,
- Optional<Property<PossibleValueT>>>
- optionalPropertyGetter,
- @NonNull BiConsumer<? super ArgumentsBuilderT, List<T>> paramConsumer,
- @NonNull ParamValueConverter<T> paramValueConverter,
- @NonNull EntityConverter<PossibleValueT> entityConverter) {
- return bindParameterInternal(
- paramName,
- property ->
- optionalPropertyGetter
- .apply(property)
- .map(p -> buildIntentParameter(paramName, p, entityConverter)),
- (argBuilder, paramList) ->
- paramConsumer.accept(
- argBuilder,
- SlotTypeConverter.ofRepeated(paramValueConverter)
- .convert(paramList)));
- }
-
- /**
- * Binds an optional output.
- *
- * @param name the BII output slot name of this parameter.
- * @param outputGetter a getter of the output from the {@code OutputT} instance.
- * @param converter a converter from an output object to a ParamValue.
- */
- @NonNull
- @SuppressWarnings("JdkCollectors")
- public <T>
- ActionSpecBuilder<ArgumentsT, ArgumentsBuilderT, OutputT> bindOptionalOutput(
- @NonNull String name,
- @NonNull Function<OutputT, Optional<T>> outputGetter,
- @NonNull Function<T, ParamValue> converter) {
- mOutputBindings.put(
- name,
- output -> {
- Optional<T> optionalOut = outputGetter.apply(output);
- List<ParamValue> paramValues = new ArrayList<>();
- if (optionalOut.isPresent()) {
- paramValues.add(converter.apply(optionalOut.get()));
- }
- return Collections.unmodifiableList(paramValues);
- });
- return this;
- }
-
- /**
- * Binds a repeated output.
- *
- * @param name the BII output slot name of this parameter.
- * @param outputGetter a getter of the output from the {@code OutputT} instance.
- * @param converter a converter from an output object to a ParamValue.
- */
- @NonNull
- @SuppressWarnings("JdkCollectors")
- public <T>
- ActionSpecBuilder<ArgumentsT, ArgumentsBuilderT, OutputT> bindRepeatedOutput(
- @NonNull String name,
- @NonNull Function<OutputT, List<T>> outputGetter,
- @NonNull Function<T, ParamValue> converter) {
- mOutputBindings.put(
- name,
- output ->
- outputGetter.apply(output).stream()
- .map(converter)
- .collect(toImmutableList()));
- return this;
- }
-
- /** Builds an {@code ActionSpec} from this builder. */
- @NonNull
- public ActionSpec<ArgumentsT, OutputT> build() {
- return new ActionSpecImpl<>(
- mCapabilityName,
- mArgumentBuilderSupplier,
- Collections.unmodifiableList(mParamBindingList),
- mOutputBindings);
- }
-
- /** Create IntentParameter proto from a Property. */
- @NonNull
- private static <T> IntentParameter buildIntentParameter(
- @NonNull String paramName,
- @NonNull Property<T> property,
- @NonNull EntityConverter<T> entityConverter) {
- IntentParameter.Builder builder = IntentParameter.newBuilder()
- .setName(paramName)
- .setIsRequired(property.isRequired())
- .setEntityMatchRequired(property.isValueMatchRequired())
- .setIsProhibited(property.isProhibited());
- property.getPossibleValues().stream()
- .map(entityConverter::convert)
- .forEach(builder::addPossibleEntities);
- return builder.build();
- }
-}
diff --git a/appactions/interaction/interaction-capabilities-core/src/main/java/androidx/appactions/interaction/capabilities/core/impl/spec/ActionSpecBuilder.kt b/appactions/interaction/interaction-capabilities-core/src/main/java/androidx/appactions/interaction/capabilities/core/impl/spec/ActionSpecBuilder.kt
new file mode 100644
index 0000000..a523193
--- /dev/null
+++ b/appactions/interaction/interaction-capabilities-core/src/main/java/androidx/appactions/interaction/capabilities/core/impl/spec/ActionSpecBuilder.kt
@@ -0,0 +1,277 @@
+/*
+ * Copyright 2023 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 androidx.appactions.interaction.capabilities.core.impl.spec
+
+import androidx.appactions.interaction.capabilities.core.impl.BuilderOf
+import androidx.appactions.interaction.capabilities.core.impl.converters.EntityConverter
+import androidx.appactions.interaction.capabilities.core.impl.converters.ParamValueConverter
+import androidx.appactions.interaction.capabilities.core.impl.converters.SlotTypeConverter
+import androidx.appactions.interaction.capabilities.core.impl.spec.ParamBinding.ArgumentSetter
+import androidx.appactions.interaction.capabilities.core.impl.spec.ParamBinding.Companion.create
+import androidx.appactions.interaction.capabilities.core.impl.utils.ImmutableCollectors
+import androidx.appactions.interaction.capabilities.core.properties.Property
+import androidx.appactions.interaction.proto.AppActionsContext
+import androidx.appactions.interaction.proto.ParamValue
+import java.util.Optional
+import java.util.function.BiConsumer
+import java.util.function.Function
+import java.util.function.Supplier
+
+/**
+ * A builder for the `ActionSpec`.
+ */
+class ActionSpecBuilder<ArgumentsT, ArgumentsBuilderT : BuilderOf<ArgumentsT>, OutputT>
+private constructor(
+ private val capabilityName: String,
+ private val argumentBuilderSupplier: Supplier<ArgumentsBuilderT>
+) {
+ private val paramBindingList: MutableList<ParamBinding<ArgumentsT, ArgumentsBuilderT>> =
+ ArrayList()
+ private val outputBindings: MutableMap<String, Function<OutputT, List<ParamValue>>> = HashMap()
+
+ /** Sets the property type and returns a new `ActionSpecBuilder`. */
+ /** Sets the argument type and its builder and returns a new `ActionSpecBuilder`. */
+ @Suppress("UNUSED_PARAMETER")
+ fun <NewArgumentsT, NewArgumentsBuilderT : BuilderOf<NewArgumentsT>> setArguments(
+ unused: Class<NewArgumentsT>,
+ argumentBuilderSupplier: Supplier<NewArgumentsBuilderT>
+ ): ActionSpecBuilder<NewArgumentsT, NewArgumentsBuilderT, OutputT> {
+ return ActionSpecBuilder(this.capabilityName, argumentBuilderSupplier)
+ }
+
+ @Suppress("UNUSED_PARAMETER")
+ fun <NewOutputT> setOutput(
+ unused: Class<NewOutputT>
+ ): ActionSpecBuilder<ArgumentsT, ArgumentsBuilderT, NewOutputT> {
+ return ActionSpecBuilder(this.capabilityName, this.argumentBuilderSupplier)
+ }
+
+ /**
+ * Binds the parameter name, getter and setter.
+ *
+ * @param paramName the name of this action' parameter.
+ * @param paramGetter a getter of the param-specific info from the property.
+ * @param argumentSetter a setter to the argument with the input from `ParamValue`.
+ * @return the builder itself.
+ */
+ private fun bindParameterInternal(
+ paramName: String,
+ paramGetter: Function<Map<String, Property<*>>,
+ Optional<AppActionsContext.IntentParameter>>,
+ argumentSetter: ArgumentSetter<ArgumentsBuilderT>
+ ): ActionSpecBuilder<ArgumentsT, ArgumentsBuilderT, OutputT> {
+ paramBindingList.add(create(paramName, paramGetter, argumentSetter))
+ return this
+ }
+
+ /**
+ * Binds the parameter name, getter, and setter for a [Property].
+ *
+ *
+ * This parameter is required for any capability built from the generated [ActionSpec].
+ *
+ * @param paramName the name of this action' parameter.
+ * @param propertyGetter a getter of the Property from the property, which must be able to
+ * fetch a non-null `Property` from `PropertyT`.
+ * @param paramConsumer a setter to set the string value in the argument builder.
+ * @param paramValueConverter converter FROM assistant ParamValue proto
+ * @param entityConverter converter TO assistant Entity proto
+ * @return the builder itself.
+ */
+ fun <T, PossibleValueT> bindParameter(
+ paramName: String,
+ propertyGetter: Function<Map<String, Property<*>>, Property<PossibleValueT>>,
+ paramConsumer: BiConsumer<in ArgumentsBuilderT, T>,
+ paramValueConverter: ParamValueConverter<T>,
+ entityConverter: EntityConverter<PossibleValueT>
+ ): ActionSpecBuilder<ArgumentsT, ArgumentsBuilderT, OutputT> {
+ return bindOptionalParameter(
+ paramName,
+ { propertyMap ->
+ Optional.of(propertyGetter.apply(propertyMap))
+ },
+ paramConsumer,
+ paramValueConverter,
+ entityConverter
+ )
+ }
+
+ /**
+ * Binds the parameter name, getter, and setter for a [Property].
+ *
+ *
+ * This parameter is optional for any capability built from the generated [ActionSpec].
+ * If the Property Optional is not set, this parameter will not exist in the parameter
+ * definition of the capability.
+ *
+ * @param paramName the name of this action' parameter.
+ * @param optionalPropertyGetter an optional getter of the Property from the property,
+ * which may be able to fetch a non-null `Property` from `PropertyT`,
+ * or get [Optional.empty].
+ * @param paramConsumer a setter to set the string value in the argument builder.
+ * @param paramValueConverter converter FROM assistant ParamValue proto
+ * @param entityConverter converter TO assistant Entity proto
+ * @return the builder itself.
+ */
+ fun <T, PossibleValueT> bindOptionalParameter(
+ paramName: String,
+ optionalPropertyGetter: Function<Map<String, Property<*>>,
+ Optional<Property<PossibleValueT>>>,
+ paramConsumer: BiConsumer<in ArgumentsBuilderT, T>,
+ paramValueConverter: ParamValueConverter<T>,
+ entityConverter: EntityConverter<PossibleValueT>
+ ): ActionSpecBuilder<ArgumentsT, ArgumentsBuilderT, OutputT> {
+ return bindParameterInternal(
+ paramName,
+ { propertyMap ->
+ optionalPropertyGetter
+ .apply(propertyMap)
+ .map { property ->
+ buildIntentParameter(paramName, property, entityConverter)
+ }
+ }
+ ) { argBuilder: ArgumentsBuilderT, paramList: List<ParamValue?> ->
+ if (paramList.isNotEmpty()) {
+ paramConsumer.accept(
+ argBuilder,
+ SlotTypeConverter.ofSingular(paramValueConverter).convert(paramList)
+ )
+ }
+ }
+ }
+
+ /**
+ * This is similar to [ActionSpecBuilder.bindOptionalParameter] but for setting a list of
+ * entities instead.
+ *
+ *
+ * This parameter is optional for any capability built from the generated [ActionSpec].
+ * If the Property Optional is not set, this parameter will not exist in the parameter
+ * definition of the capability.
+ */
+ fun <T, PossibleValueT> bindRepeatedParameter(
+ paramName: String,
+ optionalPropertyGetter: Function<Map<String, Property<*>>,
+ Optional<Property<PossibleValueT>>>,
+ paramConsumer: BiConsumer<in ArgumentsBuilderT, List<T>>,
+ paramValueConverter: ParamValueConverter<T>,
+ entityConverter: EntityConverter<PossibleValueT>
+ ): ActionSpecBuilder<ArgumentsT, ArgumentsBuilderT, OutputT> {
+ return bindParameterInternal(
+ paramName,
+ { propertyMap ->
+ optionalPropertyGetter
+ .apply(propertyMap)
+ .map { property ->
+ buildIntentParameter(paramName, property, entityConverter)
+ }
+ }
+ ) { argBuilder: ArgumentsBuilderT, paramList: List<ParamValue?>? ->
+ paramConsumer.accept(
+ argBuilder,
+ SlotTypeConverter.ofRepeated(paramValueConverter).convert(paramList!!)
+ )
+ }
+ }
+
+ /**
+ * Binds an optional output.
+ *
+ * @param name the BII output slot name of this parameter.
+ * @param outputFieldGetter a getter of the output from the `OutputT` instance.
+ * @param converter a converter from an output object to a ParamValue.
+ */
+ fun <T> bindOptionalOutput(
+ name: String,
+ outputFieldGetter: Function<OutputT, T?>,
+ converter: Function<T, ParamValue>
+ ): ActionSpecBuilder<ArgumentsT, ArgumentsBuilderT, OutputT> {
+ outputBindings[name] = Function { output: OutputT ->
+ val outputField: T? = outputFieldGetter.apply(output)
+ val paramValues: MutableList<ParamValue> =
+ ArrayList()
+ if (outputField != null) {
+ paramValues.add(converter.apply(outputField))
+ }
+ paramValues.toList()
+ }
+ return this
+ }
+
+ /**
+ * Binds a repeated output.
+ *
+ * @param name the BII output slot name of this parameter.
+ * @param outputGetter a getter of the output from the `OutputT` instance.
+ * @param converter a converter from an output object to a ParamValue.
+ */
+ fun <T> bindRepeatedOutput(
+ name: String,
+ outputGetter: Function<OutputT, List<T>>,
+ converter: Function<T, ParamValue>
+ ): ActionSpecBuilder<ArgumentsT, ArgumentsBuilderT, OutputT> {
+ outputBindings[name] = Function { output: OutputT ->
+ outputGetter.apply(output).stream()
+ .map(converter)
+ .collect(ImmutableCollectors.toImmutableList())
+ }
+ return this
+ }
+
+ /** Builds an `ActionSpec` from this builder. */
+ fun build(): ActionSpec<ArgumentsT, OutputT> {
+ return ActionSpecImpl(
+ capabilityName,
+ argumentBuilderSupplier,
+ paramBindingList.toList(),
+ outputBindings.toMap()
+ )
+ }
+
+ companion object {
+ /**
+ * Creates an empty `ActionSpecBuilder` with the given capability name. ArgumentsT is set
+ * to Object as a placeholder, which must be replaced by calling setArgument.
+ */
+ fun ofCapabilityNamed(
+ capabilityName: String
+ ): ActionSpecBuilder<Any, BuilderOf<Any>, Any> {
+ return ActionSpecBuilder(capabilityName) { BuilderOf { Object() } }
+ }
+
+ /** Create IntentParameter proto from a Property. */
+ internal fun <T> buildIntentParameter(
+ paramName: String,
+ property: Property<T>,
+ entityConverter: EntityConverter<T>
+ ): AppActionsContext.IntentParameter {
+ val builder = AppActionsContext.IntentParameter.newBuilder()
+ .setName(paramName)
+ .setIsRequired(property.isRequired)
+ .setEntityMatchRequired(property.isValueMatchRequired)
+ .setIsProhibited(property.isProhibited)
+ property.possibleValues.stream()
+ .map { possibleValue ->
+ entityConverter.convert(possibleValue)
+ }
+ .forEach { entityProto ->
+ builder.addPossibleEntities(entityProto)
+ }
+ return builder.build()
+ }
+ }
+}
\ No newline at end of file
diff --git a/appactions/interaction/interaction-capabilities-core/src/main/java/androidx/appactions/interaction/capabilities/core/impl/spec/ActionSpecImpl.java b/appactions/interaction/interaction-capabilities-core/src/main/java/androidx/appactions/interaction/capabilities/core/impl/spec/ActionSpecImpl.java
deleted file mode 100644
index 8dfdb19..0000000
--- a/appactions/interaction/interaction-capabilities-core/src/main/java/androidx/appactions/interaction/capabilities/core/impl/spec/ActionSpecImpl.java
+++ /dev/null
@@ -1,111 +0,0 @@
-/*
- * Copyright 2023 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 androidx.appactions.interaction.capabilities.core.impl.spec;
-
-import static androidx.appactions.interaction.capabilities.core.impl.utils.ImmutableCollectors.toImmutableList;
-
-import androidx.annotation.NonNull;
-import androidx.appactions.interaction.capabilities.core.impl.BuilderOf;
-import androidx.appactions.interaction.capabilities.core.impl.exceptions.StructConversionException;
-import androidx.appactions.interaction.capabilities.core.properties.Property;
-import androidx.appactions.interaction.proto.AppActionsContext.AppAction;
-import androidx.appactions.interaction.proto.FulfillmentResponse.StructuredOutput;
-import androidx.appactions.interaction.proto.ParamValue;
-
-import java.util.List;
-import java.util.Map;
-import java.util.Optional;
-import java.util.function.Function;
-import java.util.function.Supplier;
-
-/** The implementation of {@code ActionSpec} interface. */
-final class ActionSpecImpl<
- ArgumentsT, ArgumentsBuilderT extends BuilderOf<ArgumentsT>, OutputT>
- implements ActionSpec<ArgumentsT, OutputT> {
-
- private final String mCapabilityName;
- private final Supplier<ArgumentsBuilderT> mArgumentBuilderSupplier;
- private final List<ParamBinding<ArgumentsT, ArgumentsBuilderT>> mParamBindingList;
- private final Map<String, Function<OutputT, List<ParamValue>>> mOutputBindings;
-
- ActionSpecImpl(
- String capabilityName,
- Supplier<ArgumentsBuilderT> argumentBuilderSupplier,
- List<ParamBinding<ArgumentsT, ArgumentsBuilderT>> paramBindingList,
- Map<String, Function<OutputT, List<ParamValue>>> outputBindings) {
- this.mCapabilityName = capabilityName;
- this.mArgumentBuilderSupplier = argumentBuilderSupplier;
- this.mParamBindingList = paramBindingList;
- this.mOutputBindings = outputBindings;
- }
-
- @NonNull
- @Override
- public AppAction convertPropertyToProto(@NonNull Map<String, Property<?>> property) {
- return AppAction.newBuilder()
- .setName(mCapabilityName)
- .addAllParams(
- mParamBindingList.stream()
- .map(binding -> binding.paramGetter().apply(property))
- .filter(Optional::isPresent)
- .map(Optional::get)
- .collect(toImmutableList()))
- .build();
- }
-
- @NonNull
- @Override
- public ArgumentsT buildArguments(@NonNull Map<String, List<ParamValue>> args)
- throws StructConversionException {
- ArgumentsBuilderT argumentBuilder = mArgumentBuilderSupplier.get();
- for (ParamBinding<ArgumentsT, ArgumentsBuilderT> binding : mParamBindingList) {
- List<ParamValue> paramValues = args.get(binding.name());
- if (paramValues == null) {
- continue;
- }
- try {
- binding.argumentSetter().setArguments(argumentBuilder, paramValues);
- } catch (StructConversionException e) {
- // Wrap the exception with a more meaningful error message.
- throw new StructConversionException(
- String.format(
- "Failed to parse parameter '%s' from assistant because of "
- + "failure: %s",
- binding.name(), e.getMessage()));
- }
- }
- return argumentBuilder.build();
- }
-
- @NonNull
- @Override
- public StructuredOutput convertOutputToProto(OutputT output) {
- StructuredOutput.Builder outputBuilder = StructuredOutput.newBuilder();
- for (Map.Entry<String, Function<OutputT, List<ParamValue>>> entry :
- mOutputBindings.entrySet()) {
- List<ParamValue> values = entry.getValue().apply(output);
- if (!values.isEmpty()) {
- outputBuilder.addOutputValues(
- StructuredOutput.OutputValue.newBuilder()
- .setName(entry.getKey())
- .addAllValues(values)
- .build());
- }
- }
- return outputBuilder.build();
- }
-}
diff --git a/appactions/interaction/interaction-capabilities-core/src/main/java/androidx/appactions/interaction/capabilities/core/impl/spec/ActionSpecImpl.kt b/appactions/interaction/interaction-capabilities-core/src/main/java/androidx/appactions/interaction/capabilities/core/impl/spec/ActionSpecImpl.kt
new file mode 100644
index 0000000..552b6b7
--- /dev/null
+++ b/appactions/interaction/interaction-capabilities-core/src/main/java/androidx/appactions/interaction/capabilities/core/impl/spec/ActionSpecImpl.kt
@@ -0,0 +1,85 @@
+/*
+ * Copyright 2023 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 androidx.appactions.interaction.capabilities.core.impl.spec
+
+import androidx.appactions.interaction.capabilities.core.impl.BuilderOf
+import androidx.appactions.interaction.capabilities.core.impl.exceptions.StructConversionException
+import androidx.appactions.interaction.capabilities.core.impl.utils.ImmutableCollectors
+import androidx.appactions.interaction.capabilities.core.properties.Property
+import androidx.appactions.interaction.proto.AppActionsContext
+import androidx.appactions.interaction.proto.FulfillmentResponse
+import androidx.appactions.interaction.proto.ParamValue
+import java.util.function.Function
+import java.util.function.Supplier
+
+/** The implementation of `ActionSpec` interface. */
+internal class ActionSpecImpl<ArgumentsT, ArgumentsBuilderT : BuilderOf<ArgumentsT>, OutputT>(
+ private val capabilityName: String,
+ private val argumentBuilderSupplier: Supplier<ArgumentsBuilderT>,
+ private val paramBindingList: List<ParamBinding<ArgumentsT, ArgumentsBuilderT>>,
+ private val outputBindings: Map<String, Function<OutputT, List<ParamValue>>>
+) : ActionSpec<ArgumentsT, OutputT> {
+
+ override fun convertPropertyToProto(
+ property: Map<String, Property<*>>
+ ): AppActionsContext.AppAction {
+ return AppActionsContext.AppAction.newBuilder()
+ .setName(capabilityName)
+ .addAllParams(
+ paramBindingList.stream()
+ .map { binding -> binding.paramGetter.apply(property) }
+ .filter { optional -> optional.isPresent }
+ .map { optional -> optional.get() }
+ .collect(ImmutableCollectors.toImmutableList())
+ )
+ .build()
+ }
+
+ @Throws(StructConversionException::class)
+ override fun buildArguments(args: Map<String, List<ParamValue>>): ArgumentsT {
+ val argumentBuilder = argumentBuilderSupplier.get()
+ paramBindingList.forEach { binding ->
+ val paramValues = args[binding.name] ?: return@forEach
+ try {
+ binding.argumentSetter.setArguments(argumentBuilder, paramValues)
+ } catch (e: StructConversionException) {
+ // Wrap the exception with a more meaningful error message.
+ throw StructConversionException(
+ "Failed to parse parameter '${binding.name}' from assistant because of" +
+ " failure: ${e.message}"
+ )
+ }
+ }
+ return argumentBuilder.build()
+ }
+
+ override fun convertOutputToProto(output: OutputT): FulfillmentResponse.StructuredOutput {
+ val outputBuilder = FulfillmentResponse.StructuredOutput.newBuilder()
+ outputBindings.entries.forEach { entry ->
+ val paramValues = entry.value.apply(output)
+ if (paramValues.isNotEmpty()) {
+ outputBuilder.addOutputValues(
+ FulfillmentResponse.StructuredOutput.OutputValue.newBuilder()
+ .setName(entry.key)
+ .addAllValues(paramValues)
+ .build()
+ )
+ }
+ }
+ return outputBuilder.build()
+ }
+}
\ No newline at end of file
diff --git a/appactions/interaction/interaction-capabilities-core/src/main/java/androidx/appactions/interaction/capabilities/core/impl/spec/ParamBinding.java b/appactions/interaction/interaction-capabilities-core/src/main/java/androidx/appactions/interaction/capabilities/core/impl/spec/ParamBinding.java
deleted file mode 100644
index 87ce323..0000000
--- a/appactions/interaction/interaction-capabilities-core/src/main/java/androidx/appactions/interaction/capabilities/core/impl/spec/ParamBinding.java
+++ /dev/null
@@ -1,82 +0,0 @@
-/*
- * Copyright 2023 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 androidx.appactions.interaction.capabilities.core.impl.spec;
-
-import androidx.annotation.NonNull;
-import androidx.appactions.interaction.capabilities.core.impl.BuilderOf;
-import androidx.appactions.interaction.capabilities.core.impl.exceptions.StructConversionException;
-import androidx.appactions.interaction.capabilities.core.properties.Property;
-import androidx.appactions.interaction.proto.AppActionsContext.IntentParameter;
-import androidx.appactions.interaction.proto.ParamValue;
-
-import com.google.auto.value.AutoValue;
-
-import java.util.List;
-import java.util.Map;
-import java.util.Optional;
-import java.util.function.Function;
-
-/**
- * A binding between a parameter and its Property converter / Argument setter.
- */
-@AutoValue
-public abstract class ParamBinding<
- ArgumentsT, ArgumentsBuilderT extends BuilderOf<ArgumentsT>> {
-
- static <ArgumentsT, ArgumentsBuilderT extends BuilderOf<ArgumentsT>>
- ParamBinding<ArgumentsT, ArgumentsBuilderT> create(
- String name,
- Function<Map<String, Property<?>>,
- Optional<IntentParameter>> paramGetter,
- ArgumentSetter<ArgumentsBuilderT> argumentSetter) {
- return new AutoValue_ParamBinding<>(name, paramGetter, argumentSetter);
- }
-
- /** Returns the name of this param. */
- @NonNull
- public abstract String name();
-
- /**
- * Converts a {@code Property Map} to an {@code IntentParameter} proto. The resulting proto is
- * the
- * format which we send the current params to Assistant (via. app actions context).
- */
- @NonNull
- public abstract Function<Map<String, Property<?>>,
- Optional<IntentParameter>> paramGetter();
-
- /**
- * Populates the {@code ArgumentsBuilderT} for this param with the {@code ParamValue} sent from
- * Assistant in Fulfillment.
- */
- @NonNull
- public abstract ArgumentSetter<ArgumentsBuilderT> argumentSetter();
-
- /**
- * Given a {@code List<ParamValue>}, convert it to user-visible type and set it into
- * ArgumentBuilder.
- *
- * @param <ArgumentsBuilderT>
- */
- @FunctionalInterface
- public interface ArgumentSetter<ArgumentsBuilderT> {
-
- /** Conversion from protos to user-visible type. */
- void setArguments(@NonNull ArgumentsBuilderT builder, @NonNull List<ParamValue> paramValues)
- throws StructConversionException;
- }
-}
diff --git a/appactions/interaction/interaction-capabilities-core/src/main/java/androidx/appactions/interaction/capabilities/core/impl/spec/ParamBinding.kt b/appactions/interaction/interaction-capabilities-core/src/main/java/androidx/appactions/interaction/capabilities/core/impl/spec/ParamBinding.kt
new file mode 100644
index 0000000..ffe3807
--- /dev/null
+++ b/appactions/interaction/interaction-capabilities-core/src/main/java/androidx/appactions/interaction/capabilities/core/impl/spec/ParamBinding.kt
@@ -0,0 +1,53 @@
+/*
+ * Copyright 2023 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 androidx.appactions.interaction.capabilities.core.impl.spec
+
+import androidx.appactions.interaction.capabilities.core.impl.BuilderOf
+import androidx.appactions.interaction.capabilities.core.impl.exceptions.StructConversionException
+import androidx.appactions.interaction.capabilities.core.properties.Property
+import androidx.appactions.interaction.proto.AppActionsContext.IntentParameter
+import androidx.appactions.interaction.proto.ParamValue
+import java.util.Optional
+import java.util.function.Function
+
+data class ParamBinding<ArgumentsT, ArgumentsBuilderT : BuilderOf<ArgumentsT>>
+internal constructor(
+ val name: String,
+ val paramGetter: Function<Map<String, Property<*>>, Optional<IntentParameter>>,
+ val argumentSetter: ArgumentSetter<ArgumentsBuilderT>
+) {
+ /**
+ * Given a `List<ParamValue>`, convert it to user-visible type and set it into
+ * ArgumentBuilder.
+ */
+ fun interface ArgumentSetter<ArgumentsBuilderT> {
+ /** Conversion from protos to user-visible type. */
+ @Throws(StructConversionException::class)
+ fun setArguments(builder: ArgumentsBuilderT, paramValues: List<ParamValue>)
+ }
+
+ companion object {
+ @JvmStatic
+ fun <ArgumentsT, ArgumentsBuilderT : BuilderOf<ArgumentsT>> create(
+ name: String,
+ paramGetter: Function<Map<String, Property<*>>, Optional<IntentParameter>>,
+ argumentSetter: ArgumentSetter<ArgumentsBuilderT>
+ ): ParamBinding<ArgumentsT, ArgumentsBuilderT> {
+ return ParamBinding(name, paramGetter, argumentSetter)
+ }
+ }
+}
diff --git a/appactions/interaction/interaction-capabilities-core/src/main/java/androidx/appactions/interaction/capabilities/core/impl/task/AppGroundingResult.java b/appactions/interaction/interaction-capabilities-core/src/main/java/androidx/appactions/interaction/capabilities/core/impl/task/AppGroundingResult.java
deleted file mode 100644
index 9145141..0000000
--- a/appactions/interaction/interaction-capabilities-core/src/main/java/androidx/appactions/interaction/capabilities/core/impl/task/AppGroundingResult.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * Copyright 2023 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 androidx.appactions.interaction.capabilities.core.impl.task;
-
-import androidx.appactions.interaction.proto.CurrentValue;
-import androidx.appactions.interaction.proto.ParamValue;
-
-import com.google.auto.value.AutoOneOf;
-
-/**
- * Helper object to express if the grounding step of argument processing was successul for a single
- * ParamValue.
- */
-@AutoOneOf(AppGroundingResult.Kind.class)
-abstract class AppGroundingResult {
- static AppGroundingResult ofSuccess(ParamValue paramValue) {
- return AutoOneOf_AppGroundingResult.success(paramValue);
- }
-
- static AppGroundingResult ofFailure(CurrentValue currentValue) {
- return AutoOneOf_AppGroundingResult.failure(currentValue);
- }
-
- public abstract Kind getKind();
-
- abstract ParamValue success();
-
- abstract CurrentValue failure();
-
- enum Kind {
- SUCCESS,
- FAILURE
- }
-}
diff --git a/appactions/interaction/interaction-capabilities-core/src/main/java/androidx/appactions/interaction/capabilities/core/impl/task/AppGroundingResult.kt b/appactions/interaction/interaction-capabilities-core/src/main/java/androidx/appactions/interaction/capabilities/core/impl/task/AppGroundingResult.kt
new file mode 100644
index 0000000..f2463cd
--- /dev/null
+++ b/appactions/interaction/interaction-capabilities-core/src/main/java/androidx/appactions/interaction/capabilities/core/impl/task/AppGroundingResult.kt
@@ -0,0 +1,40 @@
+/*
+ * Copyright 2023 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 androidx.appactions.interaction.capabilities.core.impl.task
+
+import androidx.appactions.interaction.proto.CurrentValue
+import androidx.appactions.interaction.proto.ParamValue
+
+data class AppGroundingResult private constructor(
+ val kind: Kind,
+ val success: ParamValue?,
+ val failure: CurrentValue?
+) {
+ enum class Kind {
+ SUCCESS,
+ FAILURE
+ }
+
+ companion object {
+ @JvmStatic
+ fun ofSuccess(paramValue: ParamValue) = AppGroundingResult(Kind.SUCCESS, paramValue, null)
+
+ @JvmStatic
+ fun ofFailure(currentValue: CurrentValue) =
+ AppGroundingResult(Kind.FAILURE, null, currentValue)
+ }
+}
\ No newline at end of file
diff --git a/appactions/interaction/interaction-capabilities-core/src/main/java/androidx/appactions/interaction/capabilities/core/impl/task/OnReadyToConfirmListenerInternal.kt b/appactions/interaction/interaction-capabilities-core/src/main/java/androidx/appactions/interaction/capabilities/core/impl/task/OnReadyToConfirmListenerInternal.kt
index e9adb16..ffbfb24 100644
--- a/appactions/interaction/interaction-capabilities-core/src/main/java/androidx/appactions/interaction/capabilities/core/impl/task/OnReadyToConfirmListenerInternal.kt
+++ b/appactions/interaction/interaction-capabilities-core/src/main/java/androidx/appactions/interaction/capabilities/core/impl/task/OnReadyToConfirmListenerInternal.kt
@@ -17,7 +17,6 @@
import androidx.appactions.interaction.capabilities.core.ConfirmationOutput
import androidx.appactions.interaction.capabilities.core.impl.exceptions.StructConversionException
-import androidx.appactions.interaction.capabilities.core.impl.task.exceptions.MissingRequiredArgException
import androidx.appactions.interaction.proto.ParamValue
/**
@@ -27,7 +26,7 @@
*/
interface OnReadyToConfirmListenerInternal<ConfirmationT> {
/** onReadyToConfirm callback for a task capability. */
- @Throws(StructConversionException::class, MissingRequiredArgException::class)
+ @Throws(StructConversionException::class)
suspend fun onReadyToConfirm(
args: Map<String, List<ParamValue>>
): ConfirmationOutput<ConfirmationT>
diff --git a/appactions/interaction/interaction-capabilities-core/src/main/java/androidx/appactions/interaction/capabilities/core/impl/task/TaskOrchestrator.kt b/appactions/interaction/interaction-capabilities-core/src/main/java/androidx/appactions/interaction/capabilities/core/impl/task/TaskOrchestrator.kt
index b21e563..f39671e 100644
--- a/appactions/interaction/interaction-capabilities-core/src/main/java/androidx/appactions/interaction/capabilities/core/impl/task/TaskOrchestrator.kt
+++ b/appactions/interaction/interaction-capabilities-core/src/main/java/androidx/appactions/interaction/capabilities/core/impl/task/TaskOrchestrator.kt
@@ -29,7 +29,6 @@
import androidx.appactions.interaction.capabilities.core.impl.spec.ActionSpec
import androidx.appactions.interaction.capabilities.core.impl.task.exceptions.InvalidResolverException
import androidx.appactions.interaction.capabilities.core.impl.task.exceptions.MissingEntityConverterException
-import androidx.appactions.interaction.capabilities.core.impl.task.exceptions.MissingRequiredArgException
import androidx.appactions.interaction.capabilities.core.impl.task.exceptions.MissingSearchActionConverterException
import androidx.appactions.interaction.capabilities.core.impl.utils.CapabilityLogger
import androidx.appactions.interaction.capabilities.core.impl.utils.LoggerInternal
@@ -184,7 +183,7 @@
val callback = assistantUpdateRequest.callbackInternal
try {
val fulfillmentResult: FulfillmentResult = when (
- argumentsWrapper.requestMetadata?.requestType()
+ argumentsWrapper.requestMetadata?.requestType
) {
FulfillmentRequest.Fulfillment.Type.SYNC -> handleSync(argumentsWrapper)
FulfillmentRequest.Fulfillment.Type.CONFIRM -> handleConfirm()
@@ -272,7 +271,7 @@
*
* Otherwise, the future contains a FulfillmentResponse containing BIC or BIO data.
*/
- @Throws(StructConversionException::class, MissingRequiredArgException::class)
+ @Throws(StructConversionException::class)
private suspend fun maybeConfirmOrExecute(): FulfillmentResponse {
val finalArguments = getCurrentAcceptedArguments()
if (
@@ -342,7 +341,6 @@
* validation) are executed asynchronously.
*/
@Throws(
- MissingEntityConverterException::class,
MissingSearchActionConverterException::class,
StructConversionException::class,
InvalidResolverException::class,
@@ -448,7 +446,7 @@
}
}
- @Throws(StructConversionException::class, MissingRequiredArgException::class)
+ @Throws(StructConversionException::class)
private suspend fun getFulfillmentResponseForConfirmation(
finalArguments: Map<String, List<ParamValue>>,
): FulfillmentResponse {
diff --git a/appactions/interaction/interaction-capabilities-core/src/main/java/androidx/appactions/interaction/capabilities/core/impl/task/TaskSlotProcessor.kt b/appactions/interaction/interaction-capabilities-core/src/main/java/androidx/appactions/interaction/capabilities/core/impl/task/TaskSlotProcessor.kt
index 1ab2990..fee2fd0 100644
--- a/appactions/interaction/interaction-capabilities-core/src/main/java/androidx/appactions/interaction/capabilities/core/impl/task/TaskSlotProcessor.kt
+++ b/appactions/interaction/interaction-capabilities-core/src/main/java/androidx/appactions/interaction/capabilities/core/impl/task/TaskSlotProcessor.kt
@@ -25,7 +25,6 @@
import androidx.appactions.interaction.proto.CurrentValue
import androidx.appactions.interaction.proto.DisambiguationData
import androidx.appactions.interaction.proto.ParamValue
-import kotlin.IllegalStateException
import kotlin.String
import kotlin.Throws
@@ -114,7 +113,6 @@
)
}
AppGroundingResult.Kind.FAILURE -> AppGroundingResult.ofFailure(pendingValue)
- else -> throw IllegalStateException("unreachable")
}
/** enqueues processing of a pending value that requires app-driven grounding. */
@@ -132,7 +130,6 @@
when (groundingResult.kind) {
AppGroundingResult.Kind.SUCCESS -> ground(pendingValue.value, taskParamBinding)
AppGroundingResult.Kind.FAILURE -> AppGroundingResult.ofFailure(pendingValue)
- else -> throw IllegalStateException("unreachable")
}
/**
@@ -149,9 +146,8 @@
ungroundedValues: MutableList<CurrentValue>,
): AppGroundingResult {
when (groundingResult.kind) {
- AppGroundingResult.Kind.SUCCESS -> groundedValues.add(groundingResult.success())
- AppGroundingResult.Kind.FAILURE -> ungroundedValues.add(groundingResult.failure())
- else -> throw IllegalStateException("unreachable")
+ AppGroundingResult.Kind.SUCCESS -> groundedValues.add(groundingResult.success!!)
+ AppGroundingResult.Kind.FAILURE -> ungroundedValues.add(groundingResult.failure!!)
}
return groundingResult
}
diff --git a/appactions/interaction/interaction-capabilities-core/src/main/java/androidx/appactions/interaction/capabilities/core/impl/task/exceptions/MissingRequiredArgException.java b/appactions/interaction/interaction-capabilities-core/src/main/java/androidx/appactions/interaction/capabilities/core/impl/task/exceptions/MissingRequiredArgException.java
deleted file mode 100644
index 32b3fda..0000000
--- a/appactions/interaction/interaction-capabilities-core/src/main/java/androidx/appactions/interaction/capabilities/core/impl/task/exceptions/MissingRequiredArgException.java
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- * Copyright 2023 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 androidx.appactions.interaction.capabilities.core.impl.task.exceptions;
-
-import androidx.annotation.NonNull;
-
-/**
- * During the onExecuteListener handling, all required params should be present in the Map sent to
- * the listener. If they are not for some reason, this is an internal error.
- */
-public final class MissingRequiredArgException extends Exception {
-
- public MissingRequiredArgException(@NonNull String message) {
- super(message);
- }
-}
diff --git a/appactions/interaction/interaction-capabilities-core/src/test/java/androidx/appactions/interaction/capabilities/core/impl/SingleTurnCapabilityTest.kt b/appactions/interaction/interaction-capabilities-core/src/test/java/androidx/appactions/interaction/capabilities/core/impl/SingleTurnCapabilityTest.kt
index 02055bb..1d81ebd 100644
--- a/appactions/interaction/interaction-capabilities-core/src/test/java/androidx/appactions/interaction/capabilities/core/impl/SingleTurnCapabilityTest.kt
+++ b/appactions/interaction/interaction-capabilities-core/src/test/java/androidx/appactions/interaction/capabilities/core/impl/SingleTurnCapabilityTest.kt
@@ -327,14 +327,12 @@
companion object {
val ACTION_SPEC: ActionSpec<Arguments, Output> =
- ActionSpecBuilder.ofCapabilityNamed(
- "actions.intent.TEST"
- )
+ ActionSpecBuilder.ofCapabilityNamed("actions.intent.TEST")
.setArguments(Arguments::class.java, Arguments::Builder)
.setOutput(Output::class.java)
.bindParameter(
"requiredString",
- { properties -> properties["requiredEntity"] as Property<StringValue>? },
+ { properties -> properties["requiredEntity"] as Property<StringValue> },
Arguments.Builder::setRequiredStringField,
TypeConverters.STRING_PARAM_VALUE_CONVERTER,
TypeConverters.STRING_VALUE_ENTITY_CONVERTER
@@ -353,7 +351,7 @@
)
.bindOptionalOutput(
"optionalStringOutput",
- { output -> Optional.ofNullable(output.optionalStringField) },
+ Output::optionalStringField,
TypeConverters.STRING_PARAM_VALUE_CONVERTER::toParamValue
)
.build()
diff --git a/appactions/interaction/interaction-capabilities-core/src/test/java/androidx/appactions/interaction/capabilities/core/impl/spec/ActionSpecTest.java b/appactions/interaction/interaction-capabilities-core/src/test/java/androidx/appactions/interaction/capabilities/core/impl/spec/ActionSpecTest.java
index 10c3576..ec07c27 100644
--- a/appactions/interaction/interaction-capabilities-core/src/test/java/androidx/appactions/interaction/capabilities/core/impl/spec/ActionSpecTest.java
+++ b/appactions/interaction/interaction-capabilities-core/src/test/java/androidx/appactions/interaction/capabilities/core/impl/spec/ActionSpecTest.java
@@ -19,20 +19,22 @@
import static com.google.common.truth.Truth.assertThat;
import androidx.annotation.NonNull;
-import androidx.appactions.interaction.capabilities.core.impl.BuilderOf;
import androidx.appactions.interaction.capabilities.core.impl.converters.EntityConverter;
import androidx.appactions.interaction.capabilities.core.impl.converters.ParamValueConverter;
import androidx.appactions.interaction.capabilities.core.impl.converters.TypeConverters;
import androidx.appactions.interaction.capabilities.core.properties.Property;
import androidx.appactions.interaction.capabilities.core.properties.StringValue;
+import androidx.appactions.interaction.capabilities.core.testing.spec.Arguments;
+import androidx.appactions.interaction.capabilities.core.testing.spec.GenericEntityArguments;
import androidx.appactions.interaction.capabilities.core.testing.spec.Output;
+import androidx.appactions.interaction.capabilities.core.testing.spec.TestEntity;
import androidx.appactions.interaction.proto.AppActionsContext.AppAction;
import androidx.appactions.interaction.proto.AppActionsContext.IntentParameter;
import androidx.appactions.interaction.proto.FulfillmentResponse.StructuredOutput;
import androidx.appactions.interaction.proto.FulfillmentResponse.StructuredOutput.OutputValue;
import androidx.appactions.interaction.proto.ParamValue;
-
-import com.google.auto.value.AutoValue;
+import androidx.appactions.interaction.protobuf.Struct;
+import androidx.appactions.interaction.protobuf.Value;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -48,8 +50,8 @@
@SuppressWarnings("unchecked")
public final class ActionSpecTest {
private static final ActionSpec<Arguments, Output> ACTION_SPEC =
- ActionSpecBuilder.ofCapabilityNamed("actions.intent.TEST")
- .setArguments(Arguments.class, Arguments::newBuilder)
+ ActionSpecBuilder.Companion.ofCapabilityNamed("actions.intent.TEST")
+ .setArguments(Arguments.class, Arguments.Builder::new)
.setOutput(Output.class)
.bindParameter(
"requiredString",
@@ -83,87 +85,100 @@
TypeConverters.STRING_VALUE_ENTITY_CONVERTER)
.bindOptionalOutput(
"optionalStringOutput",
- output -> Optional.ofNullable(output.getOptionalStringField()),
+ Output::getOptionalStringField,
TypeConverters.STRING_PARAM_VALUE_CONVERTER::toParamValue)
.bindRepeatedOutput(
"repeatedStringOutput",
Output::getRepeatedStringField,
TypeConverters.STRING_PARAM_VALUE_CONVERTER::toParamValue)
.build();
- private static final ParamValueConverter<String> STRING_PARAM_VALUE_CONVERTER =
- new ParamValueConverter<String>() {
+ private static final ParamValueConverter<TestEntity> TEST_ENTITY_PARAM_VALUE_CONVERTER =
+ new ParamValueConverter<TestEntity>() {
@NonNull
@Override
- public ParamValue toParamValue(String type) {
- return ParamValue.newBuilder().setStringValue(type).build();
+ public ParamValue toParamValue(TestEntity type) {
+ return ParamValue.newBuilder()
+ .setStructValue(
+ Struct.newBuilder()
+ .putFields(
+ "name",
+ Value.newBuilder()
+ .setStringValue(type.getName())
+ .build())
+ .build())
+ .build();
}
@Override
- public String fromParamValue(@NonNull ParamValue paramValue) {
- return "test";
+ public TestEntity fromParamValue(@NonNull ParamValue paramValue) {
+ String name =
+ paramValue.getStructValue().getFieldsOrThrow("name").getStringValue();
+ return new TestEntity.Builder().setName(name).build();
}
};
- private static final EntityConverter<String> STRING_ENTITY_CONVERTER =
- (theString) ->
+ private static final EntityConverter<TestEntity> TEST_ENTITY_CONVERTER =
+ (testEntity) ->
androidx.appactions.interaction.proto.Entity.newBuilder()
- .setIdentifier(theString)
- .setName(theString)
+ .setIdentifier(testEntity.getId())
+ .setName(testEntity.getName())
.build();
- private static final ActionSpec<GenericEntityArguments, Output>
- GENERIC_TYPES_ACTION_SPEC =
- ActionSpecBuilder.ofCapabilityNamed("actions.intent.TEST")
- .setArguments(GenericEntityArguments.class,
- GenericEntityArguments::newBuilder)
+ private static final ActionSpec<GenericEntityArguments, Output> GENERIC_TYPES_ACTION_SPEC =
+ ActionSpecBuilder.Companion.ofCapabilityNamed("actions.intent.TEST")
+ .setArguments(GenericEntityArguments.class, GenericEntityArguments.Builder::new)
.setOutput(Output.class)
.bindParameter(
"requiredEntity",
- properties ->
- {
- return (Property<String>) (properties.get(
- "requiredEntity"));
+ properties -> {
+ return (Property<TestEntity>) (properties.get("requiredEntity"));
},
GenericEntityArguments.Builder::setSingularField,
- STRING_PARAM_VALUE_CONVERTER,
- STRING_ENTITY_CONVERTER)
- .bindOptionalParameter("optionalEntity",
- properties ->
- {
- return Optional.of((Property<String>) (properties.get(
- "optionalEntity")));
+ TEST_ENTITY_PARAM_VALUE_CONVERTER,
+ TEST_ENTITY_CONVERTER)
+ .bindOptionalParameter(
+ "optionalEntity",
+ properties -> {
+ return Optional.of(
+ (Property<TestEntity>) (properties.get("optionalEntity")));
},
GenericEntityArguments.Builder::setOptionalField,
- STRING_PARAM_VALUE_CONVERTER,
- STRING_ENTITY_CONVERTER)
- .bindRepeatedParameter("repeatedEntities",
- properties ->
- {
- return Optional.of((Property<String>) (properties.get(
- "repeatedEntities")));
+ TEST_ENTITY_PARAM_VALUE_CONVERTER,
+ TEST_ENTITY_CONVERTER)
+ .bindRepeatedParameter(
+ "repeatedEntities",
+ properties -> {
+ return Optional.of(
+ (Property<TestEntity>)
+ (properties.get("repeatedEntities")));
},
GenericEntityArguments.Builder::setRepeatedField,
- STRING_PARAM_VALUE_CONVERTER,
- STRING_ENTITY_CONVERTER)
+ TEST_ENTITY_PARAM_VALUE_CONVERTER,
+ TEST_ENTITY_CONVERTER)
.build();
@Test
public void getAppAction_genericParameters() {
Map<String, Property<?>> property = new HashMap<>();
- property.put("requiredEntity",
- new Property.Builder<String>()
+ property.put(
+ "requiredEntity",
+ new Property.Builder<TestEntity>()
.setRequired(true)
- .setPossibleValues("one")
+ .setPossibleValues(
+ new TestEntity.Builder().setId("one").setName("one").build())
.build());
- property.put("optionalEntity",
- new Property.Builder<String>()
+ property.put(
+ "optionalEntity",
+ new Property.Builder<TestEntity>()
.setRequired(true)
- .setPossibleValues("two")
- .build()
- );
- property.put("repeatedEntities",
- new Property.Builder<String>()
+ .setPossibleValues(
+ new TestEntity.Builder().setId("two").setName("two").build())
+ .build());
+ property.put(
+ "repeatedEntities",
+ new Property.Builder<TestEntity>()
.setRequired(true)
- .setPossibleValues("three")
+ .setPossibleValues(
+ new TestEntity.Builder().setId("three").setName("three").build())
.build());
assertThat(GENERIC_TYPES_ACTION_SPEC.convertPropertyToProto(property))
@@ -325,116 +340,4 @@
assertThat(executionOutput.getOutputValuesList())
.containsExactlyElementsIn(expectedExecutionOutput.getOutputValuesList());
}
-
- enum TestEnum {
- VALUE_1,
- VALUE_2,
- }
-
- @AutoValue
- abstract static class Arguments {
-
- static Builder newBuilder() {
- return new AutoValue_ActionSpecTest_Arguments.Builder();
- }
-
- abstract String requiredStringField();
-
- abstract String optionalStringField();
-
- abstract List<String> repeatedStringField();
-
- @AutoValue.Builder
- abstract static class Builder implements BuilderOf<Arguments> {
-
- abstract Builder setRequiredStringField(String value);
-
- abstract Builder setOptionalStringField(String value);
-
- abstract Builder setRepeatedStringField(List<String> repeated);
-
- @NonNull
- @Override
- public abstract Arguments build();
- }
- }
-
- @AutoValue
- abstract static class Properties {
-
- static Properties create(
- Optional<Property<TestEnum>> optionalEnumField,
- Property<StringValue> requiredStringField,
- Optional<Property<StringValue>> optionalStringField,
- Optional<Property<StringValue>> repeatedStringField) {
- return new AutoValue_ActionSpecTest_Properties(
- optionalEnumField,
- requiredStringField,
- optionalStringField,
- repeatedStringField);
- }
-
- static Properties create(
- Property<StringValue> requiredStringField) {
- return create(
- Optional.empty(),
- requiredStringField,
- Optional.empty(),
- Optional.empty());
- }
-
- abstract Optional<Property<TestEnum>> optionalEnumField();
-
- abstract Property<StringValue> requiredStringField();
-
- abstract Optional<Property<StringValue>> optionalStringField();
-
- abstract Optional<Property<StringValue>> repeatedStringField();
- }
-
- @AutoValue
- abstract static class GenericEntityArguments {
-
- static Builder newBuilder() {
- return new AutoValue_ActionSpecTest_GenericEntityArguments.Builder();
- }
-
- abstract String singularField();
-
- abstract String optionalField();
-
- abstract List<String> repeatedField();
-
- @AutoValue.Builder
- abstract static class Builder implements BuilderOf<GenericEntityArguments> {
-
- abstract Builder setSingularField(String value);
-
- abstract Builder setOptionalField(String value);
-
- abstract Builder setRepeatedField(List<String> value);
-
- @NonNull
- @Override
- public abstract GenericEntityArguments build();
- }
- }
-
- @AutoValue
- abstract static class GenericEntityProperty {
-
- static GenericEntityProperty create(
- Property<String> singularField,
- Optional<Property<String>> optionalField,
- Optional<Property<String>> repeatedField) {
- return new AutoValue_ActionSpecTest_GenericEntityProperty(
- singularField, optionalField, repeatedField);
- }
-
- abstract Property<String> singularField();
-
- abstract Optional<Property<String>> optionalField();
-
- abstract Optional<Property<String>> repeatedField();
- }
}
diff --git a/appactions/interaction/interaction-capabilities-core/src/test/java/androidx/appactions/interaction/capabilities/core/task/impl/TaskCapabilityImplTest.kt b/appactions/interaction/interaction-capabilities-core/src/test/java/androidx/appactions/interaction/capabilities/core/task/impl/TaskCapabilityImplTest.kt
index ae89933..899612d 100644
--- a/appactions/interaction/interaction-capabilities-core/src/test/java/androidx/appactions/interaction/capabilities/core/task/impl/TaskCapabilityImplTest.kt
+++ b/appactions/interaction/interaction-capabilities-core/src/test/java/androidx/appactions/interaction/capabilities/core/task/impl/TaskCapabilityImplTest.kt
@@ -201,7 +201,8 @@
createCapability(
SINGLE_REQUIRED_FIELD_PROPERTY,
sessionFactory =
- { _ -> object : ExecutionSession {
+ { _ ->
+ object : ExecutionSession {
override fun onCreate(sessionConfig: SessionConfig) {
onCreateInvocationCount.incrementAndGet()
}
@@ -210,7 +211,8 @@
Futures.immediateFuture(
ExecutionResult.Builder<Output>().build()
)
- } },
+ }
+ },
sessionBridge = SessionBridge { TaskHandler.Builder<Confirmation>().build() },
sessionUpdaterSupplier = ::EmptyTaskUpdater
)
@@ -360,20 +362,23 @@
.build(),
"stringSlotB" to Property.Builder<StringValue>()
.setRequired(true)
- .build(),
+ .build()
)
val sessionFactory:
- (hostProperties: HostProperties?) -> CapabilityTwoStrings.ExecutionSession =
+ (hostProperties: HostProperties?) -> CapabilityTwoStrings.ExecutionSession =
{ _ ->
object : CapabilityTwoStrings.ExecutionSession {
override suspend fun onExecute(
arguments: CapabilityTwoStrings.Arguments
- ): ExecutionResult<Void> = ExecutionResult.Builder<Void>().build()
+ ): ExecutionResult<CapabilityTwoStrings.Output> =
+ ExecutionResult.Builder<CapabilityTwoStrings.Output>().build()
}
}
val sessionBridge =
- SessionBridge<CapabilityTwoStrings.ExecutionSession, Void> {
- TaskHandler.Builder<Void>()
+ SessionBridge<
+ CapabilityTwoStrings.ExecutionSession,
+ CapabilityTwoStrings.Confirmation> {
+ TaskHandler.Builder<CapabilityTwoStrings.Confirmation>()
.registerValueTaskParam(
"stringSlotA",
AUTO_ACCEPT_STRING_VALUE,
@@ -446,23 +451,25 @@
.build(),
"stringSlotB" to Property.Builder<StringValue>()
.setRequired(false)
- .build(),
+ .build()
)
val sessionFactory:
- (hostProperties: HostProperties?) -> CapabilityTwoStrings.ExecutionSession =
+ (hostProperties: HostProperties?) -> CapabilityTwoStrings.ExecutionSession =
{ _ ->
object : CapabilityTwoStrings.ExecutionSession {
override suspend fun onExecute(
arguments: CapabilityTwoStrings.Arguments
- ): ExecutionResult<Void> {
+ ): ExecutionResult<CapabilityTwoStrings.Output> {
onExecuteInvocationCount.incrementAndGet()
- return ExecutionResult.Builder<Void>().build()
+ return ExecutionResult.Builder<CapabilityTwoStrings.Output>().build()
}
}
}
val sessionBridge =
- SessionBridge<CapabilityTwoStrings.ExecutionSession, Void> {
- TaskHandler.Builder<Void>()
+ SessionBridge<
+ CapabilityTwoStrings.ExecutionSession,
+ CapabilityTwoStrings.Confirmation> {
+ TaskHandler.Builder<CapabilityTwoStrings.Confirmation>()
.registerValueTaskParam(
"stringSlotA",
AUTO_ACCEPT_STRING_VALUE,
@@ -531,7 +538,7 @@
"optionalEnum" to Property.Builder<TestEnum>()
.setPossibleValues(TestEnum.VALUE_1, TestEnum.VALUE_2)
.setRequired(true)
- .build(),
+ .build()
)
val capability: Capability =
createCapability(
@@ -618,15 +625,15 @@
SessionBridge<ExecutionSession, Confirmation> { session ->
val builder = TaskHandler.Builder<Confirmation>()
session.requiredStringListener?.let {
- listener: AppEntityListener<String> ->
- builder.registerAppEntityTaskParam(
- "required",
- listener,
- TypeConverters.STRING_PARAM_VALUE_CONVERTER,
- EntityConverter.of(TypeSpec.STRING_TYPE_SPEC),
- getTrivialSearchActionConverter()
- )
- }
+ listener: AppEntityListener<String> ->
+ builder.registerAppEntityTaskParam(
+ "required",
+ listener,
+ TypeConverters.STRING_PARAM_VALUE_CONVERTER,
+ EntityConverter.of(TypeSpec.STRING_TYPE_SPEC),
+ getTrivialSearchActionConverter()
+ )
+ }
builder.build()
},
sessionUpdaterSupplier = ::EmptyTaskUpdater
@@ -720,13 +727,13 @@
fun identifierOnly_refillsStruct() = runBlocking<Unit> {
val property = mapOf(
"listItem" to Property.Builder<
- ListItem,
+ ListItem
>()
.setRequired(true)
.build(),
"anyString" to Property.Builder<StringValue>()
.setRequired(true)
- .build(),
+ .build()
)
val item1: ListItem = ListItem.Builder().setName("red apple").setIdentifier("item1").build()
val item2: ListItem =
@@ -736,15 +743,15 @@
val onExecuteStringDeferred = CompletableDeferred<String>()
val sessionFactory:
- (hostProperties: HostProperties?) -> CapabilityStructFill.ExecutionSession =
+ (hostProperties: HostProperties?) -> CapabilityStructFill.ExecutionSession =
{ _ ->
object : CapabilityStructFill.ExecutionSession {
override suspend fun onExecute(
arguments: CapabilityStructFill.Arguments
- ): ExecutionResult<Void> {
+ ): ExecutionResult<CapabilityStructFill.Output> {
arguments.listItem?.let { onExecuteListItemDeferred.complete(it) }
arguments.anyString?.let { onExecuteStringDeferred.complete(it) }
- return ExecutionResult.Builder<Void>().build()
+ return ExecutionResult.Builder<CapabilityStructFill.Output>().build()
}
override val listItemListener =
@@ -769,8 +776,10 @@
}
}
val sessionBridge =
- SessionBridge<CapabilityStructFill.ExecutionSession, Void> { session ->
- TaskHandler.Builder<Void>()
+ SessionBridge<
+ CapabilityStructFill.ExecutionSession,
+ CapabilityStructFill.Confirmation> { session ->
+ TaskHandler.Builder<CapabilityStructFill.Confirmation>()
.registerAppEntityTaskParam(
"listItem",
session.listItemListener,
@@ -976,7 +985,7 @@
property,
sessionFactory = sessionFactory,
sessionBridge = SessionBridge { TaskHandler.Builder<Confirmation>().build() },
- sessionUpdaterSupplier = ::EmptyTaskUpdater,
+ sessionUpdaterSupplier = ::EmptyTaskUpdater
)
val session = capability.createSession(fakeSessionId, hostProperties)
@@ -984,7 +993,7 @@
val callback = FakeCallbackInternal()
session.execute(
buildRequestArgs(SYNC),
- callback,
+ callback
)
assertThat(callback.receiveResponse()).isNotNull()
assertThat(getCurrentValues("required", session.state!!)).isEmpty()
@@ -993,11 +1002,12 @@
// TURN 2. Providing the required slots so that the task completes and the state gets cleared
val callback2 = FakeCallbackInternal()
session.execute(
- buildRequestArgs(SYNC,
+ buildRequestArgs(
+ SYNC,
"required",
ParamValue.newBuilder().setIdentifier("foo").setStringValue("foo").build()
),
- callback2,
+ callback2
)
assertThat(callback2.receiveResponse().fulfillmentResponse).isNotNull()
assertThat(session.isActive).isEqualTo(false)
@@ -1015,13 +1025,15 @@
}
}
var onReadyToConfirm =
- object : OnReadyToConfirmListenerInternal<Confirmation> {
+ object : OnReadyToConfirmListenerInternal<Confirmation> {
override suspend fun onReadyToConfirm(args: Map<String, List<ParamValue>>):
ConfirmationOutput<Confirmation> {
return ConfirmationOutput.Builder<Confirmation>()
- .setConfirmation(Confirmation.Builder().setOptionalStringField("bar")
- .build())
- .build()
+ .setConfirmation(
+ Confirmation.Builder().setOptionalStringField("bar")
+ .build()
+ )
+ .build()
}
}
val property = mapOf(
@@ -1032,21 +1044,23 @@
property,
sessionFactory = sessionFactory,
sessionBridge = SessionBridge {
- TaskHandler.Builder<Confirmation>()
- .setOnReadyToConfirmListenerInternal(onReadyToConfirm)
- .build() },
- sessionUpdaterSupplier = ::EmptyTaskUpdater,
+ TaskHandler.Builder<Confirmation>()
+ .setOnReadyToConfirmListenerInternal(onReadyToConfirm)
+ .build()
+ },
+ sessionUpdaterSupplier = ::EmptyTaskUpdater
)
val session = capability.createSession(fakeSessionId, hostProperties)
// TURN 1. Providing all the required slots in the SYNC Request
val callback = FakeCallbackInternal()
session.execute(
- buildRequestArgs(SYNC,
+ buildRequestArgs(
+ SYNC,
"required",
ParamValue.newBuilder().setIdentifier("foo").setStringValue("foo").build()
),
- callback,
+ callback
)
assertThat(callback.receiveResponse()).isNotNull()
assertThat(session.isActive).isEqualTo(true)
@@ -1080,18 +1094,19 @@
property,
sessionFactory = sessionFactory,
sessionBridge = SessionBridge { TaskHandler.Builder<Confirmation>().build() },
- sessionUpdaterSupplier = ::EmptyTaskUpdater,
+ sessionUpdaterSupplier = ::EmptyTaskUpdater
)
val session = capability.createSession(fakeSessionId, hostProperties)
// TURN 1. Providing the required slots so that the task completes and the state gets cleared
val callback = FakeCallbackInternal()
session.execute(
- buildRequestArgs(SYNC,
+ buildRequestArgs(
+ SYNC,
"required",
ParamValue.newBuilder().setIdentifier("foo").setStringValue("foo").build()
),
- callback,
+ callback
)
assertThat(callback.receiveResponse().fulfillmentResponse).isNotNull()
assertThat(session.isActive).isEqualTo(false)
@@ -1099,11 +1114,12 @@
// TURN 2. Trying to sync after the session is destroyed
val callback2 = FakeCallbackInternal()
session.execute(
- buildRequestArgs(SYNC,
+ buildRequestArgs(
+ SYNC,
"required",
ParamValue.newBuilder().setIdentifier("foo").setStringValue("foo").build()
),
- callback2,
+ callback2
)
assertThat(session.isActive).isEqualTo(false)
assertThat(callback2.receiveResponse().errorStatus)
@@ -1220,18 +1236,18 @@
}
override val sessionBridge: SessionBridge<ExecutionSession, Confirmation> = SessionBridge {
- session ->
+ session ->
val builder = TaskHandler.Builder<Confirmation>()
session.requiredStringListener?.let {
- listener: AppEntityListener<String> ->
- builder.registerAppEntityTaskParam(
- "required",
- listener,
- TypeConverters.STRING_PARAM_VALUE_CONVERTER,
- EntityConverter.of(TypeSpec.STRING_TYPE_SPEC),
- getTrivialSearchActionConverter()
- )
- }
+ listener: AppEntityListener<String> ->
+ builder.registerAppEntityTaskParam(
+ "required",
+ listener,
+ TypeConverters.STRING_PARAM_VALUE_CONVERTER,
+ EntityConverter.of(TypeSpec.STRING_TYPE_SPEC),
+ getTrivialSearchActionConverter()
+ )
+ }
builder.build()
}
}
@@ -1299,9 +1315,7 @@
.bindParameter(
"required",
{ properties ->
- properties["required"]
- as
- Property<StringValue>?
+ properties["required"] as Property<StringValue>
},
Arguments.Builder::setRequiredStringField,
TypeConverters.STRING_PARAM_VALUE_CONVERTER,
@@ -1345,7 +1359,7 @@
)
.bindOptionalOutput(
"optionalStringOutput",
- { output -> Optional.ofNullable(output.optionalStringField) },
+ Output::optionalStringField,
TypeConverters.STRING_PARAM_VALUE_CONVERTER::toParamValue
)
.bindRepeatedOutput(
diff --git a/appactions/interaction/interaction-capabilities-core/src/test/java/androidx/appactions/interaction/capabilities/core/testing/spec/CapabilityStructFill.kt b/appactions/interaction/interaction-capabilities-core/src/test/java/androidx/appactions/interaction/capabilities/core/testing/spec/CapabilityStructFill.kt
index b4c159e..8415ed7 100644
--- a/appactions/interaction/interaction-capabilities-core/src/test/java/androidx/appactions/interaction/capabilities/core/testing/spec/CapabilityStructFill.kt
+++ b/appactions/interaction/interaction-capabilities-core/src/test/java/androidx/appactions/interaction/capabilities/core/testing/spec/CapabilityStructFill.kt
@@ -73,7 +73,11 @@
}
}
- interface ExecutionSession : BaseExecutionSession<Arguments, Void> {
+ class Output internal constructor()
+
+ class Confirmation internal constructor()
+
+ interface ExecutionSession : BaseExecutionSession<Arguments, Output> {
val listItemListener: AppEntityListener<ListItem>
}
@@ -81,6 +85,7 @@
@Suppress("UNCHECKED_CAST")
val ACTION_SPEC = ActionSpecBuilder.ofCapabilityNamed(CAPABILITY_NAME)
.setArguments(Arguments::class.java, Arguments::Builder)
+ .setOutput(Output::class.java)
.bindOptionalParameter(
"listItem",
{ properties ->
diff --git a/appactions/interaction/interaction-capabilities-core/src/test/java/androidx/appactions/interaction/capabilities/core/testing/spec/CapabilityTwoStrings.kt b/appactions/interaction/interaction-capabilities-core/src/test/java/androidx/appactions/interaction/capabilities/core/testing/spec/CapabilityTwoStrings.kt
index 2114322..542807b 100644
--- a/appactions/interaction/interaction-capabilities-core/src/test/java/androidx/appactions/interaction/capabilities/core/testing/spec/CapabilityTwoStrings.kt
+++ b/appactions/interaction/interaction-capabilities-core/src/test/java/androidx/appactions/interaction/capabilities/core/testing/spec/CapabilityTwoStrings.kt
@@ -70,12 +70,17 @@
}
}
- interface ExecutionSession : BaseExecutionSession<Arguments, Void>
+ class Output internal constructor()
+
+ class Confirmation internal constructor()
+
+ interface ExecutionSession : BaseExecutionSession<Arguments, Output>
companion object {
@Suppress("UNCHECKED_CAST")
val ACTION_SPEC = ActionSpecBuilder.ofCapabilityNamed(CAPABILITY_NAME)
.setArguments(Arguments::class.java, Arguments::Builder)
+ .setOutput(Output::class.java)
.bindOptionalParameter(
"stringSlotA",
{ properties ->
diff --git a/appactions/interaction/interaction-capabilities-core/src/test/java/androidx/appactions/interaction/capabilities/core/testing/spec/GenericEntityArguments.kt b/appactions/interaction/interaction-capabilities-core/src/test/java/androidx/appactions/interaction/capabilities/core/testing/spec/GenericEntityArguments.kt
new file mode 100644
index 0000000..5c61176
--- /dev/null
+++ b/appactions/interaction/interaction-capabilities-core/src/test/java/androidx/appactions/interaction/capabilities/core/testing/spec/GenericEntityArguments.kt
@@ -0,0 +1,69 @@
+/*
+ * Copyright 2023 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 androidx.appactions.interaction.capabilities.core.testing.spec
+
+import androidx.appactions.interaction.capabilities.core.impl.BuilderOf
+
+class GenericEntityArguments internal constructor(
+ val singularField: TestEntity?,
+ val optionalField: TestEntity?,
+ val repeatedField: List<TestEntity>
+) {
+ override fun toString(): String {
+ return "GenericEntityArguments(singularField=$singularField, " +
+ "optionalField=$optionalField, " +
+ "repeatedField=$repeatedField, " +
+ ")"
+ }
+
+ override fun equals(other: Any?): Boolean {
+ if (this === other) return true
+ if (javaClass != other?.javaClass) return false
+
+ other as GenericEntityArguments
+
+ if (singularField != other.singularField) return false
+ if (optionalField != other.optionalField) return false
+ if (repeatedField != other.repeatedField) return false
+ return true
+ }
+
+ override fun hashCode(): Int {
+ var result = singularField.hashCode()
+ result += 31 * optionalField.hashCode()
+ result += 31 * repeatedField.hashCode()
+ return result
+ }
+
+ class Builder : BuilderOf<GenericEntityArguments> {
+ private var singularField: TestEntity? = null
+ private var optionalField: TestEntity? = null
+ private var repeatedField: List<TestEntity> = listOf()
+
+ fun setSingularField(singularField: TestEntity): Builder =
+ apply { this.singularField = singularField }
+
+ fun setOptionalField(optionalField: TestEntity): Builder =
+ apply { this.optionalField = optionalField }
+
+ fun setRepeatedField(repeatedField: List<TestEntity>): Builder =
+ apply { this.repeatedField = repeatedField }
+
+ override fun build(): GenericEntityArguments =
+ GenericEntityArguments(singularField, optionalField, repeatedField)
+ }
+}
\ No newline at end of file
diff --git a/appactions/interaction/interaction-capabilities-fitness/src/main/java/androidx/appactions/interaction/capabilities/fitness/fitness/StartExercise.kt b/appactions/interaction/interaction-capabilities-fitness/src/main/java/androidx/appactions/interaction/capabilities/fitness/fitness/StartExercise.kt
index adb2749..1d89b82 100644
--- a/appactions/interaction/interaction-capabilities-fitness/src/main/java/androidx/appactions/interaction/capabilities/fitness/fitness/StartExercise.kt
+++ b/appactions/interaction/interaction-capabilities-fitness/src/main/java/androidx/appactions/interaction/capabilities/fitness/fitness/StartExercise.kt
@@ -110,17 +110,17 @@
@Suppress("UNCHECKED_CAST")
private val ACTION_SPEC =
ActionSpecBuilder.ofCapabilityNamed(CAPABILITY_NAME)
- .setArguments(StartExercise.Arguments::class.java, StartExercise.Arguments::Builder)
- .setOutput(StartExercise.Output::class.java)
+ .setArguments(Arguments::class.java, Arguments::Builder)
+ .setOutput(Output::class.java)
.bindOptionalParameter(
"exercise.duration",
{ properties ->
Optional.ofNullable(
- properties[StartExercise.PropertyMapStrings.DURATION.key]
+ properties[PropertyMapStrings.DURATION.key]
as Property<Duration>
)
},
- StartExercise.Arguments.Builder::setDuration,
+ Arguments.Builder::setDuration,
TypeConverters.DURATION_PARAM_VALUE_CONVERTER,
TypeConverters.DURATION_ENTITY_CONVERTER
)
@@ -128,11 +128,11 @@
"exercise.name",
{ properties ->
Optional.ofNullable(
- properties[StartExercise.PropertyMapStrings.NAME.key]
+ properties[PropertyMapStrings.NAME.key]
as Property<StringValue>
)
},
- StartExercise.Arguments.Builder::setName,
+ Arguments.Builder::setName,
TypeConverters.STRING_PARAM_VALUE_CONVERTER,
TypeConverters.STRING_VALUE_ENTITY_CONVERTER
)
diff --git a/appactions/interaction/interaction-capabilities-productivity/src/main/java/androidx/appactions/interaction/capabilities/productivity/PauseTimer.kt b/appactions/interaction/interaction-capabilities-productivity/src/main/java/androidx/appactions/interaction/capabilities/productivity/PauseTimer.kt
index 59ed86a..bf30c36 100644
--- a/appactions/interaction/interaction-capabilities-productivity/src/main/java/androidx/appactions/interaction/capabilities/productivity/PauseTimer.kt
+++ b/appactions/interaction/interaction-capabilities-productivity/src/main/java/androidx/appactions/interaction/capabilities/productivity/PauseTimer.kt
@@ -176,7 +176,7 @@
)
.bindOptionalOutput(
"executionStatus",
- { output -> Optional.ofNullable(output.executionStatus) },
+ Output::executionStatus,
ExecutionStatus::toParamValue,
)
.build()
diff --git a/appactions/interaction/interaction-capabilities-productivity/src/main/java/androidx/appactions/interaction/capabilities/productivity/ResetTimer.kt b/appactions/interaction/interaction-capabilities-productivity/src/main/java/androidx/appactions/interaction/capabilities/productivity/ResetTimer.kt
index e174668..fce016f 100644
--- a/appactions/interaction/interaction-capabilities-productivity/src/main/java/androidx/appactions/interaction/capabilities/productivity/ResetTimer.kt
+++ b/appactions/interaction/interaction-capabilities-productivity/src/main/java/androidx/appactions/interaction/capabilities/productivity/ResetTimer.kt
@@ -173,7 +173,7 @@
)
.bindOptionalOutput(
"executionStatus",
- { output -> Optional.ofNullable(output.executionStatus) },
+ Output::executionStatus,
ExecutionStatus::toParamValue
)
.build()
diff --git a/appactions/interaction/interaction-capabilities-productivity/src/main/java/androidx/appactions/interaction/capabilities/productivity/ResumeTimer.kt b/appactions/interaction/interaction-capabilities-productivity/src/main/java/androidx/appactions/interaction/capabilities/productivity/ResumeTimer.kt
index a190cc8..76f3019 100644
--- a/appactions/interaction/interaction-capabilities-productivity/src/main/java/androidx/appactions/interaction/capabilities/productivity/ResumeTimer.kt
+++ b/appactions/interaction/interaction-capabilities-productivity/src/main/java/androidx/appactions/interaction/capabilities/productivity/ResumeTimer.kt
@@ -173,7 +173,7 @@
)
.bindOptionalOutput(
"executionStatus",
- { output -> Optional.ofNullable(output.executionStatus) },
+ Output::executionStatus,
ExecutionStatus::toParamValue
)
.build()
diff --git a/appactions/interaction/interaction-capabilities-productivity/src/main/java/androidx/appactions/interaction/capabilities/productivity/StartTimer.kt b/appactions/interaction/interaction-capabilities-productivity/src/main/java/androidx/appactions/interaction/capabilities/productivity/StartTimer.kt
index 7d71c22..ea01afc 100644
--- a/appactions/interaction/interaction-capabilities-productivity/src/main/java/androidx/appactions/interaction/capabilities/productivity/StartTimer.kt
+++ b/appactions/interaction/interaction-capabilities-productivity/src/main/java/androidx/appactions/interaction/capabilities/productivity/StartTimer.kt
@@ -243,7 +243,7 @@
)
.bindOptionalOutput(
"executionStatus",
- { output -> Optional.ofNullable(output.executionStatus) },
+ Output::executionStatus,
ExecutionStatus::toParamValue,
)
.build()
diff --git a/appactions/interaction/interaction-capabilities-productivity/src/main/java/androidx/appactions/interaction/capabilities/productivity/StopTimer.kt b/appactions/interaction/interaction-capabilities-productivity/src/main/java/androidx/appactions/interaction/capabilities/productivity/StopTimer.kt
index 394935b..c6f55b5 100644
--- a/appactions/interaction/interaction-capabilities-productivity/src/main/java/androidx/appactions/interaction/capabilities/productivity/StopTimer.kt
+++ b/appactions/interaction/interaction-capabilities-productivity/src/main/java/androidx/appactions/interaction/capabilities/productivity/StopTimer.kt
@@ -173,7 +173,7 @@
)
.bindOptionalOutput(
"executionStatus",
- { output -> Optional.ofNullable(output.executionStatus) },
+ Output::executionStatus,
ExecutionStatus::toParamValue
)
.build()
diff --git a/appactions/interaction/interaction-capabilities-safety/src/main/java/androidx/appactions/interaction/capabilities/safety/StartEmergencySharing.kt b/appactions/interaction/interaction-capabilities-safety/src/main/java/androidx/appactions/interaction/capabilities/safety/StartEmergencySharing.kt
index 9152d36..0f06ed6 100644
--- a/appactions/interaction/interaction-capabilities-safety/src/main/java/androidx/appactions/interaction/capabilities/safety/StartEmergencySharing.kt
+++ b/appactions/interaction/interaction-capabilities-safety/src/main/java/androidx/appactions/interaction/capabilities/safety/StartEmergencySharing.kt
@@ -32,7 +32,6 @@
import androidx.appactions.interaction.proto.ParamValue
import androidx.appactions.interaction.protobuf.Struct
import androidx.appactions.interaction.protobuf.Value
-import java.util.Optional
private const val CAPABILITY_NAME = "actions.intent.START_EMERGENCY_SHARING"
@@ -165,7 +164,7 @@
.setOutput(Output::class.java)
.bindOptionalOutput(
"executionStatus",
- { output -> Optional.ofNullable(output.executionStatus) },
+ Output::executionStatus,
ExecutionStatus::toParamValue,
)
.build()
diff --git a/appactions/interaction/interaction-capabilities-safety/src/main/java/androidx/appactions/interaction/capabilities/safety/StartSafetyCheck.kt b/appactions/interaction/interaction-capabilities-safety/src/main/java/androidx/appactions/interaction/capabilities/safety/StartSafetyCheck.kt
index 133dfde..81a7bdab 100644
--- a/appactions/interaction/interaction-capabilities-safety/src/main/java/androidx/appactions/interaction/capabilities/safety/StartSafetyCheck.kt
+++ b/appactions/interaction/interaction-capabilities-safety/src/main/java/androidx/appactions/interaction/capabilities/safety/StartSafetyCheck.kt
@@ -258,12 +258,12 @@
)
.bindOptionalOutput(
"safetyCheck",
- { output -> Optional.ofNullable(output.safetyCheck) },
+ Output::safetyCheck,
ParamValueConverter.of(SAFETY_CHECK_TYPE_SPEC)::toParamValue
)
.bindOptionalOutput(
"executionStatus",
- { output -> Optional.ofNullable(output.executionStatus) },
+ Output::executionStatus,
ExecutionStatus::toParamValue
)
.build()
diff --git a/appactions/interaction/interaction-capabilities-safety/src/main/java/androidx/appactions/interaction/capabilities/safety/StopEmergencySharing.kt b/appactions/interaction/interaction-capabilities-safety/src/main/java/androidx/appactions/interaction/capabilities/safety/StopEmergencySharing.kt
index 88fe5f2..2f631de 100644
--- a/appactions/interaction/interaction-capabilities-safety/src/main/java/androidx/appactions/interaction/capabilities/safety/StopEmergencySharing.kt
+++ b/appactions/interaction/interaction-capabilities-safety/src/main/java/androidx/appactions/interaction/capabilities/safety/StopEmergencySharing.kt
@@ -32,7 +32,6 @@
import androidx.appactions.interaction.proto.ParamValue
import androidx.appactions.interaction.protobuf.Struct
import androidx.appactions.interaction.protobuf.Value
-import java.util.Optional
private const val CAPABILITY_NAME = "actions.intent.STOP_EMERGENCY_SHARING"
@@ -166,7 +165,7 @@
.setOutput(Output::class.java)
.bindOptionalOutput(
"executionStatus",
- { output -> Optional.ofNullable(output.executionStatus) },
+ Output::executionStatus,
ExecutionStatus::toParamValue,
)
.build()
diff --git a/appactions/interaction/interaction-capabilities-safety/src/main/java/androidx/appactions/interaction/capabilities/safety/StopSafetyCheck.kt b/appactions/interaction/interaction-capabilities-safety/src/main/java/androidx/appactions/interaction/capabilities/safety/StopSafetyCheck.kt
index c1d9aef..295e995 100644
--- a/appactions/interaction/interaction-capabilities-safety/src/main/java/androidx/appactions/interaction/capabilities/safety/StopSafetyCheck.kt
+++ b/appactions/interaction/interaction-capabilities-safety/src/main/java/androidx/appactions/interaction/capabilities/safety/StopSafetyCheck.kt
@@ -32,7 +32,6 @@
import androidx.appactions.interaction.proto.ParamValue
import androidx.appactions.interaction.protobuf.Struct
import androidx.appactions.interaction.protobuf.Value
-import java.util.Optional
private const val CAPABILITY_NAME = "actions.intent.STOP_SAFETY_CHECK"
@@ -162,7 +161,7 @@
.setOutput(Output::class.java)
.bindOptionalOutput(
"executionStatus",
- { output -> Optional.ofNullable(output.executionStatus) },
+ Output::executionStatus,
ExecutionStatus::toParamValue
)
.build()
diff --git a/appcompat/appcompat-resources/src/main/AndroidManifest.xml b/appcompat/appcompat-resources/src/main/AndroidManifest.xml
deleted file mode 100644
index 2766785..0000000
--- a/appcompat/appcompat-resources/src/main/AndroidManifest.xml
+++ /dev/null
@@ -1,16 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2012 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.
--->
-<manifest />
diff --git a/appcompat/appcompat/src/androidTest/java/androidx/appcompat/app/g3/FilternatorTest.kt b/appcompat/appcompat/src/androidTest/java/androidx/appcompat/app/g3/FilternatorTest.kt
index 38d9ab2..5d3fbee 100644
--- a/appcompat/appcompat/src/androidTest/java/androidx/appcompat/app/g3/FilternatorTest.kt
+++ b/appcompat/appcompat/src/androidTest/java/androidx/appcompat/app/g3/FilternatorTest.kt
@@ -30,6 +30,7 @@
import com.google.common.truth.Truth.assertThat
import java.util.concurrent.TimeUnit
import org.junit.Before
+import org.junit.Ignore
import org.junit.Rule
import org.junit.Test
import org.junit.runner.RunWith
@@ -53,6 +54,7 @@
}
@Test
+ @Ignore("b/280630647")
fun testConfigurationUpdatedOnLandscapeMode() {
// Wait for the activity to fully start before rotating,
// otherwise we won't receive onConfigurationChanged.
diff --git a/appcompat/appcompat/src/androidTest/java/androidx/appcompat/app/g3/FilternatorTestWithCustomDefault.kt b/appcompat/appcompat/src/androidTest/java/androidx/appcompat/app/g3/FilternatorTestWithCustomDefault.kt
index 45357c5..eba4c96 100644
--- a/appcompat/appcompat/src/androidTest/java/androidx/appcompat/app/g3/FilternatorTestWithCustomDefault.kt
+++ b/appcompat/appcompat/src/androidTest/java/androidx/appcompat/app/g3/FilternatorTestWithCustomDefault.kt
@@ -32,6 +32,7 @@
import java.util.concurrent.TimeUnit
import org.junit.After
import org.junit.Before
+import org.junit.Ignore
import org.junit.Rule
import org.junit.Test
import org.junit.runner.RunWith
@@ -70,6 +71,7 @@
}
@Test
+ @Ignore("b/280630647")
fun testConfigurationUpdatedOnLandscapeMode() {
// Wait for the activity to fully start before rotating,
// otherwise we won't receive onConfigurationChanged.
diff --git a/appcompat/appcompat/src/main/AndroidManifest.xml b/appcompat/appcompat/src/main/AndroidManifest.xml
deleted file mode 100644
index 2766785..0000000
--- a/appcompat/appcompat/src/main/AndroidManifest.xml
+++ /dev/null
@@ -1,16 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2012 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.
--->
-<manifest />
diff --git a/appsearch/appsearch-builtin-types/src/main/AndroidManifest.xml b/appsearch/appsearch-builtin-types/src/main/AndroidManifest.xml
deleted file mode 100644
index a270226..0000000
--- a/appsearch/appsearch-builtin-types/src/main/AndroidManifest.xml
+++ /dev/null
@@ -1,17 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright 2021 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.
--->
-
-<manifest />
\ No newline at end of file
diff --git a/appsearch/appsearch-debug-view/src/main/AndroidManifest.xml b/appsearch/appsearch-debug-view/src/main/AndroidManifest.xml
deleted file mode 100644
index 3c3c224..0000000
--- a/appsearch/appsearch-debug-view/src/main/AndroidManifest.xml
+++ /dev/null
@@ -1,17 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
- Copyright 2021 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.
- -->
-<manifest />
diff --git a/appsearch/appsearch-ktx/src/main/AndroidManifest.xml b/appsearch/appsearch-ktx/src/main/AndroidManifest.xml
deleted file mode 100644
index adbf0a8..0000000
--- a/appsearch/appsearch-ktx/src/main/AndroidManifest.xml
+++ /dev/null
@@ -1,17 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright 2021 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.
--->
-
-<manifest />
diff --git a/appsearch/appsearch-local-storage/src/main/AndroidManifest.xml b/appsearch/appsearch-local-storage/src/main/AndroidManifest.xml
deleted file mode 100644
index e95a361..0000000
--- a/appsearch/appsearch-local-storage/src/main/AndroidManifest.xml
+++ /dev/null
@@ -1,17 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright 2019 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.
--->
-
-<manifest />
diff --git a/appsearch/appsearch-platform-storage/src/main/AndroidManifest.xml b/appsearch/appsearch-platform-storage/src/main/AndroidManifest.xml
deleted file mode 100644
index adbf0a8..0000000
--- a/appsearch/appsearch-platform-storage/src/main/AndroidManifest.xml
+++ /dev/null
@@ -1,17 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright 2021 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.
--->
-
-<manifest />
diff --git a/appsearch/appsearch-test-util/src/main/AndroidManifest.xml b/appsearch/appsearch-test-util/src/main/AndroidManifest.xml
deleted file mode 100644
index e0788d6..0000000
--- a/appsearch/appsearch-test-util/src/main/AndroidManifest.xml
+++ /dev/null
@@ -1,18 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
- Copyright 2021 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.
- -->
-
-<manifest />
diff --git a/appsearch/appsearch/src/main/AndroidManifest.xml b/appsearch/appsearch/src/main/AndroidManifest.xml
deleted file mode 100644
index 19e768b..0000000
--- a/appsearch/appsearch/src/main/AndroidManifest.xml
+++ /dev/null
@@ -1,17 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright 2019 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.
--->
-
-<manifest />
\ No newline at end of file
diff --git a/asynclayoutinflater/asynclayoutinflater-appcompat/src/main/AndroidManifest.xml b/asynclayoutinflater/asynclayoutinflater-appcompat/src/main/AndroidManifest.xml
deleted file mode 100644
index 2d12952..0000000
--- a/asynclayoutinflater/asynclayoutinflater-appcompat/src/main/AndroidManifest.xml
+++ /dev/null
@@ -1,16 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2022 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.
--->
-<manifest />
diff --git a/asynclayoutinflater/asynclayoutinflater/src/main/AndroidManifest.xml b/asynclayoutinflater/asynclayoutinflater/src/main/AndroidManifest.xml
deleted file mode 100644
index 6f49e23..0000000
--- a/asynclayoutinflater/asynclayoutinflater/src/main/AndroidManifest.xml
+++ /dev/null
@@ -1,16 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2014 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.
--->
-<manifest />
diff --git a/autofill/autofill/src/main/AndroidManifest.xml b/autofill/autofill/src/main/AndroidManifest.xml
deleted file mode 100644
index 19e768b..0000000
--- a/autofill/autofill/src/main/AndroidManifest.xml
+++ /dev/null
@@ -1,17 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright 2019 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.
--->
-
-<manifest />
\ No newline at end of file
diff --git a/benchmark/benchmark-common/src/androidTest/java/androidx/benchmark/BenchmarkStateTest.kt b/benchmark/benchmark-common/src/androidTest/java/androidx/benchmark/BenchmarkStateTest.kt
index 3164fcc..737b39d 100644
--- a/benchmark/benchmark-common/src/androidTest/java/androidx/benchmark/BenchmarkStateTest.kt
+++ b/benchmark/benchmark-common/src/androidTest/java/androidx/benchmark/BenchmarkStateTest.kt
@@ -29,6 +29,7 @@
import org.junit.Assert.assertTrue
import org.junit.Assert.fail
import org.junit.Assume.assumeTrue
+import org.junit.Ignore
import org.junit.Rule
import org.junit.Test
import org.junit.runner.RunWith
@@ -189,7 +190,7 @@
assumeTrue(
CpuInfo.locked ||
IsolationActivity.sustainedPerformanceModeInUse ||
- Errors.isEmulator
+ DeviceInfo.isEmulator
)
iterationCheck(checkingForThermalThrottling = false)
}
@@ -380,6 +381,7 @@
}
@Test
+ @Ignore("b/278737712")
fun experimentalIters() {
validateIters(
warmupCount = 1,
diff --git a/benchmark/benchmark-common/src/main/java/androidx/benchmark/DeviceInfo.kt b/benchmark/benchmark-common/src/main/java/androidx/benchmark/DeviceInfo.kt
index b336117..19d5d66 100644
--- a/benchmark/benchmark-common/src/main/java/androidx/benchmark/DeviceInfo.kt
+++ b/benchmark/benchmark-common/src/main/java/androidx/benchmark/DeviceInfo.kt
@@ -32,8 +32,7 @@
Build.MODEL.contains("google_sdk") ||
Build.MODEL.contains("sdk_gphone64") ||
Build.MODEL.contains("Emulator") ||
- Build.MODEL.contains("Android SDK built for x86") ||
- Build.MODEL.contains("Android SDK built for arm64") ||
+ Build.MODEL.contains("Android SDK built for") ||
Build.MANUFACTURER.contains("Genymotion") ||
Build.BRAND.startsWith("generic") && Build.DEVICE.startsWith("generic") ||
"google_sdk" == Build.PRODUCT
diff --git a/benchmark/benchmark-common/src/main/java/androidx/benchmark/Errors.kt b/benchmark/benchmark-common/src/main/java/androidx/benchmark/Errors.kt
index 9919011..6403312 100644
--- a/benchmark/benchmark-common/src/main/java/androidx/benchmark/Errors.kt
+++ b/benchmark/benchmark-common/src/main/java/androidx/benchmark/Errors.kt
@@ -64,15 +64,6 @@
return ret
}
- val isEmulator = Build.FINGERPRINT.startsWith("generic") ||
- Build.FINGERPRINT.startsWith("unknown") ||
- Build.MODEL.contains("google_sdk") ||
- Build.MODEL.contains("Emulator") ||
- Build.MODEL.contains("Android SDK built for x86") ||
- Build.MANUFACTURER.contains("Genymotion") ||
- Build.BRAND.startsWith("generic") && Build.DEVICE.startsWith("generic") ||
- "google_sdk" == Build.PRODUCT
-
private val isDeviceRooted =
arrayOf(
"/system/app/Superuser.apk",
@@ -110,7 +101,7 @@
| real user's experience (or even regress release performance).
""".trimMarginWrapNewlines()
}
- if (isEmulator) {
+ if (DeviceInfo.isEmulator) {
warningPrefix += "EMULATOR_"
warningString += """
|WARNING: Running on Emulator
diff --git a/benchmark/benchmark-common/src/main/java/androidx/benchmark/ThrottleDetector.kt b/benchmark/benchmark-common/src/main/java/androidx/benchmark/ThrottleDetector.kt
index e6fcaba..a074e20 100644
--- a/benchmark/benchmark-common/src/main/java/androidx/benchmark/ThrottleDetector.kt
+++ b/benchmark/benchmark-common/src/main/java/androidx/benchmark/ThrottleDetector.kt
@@ -64,7 +64,7 @@
initNs == 0.0 && // first time
!CpuInfo.locked && // CPU locked (presumably to stable values), should be no throttling
!IsolationActivity.sustainedPerformanceModeInUse && // trust sustained perf
- !Errors.isEmulator // don't bother with emulators, will always be unpredicatable
+ !DeviceInfo.isEmulator // don't bother with emulators, will always be unpredictable
) {
initNs = measureWorkNs()
}
diff --git a/benchmark/benchmark-junit4/src/main/AndroidManifest.xml b/benchmark/benchmark-junit4/src/main/AndroidManifest.xml
deleted file mode 100644
index cf0d807..0000000
--- a/benchmark/benchmark-junit4/src/main/AndroidManifest.xml
+++ /dev/null
@@ -1,17 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
- ~ Copyright (C) 2019 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.
- -->
-<manifest />
diff --git a/benchmark/benchmark-macro-junit4/src/main/AndroidManifest.xml b/benchmark/benchmark-macro-junit4/src/main/AndroidManifest.xml
deleted file mode 100644
index 5b41847..0000000
--- a/benchmark/benchmark-macro-junit4/src/main/AndroidManifest.xml
+++ /dev/null
@@ -1,17 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
- ~ Copyright (C) 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.
- -->
-<manifest />
diff --git a/benchmark/benchmark-macro/src/androidTest/java/androidx/benchmark/macro/StartupTimingMetricTest.kt b/benchmark/benchmark-macro/src/androidTest/java/androidx/benchmark/macro/StartupTimingMetricTest.kt
index 9e98054..dc048f2c 100644
--- a/benchmark/benchmark-macro/src/androidTest/java/androidx/benchmark/macro/StartupTimingMetricTest.kt
+++ b/benchmark/benchmark-macro/src/androidTest/java/androidx/benchmark/macro/StartupTimingMetricTest.kt
@@ -48,6 +48,7 @@
class StartupTimingMetricTest {
@MediumTest
@Test
+ @Ignore("b/258335082")
fun noResults() {
assumeTrue(isAbiSupported())
val packageName = "fake.package.fiction.nostartups"
@@ -170,12 +171,14 @@
@LargeTest
@Test
+ @Ignore("b/258335082")
fun startup_fullyDrawn_immediate() {
validateStartup_fullyDrawn(delayMs = 0)
}
@LargeTest
@Test
+ @Ignore("b/258335082")
fun startup_fullyDrawn_delayed() {
validateStartup_fullyDrawn(delayMs = 100)
}
diff --git a/benchmark/integration-tests/baselineprofile-flavors-producer/src/free/AndroidManifest.xml b/benchmark/integration-tests/baselineprofile-flavors-producer/src/free/AndroidManifest.xml
deleted file mode 100644
index bae036b..0000000
--- a/benchmark/integration-tests/baselineprofile-flavors-producer/src/free/AndroidManifest.xml
+++ /dev/null
@@ -1,17 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
- ~ Copyright (C) 2022 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.
- -->
-<manifest />
diff --git a/benchmark/integration-tests/baselineprofile-flavors-producer/src/main/AndroidManifest.xml b/benchmark/integration-tests/baselineprofile-flavors-producer/src/main/AndroidManifest.xml
deleted file mode 100644
index d4c1970..0000000
--- a/benchmark/integration-tests/baselineprofile-flavors-producer/src/main/AndroidManifest.xml
+++ /dev/null
@@ -1,16 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?><!--
- ~ Copyright (C) 2022 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.
- -->
-<manifest />
diff --git a/benchmark/integration-tests/baselineprofile-flavors-producer/src/paid/AndroidManifest.xml b/benchmark/integration-tests/baselineprofile-flavors-producer/src/paid/AndroidManifest.xml
deleted file mode 100644
index bae036b..0000000
--- a/benchmark/integration-tests/baselineprofile-flavors-producer/src/paid/AndroidManifest.xml
+++ /dev/null
@@ -1,17 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
- ~ Copyright (C) 2022 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.
- -->
-<manifest />
diff --git a/benchmark/integration-tests/baselineprofile-library-consumer/src/main/AndroidManifest.xml b/benchmark/integration-tests/baselineprofile-library-consumer/src/main/AndroidManifest.xml
deleted file mode 100644
index 7c52910..0000000
--- a/benchmark/integration-tests/baselineprofile-library-consumer/src/main/AndroidManifest.xml
+++ /dev/null
@@ -1,16 +0,0 @@
-<!--
- ~ Copyright 2022 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.
- -->
-<manifest />
diff --git a/benchmark/integration-tests/baselineprofile-library-producer/src/main/AndroidManifest.xml b/benchmark/integration-tests/baselineprofile-library-producer/src/main/AndroidManifest.xml
deleted file mode 100644
index bae036b..0000000
--- a/benchmark/integration-tests/baselineprofile-library-producer/src/main/AndroidManifest.xml
+++ /dev/null
@@ -1,17 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
- ~ Copyright (C) 2022 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.
- -->
-<manifest />
diff --git a/benchmark/integration-tests/baselineprofile-producer/src/main/AndroidManifest.xml b/benchmark/integration-tests/baselineprofile-producer/src/main/AndroidManifest.xml
deleted file mode 100644
index bae036b..0000000
--- a/benchmark/integration-tests/baselineprofile-producer/src/main/AndroidManifest.xml
+++ /dev/null
@@ -1,17 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
- ~ Copyright (C) 2022 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.
- -->
-<manifest />
diff --git a/benchmark/integration-tests/macrobenchmark/src/androidTest/AndroidManifest.xml b/benchmark/integration-tests/macrobenchmark/src/androidTest/AndroidManifest.xml
deleted file mode 100644
index 5b41847..0000000
--- a/benchmark/integration-tests/macrobenchmark/src/androidTest/AndroidManifest.xml
+++ /dev/null
@@ -1,17 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
- ~ Copyright (C) 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.
- -->
-<manifest />
diff --git a/benchmark/integration-tests/macrobenchmark/src/main/AndroidManifest.xml b/benchmark/integration-tests/macrobenchmark/src/main/AndroidManifest.xml
deleted file mode 100644
index ed173d5..0000000
--- a/benchmark/integration-tests/macrobenchmark/src/main/AndroidManifest.xml
+++ /dev/null
@@ -1,16 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?><!--
- ~ Copyright (C) 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.
- -->
-<manifest />
diff --git a/biometric/biometric-ktx/src/main/AndroidManifest.xml b/biometric/biometric-ktx/src/main/AndroidManifest.xml
deleted file mode 100644
index 227314e..0000000
--- a/biometric/biometric-ktx/src/main/AndroidManifest.xml
+++ /dev/null
@@ -1 +0,0 @@
-<manifest />
\ No newline at end of file
diff --git a/bluetooth/bluetooth-testing/src/androidTest/AndroidManifest.xml b/bluetooth/bluetooth-testing/src/androidTest/AndroidManifest.xml
deleted file mode 100644
index a9bb124..0000000
--- a/bluetooth/bluetooth-testing/src/androidTest/AndroidManifest.xml
+++ /dev/null
@@ -1,17 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
- ~ Copyright 2022 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.
- -->
-<manifest />
diff --git a/bluetooth/bluetooth-testing/src/main/AndroidManifest.xml b/bluetooth/bluetooth-testing/src/main/AndroidManifest.xml
deleted file mode 100644
index 9ac1b77..0000000
--- a/bluetooth/bluetooth-testing/src/main/AndroidManifest.xml
+++ /dev/null
@@ -1,16 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright 2022 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.
--->
-<manifest />
diff --git a/bluetooth/integration-tests/testapp/build.gradle b/bluetooth/integration-tests/testapp/build.gradle
index 55523d6..c99f4b1 100644
--- a/bluetooth/integration-tests/testapp/build.gradle
+++ b/bluetooth/integration-tests/testapp/build.gradle
@@ -50,7 +50,7 @@
implementation("androidx.appcompat:appcompat:1.6.1")
implementation(libs.constraintLayout)
implementation("androidx.core:core-ktx:1.10.0")
- implementation("androidx.fragment:fragment-ktx:1.5.6")
+ implementation("androidx.fragment:fragment-ktx:1.5.7")
implementation("androidx.lifecycle:lifecycle-livedata-ktx:2.6.1")
implementation("androidx.lifecycle:lifecycle-viewmodel-ktx:2.6.1")
implementation("androidx.navigation:navigation-fragment-ktx:2.5.3")
diff --git a/bluetooth/integration-tests/testapp/src/main/java/androidx/bluetooth/integration/testapp/ui/home/HomeFragment.kt b/bluetooth/integration-tests/testapp/src/main/java/androidx/bluetooth/integration/testapp/ui/home/HomeFragment.kt
index 593f46b..f4e7d85 100644
--- a/bluetooth/integration-tests/testapp/src/main/java/androidx/bluetooth/integration/testapp/ui/home/HomeFragment.kt
+++ b/bluetooth/integration-tests/testapp/src/main/java/androidx/bluetooth/integration/testapp/ui/home/HomeFragment.kt
@@ -66,11 +66,7 @@
container: ViewGroup?,
savedInstanceState: Bundle?
): View {
- Log.d(
- TAG, "onCreateView() called with: inflater = $inflater, " +
- "container = $container, savedInstanceState = $savedInstanceState"
- )
- mHomeViewModel = ViewModelProvider(this).get(HomeViewModel::class.java)
+ mHomeViewModel = ViewModelProvider(this)[HomeViewModel::class.java]
_binding = FragmentHomeBinding.inflate(inflater, container, false)
return binding.root
diff --git a/bluetooth/integration-tests/testapp/src/main/java/androidx/bluetooth/integration/testapp/ui/home/HomeViewModel.kt b/bluetooth/integration-tests/testapp/src/main/java/androidx/bluetooth/integration/testapp/ui/home/HomeViewModel.kt
index 4d85a68..88b1c1c 100644
--- a/bluetooth/integration-tests/testapp/src/main/java/androidx/bluetooth/integration/testapp/ui/home/HomeViewModel.kt
+++ b/bluetooth/integration-tests/testapp/src/main/java/androidx/bluetooth/integration/testapp/ui/home/HomeViewModel.kt
@@ -21,7 +21,7 @@
class HomeViewModel : ViewModel() {
- companion object {
+ private companion object {
private const val TAG = "HomeViewModel"
}
diff --git a/bluetooth/integration-tests/testapp/src/main/java/androidx/bluetooth/integration/testapp/ui/scanner/ScannerFragment.kt b/bluetooth/integration-tests/testapp/src/main/java/androidx/bluetooth/integration/testapp/ui/scanner/ScannerFragment.kt
index dc9536e..ca0309d 100644
--- a/bluetooth/integration-tests/testapp/src/main/java/androidx/bluetooth/integration/testapp/ui/scanner/ScannerFragment.kt
+++ b/bluetooth/integration-tests/testapp/src/main/java/androidx/bluetooth/integration/testapp/ui/scanner/ScannerFragment.kt
@@ -16,10 +16,6 @@
package androidx.bluetooth.integration.testapp.ui.scanner
-// TODO(ofy) Migrate from androidx.bluetooth.integration.testapp.experimental.BluetoothLe to
-// androidx.bluetooth.BluetoothDevice once in place
-// TODO(ofy) Migrate from androidx.bluetooth.integration.testapp.experimental.BluetoothLe to
-// androidx.bluetooth.BluetoothLe once scan API is in place
import android.bluetooth.le.ScanResult
import android.bluetooth.le.ScanSettings
import android.os.Bundle
@@ -32,6 +28,7 @@
import androidx.bluetooth.integration.testapp.R
import androidx.bluetooth.integration.testapp.databinding.FragmentScannerBinding
import android.annotation.SuppressLint
+// TODO(ofy) Migrate to androidx.bluetooth.BluetoothLe once scan API is in place
import androidx.bluetooth.integration.testapp.experimental.BluetoothLe
import androidx.bluetooth.integration.testapp.ui.common.getColor
import androidx.core.view.isVisible
@@ -138,8 +135,6 @@
DividerItemDecoration(context, LinearLayoutManager.VERTICAL)
)
- initData()
-
binding.buttonScan.setOnClickListener {
if (scanJob?.isActive == true) {
isScanning = false
@@ -148,6 +143,8 @@
}
}
+ initData()
+
return binding.root
}
@@ -155,8 +152,6 @@
super.onDestroyView()
_binding = null
isScanning = false
- scanJob?.cancel()
- scanJob = null
}
private fun initData() {
@@ -197,7 +192,7 @@
binding.tabLayout.getTabAt(index)
}
- // To prevent TabSelectedListener being triggered when a tab is promatically selected.
+ // To prevent TabSelectedListener being triggered when a tab is programmatically selected.
binding.tabLayout.removeOnTabSelectedListener(onTabSelectedListener)
binding.tabLayout.selectTab(deviceTab)
binding.tabLayout.addOnTabSelectedListener(onTabSelectedListener)
@@ -217,7 +212,9 @@
val customView = newTab.customView
customView?.findViewById<TextView>(R.id.text_view_address)?.text = deviceAddress
- customView?.findViewById<TextView>(R.id.text_view_name)?.text = deviceName
+ val textViewName = customView?.findViewById<TextView>(R.id.text_view_name)
+ textViewName?.text = deviceName
+ textViewName?.isVisible = deviceName.isNullOrEmpty().not()
binding.tabLayout.addTab(newTab)
return newTab
diff --git a/browser/browser/src/main/AndroidManifest.xml b/browser/browser/src/main/AndroidManifest.xml
deleted file mode 100644
index 3e475b2..0000000
--- a/browser/browser/src/main/AndroidManifest.xml
+++ /dev/null
@@ -1,16 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright 2015 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.
--->
-<manifest />
diff --git a/buildSrc/private/src/main/kotlin/androidx/build/AndroidXComposeImplPlugin.kt b/buildSrc/private/src/main/kotlin/androidx/build/AndroidXComposeImplPlugin.kt
index f60a494..c596da5 100644
--- a/buildSrc/private/src/main/kotlin/androidx/build/AndroidXComposeImplPlugin.kt
+++ b/buildSrc/private/src/main/kotlin/androidx/build/AndroidXComposeImplPlugin.kt
@@ -153,6 +153,7 @@
error.add("ComposableLambdaParameterPosition")
error.add("CompositionLocalNaming")
error.add("ComposableModifierFactory")
+ error.add("AutoboxingStateCreation")
error.add("AutoboxingStateValueProperty")
error.add("InvalidColorHexValue")
error.add("MissingColorAlphaChannel")
diff --git a/buildSrc/private/src/main/kotlin/androidx/build/AndroidXImplPlugin.kt b/buildSrc/private/src/main/kotlin/androidx/build/AndroidXImplPlugin.kt
index f868506..3fae48c 100644
--- a/buildSrc/private/src/main/kotlin/androidx/build/AndroidXImplPlugin.kt
+++ b/buildSrc/private/src/main/kotlin/androidx/build/AndroidXImplPlugin.kt
@@ -29,7 +29,6 @@
import androidx.build.checkapi.LibraryApiTaskConfig
import androidx.build.checkapi.configureProjectForApiTasks
import androidx.build.dependencies.KOTLIN_VERSION
-import androidx.build.dependencyTracker.AffectedModuleDetector
import androidx.build.docs.AndroidXKmpDocsImplPlugin
import androidx.build.gradle.isRoot
import androidx.build.license.configureExternalDependencyLicenseCheck
@@ -37,7 +36,6 @@
import androidx.build.sbom.validateAllArchiveInputsRecognized
import androidx.build.studio.StudioTask
import androidx.build.testConfiguration.addAppApkToTestConfigGeneration
-import androidx.build.testConfiguration.addToTestZips
import androidx.build.testConfiguration.configureTestConfigGeneration
import com.android.build.api.artifact.SingleArtifact
import com.android.build.api.dsl.ManagedVirtualDevice
@@ -54,7 +52,6 @@
import com.android.build.gradle.TestExtension
import com.android.build.gradle.TestPlugin
import com.android.build.gradle.TestedExtension
-import com.android.build.gradle.internal.tasks.ListingFileRedirectTask
import java.io.File
import java.time.Duration
import java.util.Locale
@@ -702,19 +699,6 @@
project.configureTestConfigGeneration(this)
project.configureFtlRunner()
- val buildTestApksTask = project.rootProject.tasks.named(BUILD_TEST_APKS_TASK)
- when (this) {
- is TestedExtension -> testVariants
- // app module defines variants for test module
- is TestExtension -> applicationVariants
- else -> throw IllegalStateException("Unsupported plugin type")
- }.all { variant ->
- buildTestApksTask.configure {
- it.dependsOn(variant.assembleProvider)
- }
- variant.configureApkZipping(project)
- }
-
// AGP warns if we use project.buildDir (or subdirs) for CMake's generated
// build files (ninja build files, CMakeCache.txt, etc.). Use a staging directory that
// lives alongside the project's buildDir.
@@ -722,24 +706,6 @@
File(project.buildDir, "../nativeBuildStaging")
}
- /**
- * Configures the ZIP_TEST_CONFIGS_WITH_APKS_TASK to include the test apk if applicable
- */
- @Suppress("DEPRECATION") // ApkVariant
- private fun com.android.build.gradle.api.ApkVariant.configureApkZipping(
- project: Project
- ) {
- packageApplicationProvider.get().let { packageTask ->
- AffectedModuleDetector.configureTaskGuard(packageTask)
- addToTestZips(project, packageTask)
- }
- // This task needs to be guarded by AffectedModuleDetector due to guarding test
- // APK building above. It can only be removed if we stop using AMD for test APKs.
- project.tasks.withType(ListingFileRedirectTask::class.java).forEach {
- AffectedModuleDetector.configureTaskGuard(it)
- }
- }
-
private fun LibraryExtension.configureAndroidLibraryOptions(
project: Project,
androidXExtension: AndroidXExtension
@@ -850,17 +816,6 @@
project.addAppApkToTestConfigGeneration()
project.addAppApkToFtlRunner()
-
- val buildTestApksTask = project.rootProject.tasks.named(BUILD_TEST_APKS_TASK)
- applicationVariants.all { variant ->
- // Using getName() instead of name due to b/150427408
- if (variant.buildType.name == "debug") {
- buildTestApksTask.configure {
- it.dependsOn(variant.assembleProvider)
- }
- }
- variant.configureApkZipping(project)
- }
}
private fun Project.configureDependencyVerification(
@@ -1001,7 +956,6 @@
}
companion object {
- const val BUILD_TEST_APKS_TASK = "buildTestApks"
const val CREATE_LIBRARY_BUILD_INFO_FILES_TASK = "createLibraryBuildInfoFiles"
const val GENERATE_TEST_CONFIGURATION_TASK = "GenerateTestConfiguration"
const val ZIP_TEST_CONFIGS_WITH_APKS_TASK = "zipTestConfigsWithApks"
@@ -1097,14 +1051,6 @@
}
}
-/**
- * Guarantees unique names for the APKs, and modifies some of the suffixes. The APK name is used
- * to determine what gets run by our test runner
- */
-fun String.renameApkForTesting(projectPath: String): String {
- return "${projectPath.asFilenamePrefix()}_$this"
-}
-
fun Project.hasBenchmarkPlugin(): Boolean {
return this.plugins.hasPlugin(BenchmarkPlugin::class.java)
}
diff --git a/buildSrc/private/src/main/kotlin/androidx/build/AndroidXRootImplPlugin.kt b/buildSrc/private/src/main/kotlin/androidx/build/AndroidXRootImplPlugin.kt
index f7bd29a..7a4f3c0 100644
--- a/buildSrc/private/src/main/kotlin/androidx/build/AndroidXRootImplPlugin.kt
+++ b/buildSrc/private/src/main/kotlin/androidx/build/AndroidXRootImplPlugin.kt
@@ -136,8 +136,6 @@
}
}
- tasks.register(AndroidXImplPlugin.BUILD_TEST_APKS_TASK)
-
// NOTE: this task is used by the Github CI as well. If you make any changes here,
// please update the .github/workflows files as well, if necessary.
project.tasks.register(
@@ -150,6 +148,7 @@
it.entryCompression = ZipEntryCompression.STORED
// Archive is greater than 4Gb :O
it.isZip64 = true
+ it.isReproducibleFileOrder = true
}
project.tasks.register(
ZIP_CONSTRAINED_TEST_CONFIGS_WITH_APKS_TASK, Zip::class.java
@@ -161,6 +160,7 @@
it.entryCompression = ZipEntryCompression.STORED
// Archive is greater than 4Gb :O
it.isZip64 = true
+ it.isReproducibleFileOrder = true
}
AffectedModuleDetector.configure(gradle, this)
diff --git a/buildSrc/private/src/main/kotlin/androidx/build/testConfiguration/GenerateMediaTestConfigurationTask.kt b/buildSrc/private/src/main/kotlin/androidx/build/testConfiguration/GenerateMediaTestConfigurationTask.kt
index 36ba7f9..57de24e 100644
--- a/buildSrc/private/src/main/kotlin/androidx/build/testConfiguration/GenerateMediaTestConfigurationTask.kt
+++ b/buildSrc/private/src/main/kotlin/androidx/build/testConfiguration/GenerateMediaTestConfigurationTask.kt
@@ -17,8 +17,6 @@
package androidx.build.testConfiguration
import androidx.build.dependencyTracker.ProjectSubset
-import androidx.build.renameApkForTesting
-import com.android.build.api.variant.BuiltArtifact
import com.android.build.api.variant.BuiltArtifacts
import com.android.build.api.variant.BuiltArtifactsLoader
import java.io.File
@@ -79,18 +77,6 @@
abstract val affectedModuleDetectorSubset: Property<ProjectSubset>
@get:Input
- abstract val clientToTPath: Property<String>
-
- @get:Input
- abstract val clientPreviousPath: Property<String>
-
- @get:Input
- abstract val serviceToTPath: Property<String>
-
- @get:Input
- abstract val servicePreviousPath: Property<String>
-
- @get:Input
abstract val minSdk: Property<Int>
@get:Input
@@ -117,39 +103,60 @@
@get:OutputFile
abstract val jsonClientToTServiceToTServiceTests: RegularFileProperty
+ @get:OutputFile
+ abstract val previousClientApk: RegularFileProperty
+
+ @get:OutputFile
+ abstract val totClientApk: RegularFileProperty
+
+ @get:OutputFile
+ abstract val previousServiceApk: RegularFileProperty
+
+ @get:OutputFile
+ abstract val totServiceApk: RegularFileProperty
+
@TaskAction
fun generateAndroidTestZip() {
- val clientToTApk = resolveApk(clientToTFolder, clientToTLoader)
- val clientPreviousApk = resolveApk(clientPreviousFolder, clientPreviousLoader)
- val serviceToTApk = resolveApk(serviceToTFolder, serviceToTLoader)
- val servicePreviousApk = resolveApk(
- servicePreviousFolder, servicePreviousLoader
+ val clientToTApk = totClientApk.get().asFile
+ val clientToTSha256 = copyApkAndGetSha256(clientToTFolder, clientToTLoader, clientToTApk)
+ val clientPreviousApk = previousClientApk.get().asFile
+ val clientPreviousSha256 = copyApkAndGetSha256(
+ clientPreviousFolder, clientPreviousLoader, clientPreviousApk
)
+ val serviceToTApk = totServiceApk.get().asFile
+ val serviceToTSha256 = copyApkAndGetSha256(
+ serviceToTFolder, serviceToTLoader, serviceToTApk
+ )
+ val servicePreviousApk = previousServiceApk.get().asFile
+ val servicePreviousSha256 = copyApkAndGetSha256(
+ servicePreviousFolder, servicePreviousLoader, servicePreviousApk
+ )
+
writeConfigFileContent(
- clientApk = clientToTApk,
- serviceApk = serviceToTApk,
- clientPath = clientToTPath.get(),
- servicePath = serviceToTPath.get(),
+ clientApkName = clientToTApk.name,
+ serviceApkName = serviceToTApk.name,
+ clientApkSha256 = clientToTSha256,
+ serviceApkSha256 = serviceToTSha256,
jsonClientOutputFile = jsonClientToTServiceToTClientTests,
jsonServiceOutputFile = jsonClientToTServiceToTServiceTests,
isClientPrevious = false,
isServicePrevious = false
)
writeConfigFileContent(
- clientApk = clientToTApk,
- serviceApk = servicePreviousApk,
- clientPath = clientToTPath.get(),
- servicePath = servicePreviousPath.get(),
+ clientApkName = clientToTApk.name,
+ serviceApkName = servicePreviousApk.name,
+ clientApkSha256 = clientToTSha256,
+ serviceApkSha256 = servicePreviousSha256,
jsonClientOutputFile = jsonClientToTServicePreviousClientTests,
jsonServiceOutputFile = jsonClientToTServicePreviousServiceTests,
isClientPrevious = false,
isServicePrevious = true
)
writeConfigFileContent(
- clientApk = clientPreviousApk,
- serviceApk = serviceToTApk,
- clientPath = clientPreviousPath.get(),
- servicePath = serviceToTPath.get(),
+ clientApkName = clientPreviousApk.name,
+ serviceApkName = serviceToTApk.name,
+ clientApkSha256 = clientPreviousSha256,
+ serviceApkSha256 = serviceToTSha256,
jsonClientOutputFile = jsonClientPreviousServiceToTClientTests,
jsonServiceOutputFile = jsonClientPreviousServiceToTServiceTests,
isClientPrevious = true,
@@ -165,26 +172,27 @@
?: throw RuntimeException("Cannot load required APK for task: $name")
}
- private fun BuiltArtifact.resolveName(path: String): String {
- return outputFile.substringAfterLast("/").renameApkForTesting(path)
+ private fun copyApkAndGetSha256(
+ apkFolder: DirectoryProperty,
+ apkLoader: Property<BuiltArtifactsLoader>,
+ destination: File
+ ): String {
+ val artifacts = apkLoader.get().load(apkFolder.get())
+ ?: throw RuntimeException("Cannot load required APK for task: $name")
+ File(artifacts.elements.single().outputFile).copyTo(destination, overwrite = true)
+ return sha256(destination)
}
private fun writeConfigFileContent(
- clientApk: BuiltArtifacts,
- serviceApk: BuiltArtifacts,
- clientPath: String,
- servicePath: String,
+ clientApkName: String,
+ serviceApkName: String,
+ clientApkSha256: String,
+ serviceApkSha256: String,
jsonClientOutputFile: RegularFileProperty,
jsonServiceOutputFile: RegularFileProperty,
isClientPrevious: Boolean,
isServicePrevious: Boolean,
) {
- val clientBuiltArtifact = clientApk.elements.single()
- val serviceBuiltArtifact = serviceApk.elements.single()
- val clientApkName = clientBuiltArtifact.resolveName(clientPath)
- val clientApkSha256 = sha256(File(clientBuiltArtifact.outputFile))
- val serviceApkName = serviceBuiltArtifact.resolveName(servicePath)
- val serviceApkSha256 = sha256(File(serviceBuiltArtifact.outputFile))
createOrFail(jsonClientOutputFile).writeText(
buildMediaJson(
configName = jsonClientOutputFile.asFile.get().name,
diff --git a/buildSrc/private/src/main/kotlin/androidx/build/testConfiguration/GenerateTestConfigurationTask.kt b/buildSrc/private/src/main/kotlin/androidx/build/testConfiguration/GenerateTestConfigurationTask.kt
index 64ce692..1960148 100644
--- a/buildSrc/private/src/main/kotlin/androidx/build/testConfiguration/GenerateTestConfigurationTask.kt
+++ b/buildSrc/private/src/main/kotlin/androidx/build/testConfiguration/GenerateTestConfigurationTask.kt
@@ -17,15 +17,14 @@
package androidx.build.testConfiguration
import androidx.build.dependencyTracker.ProjectSubset
-import androidx.build.renameApkForTesting
import com.android.build.api.variant.BuiltArtifactsLoader
import java.io.File
import org.gradle.api.DefaultTask
+import org.gradle.api.GradleException
import org.gradle.api.file.DirectoryProperty
import org.gradle.api.file.RegularFileProperty
import org.gradle.api.provider.ListProperty
import org.gradle.api.provider.Property
-import org.gradle.api.tasks.CacheableTask
import org.gradle.api.tasks.Input
import org.gradle.api.tasks.InputFiles
import org.gradle.api.tasks.Internal
@@ -34,6 +33,7 @@
import org.gradle.api.tasks.PathSensitive
import org.gradle.api.tasks.PathSensitivity
import org.gradle.api.tasks.TaskAction
+import org.gradle.work.DisableCachingByDefault
/**
* Writes a configuration file in
@@ -41,7 +41,7 @@
* format that gets zipped alongside the APKs to be tested.
* This config gets ingested by Tradefed.
*/
-@CacheableTask
+@DisableCachingByDefault(because = "Doesn't benefit from caching")
abstract class GenerateTestConfigurationTask : DefaultTask() {
@get:InputFiles
@@ -52,10 +52,6 @@
@get:Internal
abstract val appLoader: Property<BuiltArtifactsLoader>
- @get:Input
- @get:Optional
- abstract val appProjectPath: Property<String>
-
@get:InputFiles
@get:PathSensitive(PathSensitivity.RELATIVE)
abstract val testFolder: DirectoryProperty
@@ -96,6 +92,18 @@
@get:OutputFile
abstract val constrainedOutputXml: RegularFileProperty
+ @get:OutputFile
+ abstract val outputTestApk: RegularFileProperty
+
+ @get:OutputFile
+ abstract val constrainedOutputTestApk: RegularFileProperty
+
+ @get:[OutputFile Optional]
+ abstract val outputAppApk: RegularFileProperty
+
+ @get:[OutputFile Optional]
+ abstract val constrainedOutputAppApk: RegularFileProperty
+
@TaskAction
fun generateAndroidTestZip() {
writeConfigFileContent(
@@ -125,9 +133,13 @@
?: throw RuntimeException("Cannot load required APK for task: $name")
// We don't need to check hasBenchmarkPlugin because benchmarks shouldn't have test apps
val appApkBuiltArtifact = appApk.elements.single()
- val appName = appApkBuiltArtifact.outputFile.substringAfterLast("/")
- .renameApkForTesting(appProjectPath.get())
- configBuilder.appApkName(appName)
+ val destinationApk = if (isConstrained) {
+ constrainedOutputAppApk.get().asFile
+ } else {
+ outputAppApk.get().asFile
+ }
+ File(appApkBuiltArtifact.outputFile).copyTo(destinationApk, overwrite = true)
+ configBuilder.appApkName(destinationApk.name)
.appApkSha256(sha256(File(appApkBuiltArtifact.outputFile)))
}
configBuilder.additionalApkKeys(additionalApkKeys.get())
@@ -181,16 +193,25 @@
val testApk = testLoader.get().load(testFolder.get())
?: throw RuntimeException("Cannot load required APK for task: $name")
val testApkBuiltArtifact = testApk.elements.single()
- val testName = testApkBuiltArtifact.outputFile
- .substringAfterLast("/")
- .renameApkForTesting(testProjectPath.get())
- configBuilder.testApkName(testName)
+ val destinationApk = if (isConstrained) {
+ constrainedOutputTestApk.get().asFile
+ } else {
+ outputTestApk.get().asFile
+ }
+ File(testApkBuiltArtifact.outputFile).copyTo(destinationApk, overwrite = true)
+ configBuilder.testApkName(destinationApk.name)
.applicationId(testApk.applicationId)
.minSdk(minSdk.get().toString())
.testRunner(testRunner.get())
.testApkSha256(sha256(File(testApkBuiltArtifact.outputFile)))
createOrFail(outputFile).writeText(configBuilder.buildXml())
if (!isConstrained) {
+ if (!outputJson.asFile.get().name.startsWith("_")) {
+ // Prefixing json file names with _ allows us to collocate these files
+ // inside of the androidTest.zip to make fetching them less expensive.
+ throw GradleException("json output file names are expected to use _ prefix to, " +
+ "currently set to ${outputJson.asFile.get().name}")
+ }
createOrFail(outputJson).writeText(configBuilder.buildJson())
}
}
diff --git a/buildSrc/private/src/main/kotlin/androidx/build/testConfiguration/TestSuiteConfiguration.kt b/buildSrc/private/src/main/kotlin/androidx/build/testConfiguration/TestSuiteConfiguration.kt
index 1c9a5e5..8ca7eb7 100644
--- a/buildSrc/private/src/main/kotlin/androidx/build/testConfiguration/TestSuiteConfiguration.kt
+++ b/buildSrc/private/src/main/kotlin/androidx/build/testConfiguration/TestSuiteConfiguration.kt
@@ -30,20 +30,16 @@
import androidx.build.hasAndroidTestSourceCode
import androidx.build.hasBenchmarkPlugin
import androidx.build.isPresubmitBuild
-import androidx.build.renameApkForTesting
import com.android.build.api.artifact.Artifacts
import com.android.build.api.artifact.SingleArtifact
import com.android.build.api.variant.AndroidComponentsExtension
import com.android.build.api.variant.ApplicationAndroidComponentsExtension
import com.android.build.api.variant.HasAndroidTest
import com.android.build.gradle.BaseExtension
-import com.android.build.gradle.tasks.PackageAndroidArtifact
import java.io.File
import org.gradle.api.Project
import org.gradle.api.UnknownTaskException
-import org.gradle.api.file.DuplicatesStrategy
import org.gradle.api.tasks.TaskProvider
-import org.gradle.api.tasks.bundling.Zip
import org.gradle.kotlin.dsl.getByType
/**
@@ -62,7 +58,7 @@
overrideProject: Project = this
) {
val xmlName = "${path.asFilenamePrefix()}$variantName.xml"
- val jsonName = "${path.asFilenamePrefix()}$variantName.json"
+ val jsonName = "_${path.asFilenamePrefix()}$variantName.json"
rootProject.tasks.named("createModuleInfo").configure {
it as ModuleInfoGenerator
it.testModules.add(
@@ -80,6 +76,15 @@
task.testFolder.set(artifacts.get(SingleArtifact.APK))
task.testLoader.set(artifacts.getBuiltArtifactsLoader())
+ task.outputTestApk.set(
+ File(getTestConfigDirectory(), "${path.asFilenamePrefix()}-$variantName.apk")
+ )
+ task.constrainedOutputTestApk.set(
+ File(
+ getConstrainedTestConfigDirectory(),
+ "${path.asFilenamePrefix()}-$variantName.apk"
+ )
+ )
task.additionalApkKeys.set(androidXExtension.additionalDeviceTestApkKeys)
task.additionalTags.set(androidXExtension.additionalDeviceTestTags)
task.outputXml.fileValue(File(getTestConfigDirectory(), xmlName))
@@ -130,20 +135,42 @@
getOrCreateMacrobenchmarkConfigTask().configure { configTask ->
configTask.appFolder.set(appVariant.artifacts.get(SingleArtifact.APK))
configTask.appLoader.set(appVariant.artifacts.getBuiltArtifactsLoader())
- configTask.appProjectPath.set(path)
+ configTask.outputAppApk.set(
+ File(
+ getTestConfigDirectory(),
+ "${path.asFilenamePrefix()}-${appVariant.name}.apk"
+ )
+ )
+ configTask.constrainedOutputAppApk.set(
+ File(
+ getConstrainedTestConfigDirectory(),
+ "${path.asFilenamePrefix()}-${appVariant.name}.apk"
+ )
+ )
}
if (path == ":benchmark:integration-tests:macrobenchmark-target") {
// Ugly workaround for b/188699825 where we hardcode that
// :benchmark:integration-tests:macrobenchmark-target needs to be installed
// for :benchmark:benchmark-macro tests to work.
- project(":benchmark:benchmark-macro").tasks.withType(
+ project(MACRO_PROJECT).tasks.withType(
GenerateTestConfigurationTask::class.java
).named(
"${AndroidXImplPlugin.GENERATE_TEST_CONFIGURATION_TASK}debugAndroidTest"
).configure { configTask ->
configTask.appFolder.set(appVariant.artifacts.get(SingleArtifact.APK))
configTask.appLoader.set(appVariant.artifacts.getBuiltArtifactsLoader())
- configTask.appProjectPath.set(path)
+ configTask.outputAppApk.set(
+ File(
+ getTestConfigDirectory(),
+ "${MACRO_PROJECT.asFilenamePrefix()}-${appVariant.name}.apk"
+ )
+ )
+ configTask.constrainedOutputAppApk.set(
+ File(
+ getConstrainedTestConfigDirectory(),
+ "${MACRO_PROJECT.asFilenamePrefix()}-${appVariant.name}.apk"
+ )
+ )
}
}
}
@@ -160,42 +187,23 @@
configTask as GenerateTestConfigurationTask
configTask.appFolder.set(appVariant.artifacts.get(SingleArtifact.APK))
configTask.appLoader.set(appVariant.artifacts.getBuiltArtifactsLoader())
- configTask.appProjectPath.set(path)
+ configTask.outputAppApk.set(
+ File(
+ getTestConfigDirectory(),
+ "${path.asFilenamePrefix()}-${appVariant.name}.apk"
+ )
+ )
+ configTask.constrainedOutputAppApk.set(
+ File(
+ getConstrainedTestConfigDirectory(),
+ "${path.asFilenamePrefix()}-${appVariant.name}.apk"
+ )
+ )
}
}
}
}
-/**
- * Configures the test zip task to include the project's apk
- */
-fun addToTestZips(project: Project, packageTask: PackageAndroidArtifact) {
- project.rootProject.tasks.named(ZIP_TEST_CONFIGS_WITH_APKS_TASK) { task ->
- task as Zip
- val projectPath = project.path
- task.from(packageTask.outputDirectory) {
- it.include("*.apk")
- it.duplicatesStrategy = DuplicatesStrategy.FAIL
- it.rename { fileName ->
- fileName.renameApkForTesting(projectPath)
- }
- }
- task.dependsOn(packageTask)
- }
- project.rootProject.tasks.named(ZIP_CONSTRAINED_TEST_CONFIGS_WITH_APKS_TASK) { task ->
- task as Zip
- val projectPath = project.path
- task.from(packageTask.outputDirectory) {
- it.include("*.apk")
- it.duplicatesStrategy = DuplicatesStrategy.FAIL
- it.rename { fileName ->
- fileName.renameApkForTesting(projectPath)
- }
- }
- task.dependsOn(packageTask)
- }
-}
-
private fun getOrCreateMediaTestConfigTask(project: Project, isMedia2: Boolean):
TaskProvider<GenerateMediaTestConfigurationTask> {
val mediaPrefix = getMediaConfigTaskPrefix(isMedia2)
@@ -253,59 +261,67 @@
if (this.name.contains("previous")) {
it.clientPreviousFolder.set(artifacts.get(SingleArtifact.APK))
it.clientPreviousLoader.set(artifacts.getBuiltArtifactsLoader())
- it.clientPreviousPath.set(this.path)
} else {
it.clientToTFolder.set(artifacts.get(SingleArtifact.APK))
it.clientToTLoader.set(artifacts.getBuiltArtifactsLoader())
- it.clientToTPath.set(this.path)
}
} else {
if (this.name.contains("previous")) {
it.servicePreviousFolder.set(artifacts.get(SingleArtifact.APK))
it.servicePreviousLoader.set(artifacts.getBuiltArtifactsLoader())
- it.servicePreviousPath.set(this.path)
} else {
it.serviceToTFolder.set(artifacts.get(SingleArtifact.APK))
it.serviceToTLoader.set(artifacts.getBuiltArtifactsLoader())
- it.serviceToTPath.set(this.path)
}
}
it.jsonClientPreviousServiceToTClientTests.fileValue(
File(
this.getTestConfigDirectory(),
- "${mediaPrefix}ClientPreviousServiceToTClientTests$variantName.json"
+ "_${mediaPrefix}ClientPreviousServiceToTClientTests$variantName.json"
)
)
it.jsonClientPreviousServiceToTServiceTests.fileValue(
File(
this.getTestConfigDirectory(),
- "${mediaPrefix}ClientPreviousServiceToTServiceTests$variantName.json"
+ "_${mediaPrefix}ClientPreviousServiceToTServiceTests$variantName.json"
)
)
it.jsonClientToTServicePreviousClientTests.fileValue(
File(
this.getTestConfigDirectory(),
- "${mediaPrefix}ClientToTServicePreviousClientTests$variantName.json"
+ "_${mediaPrefix}ClientToTServicePreviousClientTests$variantName.json"
)
)
it.jsonClientToTServicePreviousServiceTests.fileValue(
File(
this.getTestConfigDirectory(),
- "${mediaPrefix}ClientToTServicePreviousServiceTests$variantName.json"
+ "_${mediaPrefix}ClientToTServicePreviousServiceTests$variantName.json"
)
)
it.jsonClientToTServiceToTClientTests.fileValue(
File(
this.getTestConfigDirectory(),
- "${mediaPrefix}ClientToTServiceToTClientTests$variantName.json"
+ "_${mediaPrefix}ClientToTServiceToTClientTests$variantName.json"
)
)
it.jsonClientToTServiceToTServiceTests.fileValue(
File(
this.getTestConfigDirectory(),
- "${mediaPrefix}ClientToTServiceToTServiceTests$variantName.json"
+ "_${mediaPrefix}ClientToTServiceToTServiceTests$variantName.json"
)
)
+ it.totClientApk.fileValue(
+ File(getTestConfigDirectory(), "${mediaPrefix}ClientToT$variantName.apk")
+ )
+ it.previousClientApk.fileValue(
+ File(getTestConfigDirectory(), "${mediaPrefix}ClientPrevious$variantName.apk")
+ )
+ it.totServiceApk.fileValue(
+ File(getTestConfigDirectory(), "${mediaPrefix}ServiceToT$variantName.apk")
+ )
+ it.previousServiceApk.fileValue(
+ File(getTestConfigDirectory(), "${mediaPrefix}ServicePrevious$variantName.apk")
+ )
it.minSdk.set(minSdk)
it.testRunner.set(testRunner)
it.presubmit.set(isPresubmitBuild())
@@ -339,13 +355,22 @@
val fileNamePrefix = path.asFilenamePrefix()
task.testFolder.set(artifacts.get(SingleArtifact.APK))
task.testLoader.set(artifacts.getBuiltArtifactsLoader())
+ task.outputTestApk.set(
+ File(getTestConfigDirectory(), "${path.asFilenamePrefix()}-$variantName.apk")
+ )
+ task.constrainedOutputTestApk.set(
+ File(
+ getConstrainedTestConfigDirectory(),
+ "${path.asFilenamePrefix()}-$variantName.apk"
+ )
+ )
task.additionalApkKeys.set(androidXExtension.additionalDeviceTestApkKeys)
task.additionalTags.set(androidXExtension.additionalDeviceTestTags)
task.outputXml.fileValue(
File(getTestConfigDirectory(), "$fileNamePrefix$variantName.xml")
)
task.outputJson.fileValue(
- File(getTestConfigDirectory(), "$fileNamePrefix$variantName.json")
+ File(getTestConfigDirectory(), "_$fileNamePrefix$variantName.json")
)
task.constrainedOutputXml.fileValue(
File(
@@ -448,3 +473,5 @@
}
}
}
+
+private const val MACRO_PROJECT = ":benchmark:benchmark-macro"
\ No newline at end of file
diff --git a/buildSrc/public/src/main/kotlin/androidx/build/SupportConfig.kt b/buildSrc/public/src/main/kotlin/androidx/build/SupportConfig.kt
index de3d495..e0087b3 100644
--- a/buildSrc/public/src/main/kotlin/androidx/build/SupportConfig.kt
+++ b/buildSrc/public/src/main/kotlin/androidx/build/SupportConfig.kt
@@ -25,7 +25,7 @@
const val DEFAULT_MIN_SDK_VERSION = 14
const val INSTRUMENTATION_RUNNER = "androidx.test.runner.AndroidJUnitRunner"
private const val INTERNAL_BUILD_TOOLS_VERSION = "34.0.0-rc3"
- private const val PUBLIC_BUILD_TOOLS_VERSION = "33.0.1"
+ private const val PUBLIC_BUILD_TOOLS_VERSION = "34.0.0-rc3"
const val NDK_VERSION = "23.1.7779620"
/**
diff --git a/camera/camera-camera2-pipe-integration/src/main/AndroidManifest.xml b/camera/camera-camera2-pipe-integration/src/main/AndroidManifest.xml
deleted file mode 100644
index 9cd4123..0000000
--- a/camera/camera-camera2-pipe-integration/src/main/AndroidManifest.xml
+++ /dev/null
@@ -1,17 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
- 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.
- -->
-<manifest />
diff --git a/camera/camera-camera2-pipe-integration/src/main/java/androidx/camera/camera2/pipe/integration/impl/UseCaseManager.kt b/camera/camera-camera2-pipe-integration/src/main/java/androidx/camera/camera2/pipe/integration/impl/UseCaseManager.kt
index e0a02ad..a289f28 100644
--- a/camera/camera-camera2-pipe-integration/src/main/java/androidx/camera/camera2/pipe/integration/impl/UseCaseManager.kt
+++ b/camera/camera-camera2-pipe-integration/src/main/java/androidx/camera/camera2/pipe/integration/impl/UseCaseManager.kt
@@ -31,9 +31,11 @@
import androidx.camera.camera2.pipe.integration.interop.Camera2CameraControl
import androidx.camera.camera2.pipe.integration.interop.ExperimentalCamera2Interop
import androidx.camera.core.UseCase
+import androidx.camera.core.impl.CameraInternal
import androidx.camera.core.impl.DeferrableSurface
import androidx.camera.core.impl.SessionConfig.ValidatingBuilder
import javax.inject.Inject
+import javax.inject.Provider
import kotlinx.coroutines.Job
import kotlinx.coroutines.joinAll
@@ -75,6 +77,7 @@
private val cameraStateAdapter: CameraStateAdapter,
private val cameraQuirks: CameraQuirks,
private val cameraGraphFlags: CameraGraph.Flags,
+ private val cameraInternal: Provider<CameraInternal>,
cameraProperties: CameraProperties,
displayInfoManager: DisplayInfoManager,
) {
@@ -318,6 +321,7 @@
@GuardedBy("lock")
private fun addRepeatingUseCase() {
+ meteringRepeating.bindToCamera(cameraInternal.get(), null, null)
meteringRepeating.setupSession()
attach(listOf(meteringRepeating))
activate(meteringRepeating)
@@ -338,7 +342,7 @@
private fun removeRepeatingUseCase() {
deactivate(meteringRepeating)
detach(listOf(meteringRepeating))
- meteringRepeating.onUnbind()
+ meteringRepeating.unbindFromCamera(cameraInternal.get())
}
private fun Collection<UseCase>.onlyVideoCapture(): Boolean {
diff --git a/camera/camera-camera2-pipe-integration/src/test/java/androidx/camera/camera2/pipe/integration/impl/UseCaseManagerTest.kt b/camera/camera-camera2-pipe-integration/src/test/java/androidx/camera/camera2/pipe/integration/impl/UseCaseManagerTest.kt
index 9248cf6..d4488e2 100644
--- a/camera/camera-camera2-pipe-integration/src/test/java/androidx/camera/camera2/pipe/integration/impl/UseCaseManagerTest.kt
+++ b/camera/camera-camera2-pipe-integration/src/test/java/androidx/camera/camera2/pipe/integration/impl/UseCaseManagerTest.kt
@@ -312,25 +312,29 @@
controls: Set<UseCaseCameraControl> = emptySet(),
useCaseCameraComponentBuilder: FakeUseCaseCameraComponentBuilder =
FakeUseCaseCameraComponentBuilder(),
- ) = UseCaseManager(
- cameraConfig = CameraConfig(CameraId("0")),
- builder = useCaseCameraComponentBuilder,
- controls = controls as java.util.Set<UseCaseCameraControl>,
- cameraProperties = FakeCameraProperties(),
- camera2CameraControl = Camera2CameraControl.create(
- FakeCamera2CameraControlCompat(),
- useCaseThreads,
- ComboRequestListener()
- ),
- cameraStateAdapter = CameraStateAdapter(),
- cameraGraphFlags = CameraGraph.Flags(),
- cameraQuirks = CameraQuirks(
- FakeCameraMetadata(),
- StreamConfigurationMapCompat(null, OutputSizesCorrector(FakeCameraMetadata(), null))
- ),
- displayInfoManager = DisplayInfoManager(ApplicationProvider.getApplicationContext()),
- ).also {
- useCaseManagerList.add(it)
+ ): UseCaseManager {
+ val fakeCamera = FakeCamera()
+ return UseCaseManager(
+ cameraConfig = CameraConfig(CameraId("0")),
+ builder = useCaseCameraComponentBuilder,
+ controls = controls as java.util.Set<UseCaseCameraControl>,
+ cameraProperties = FakeCameraProperties(),
+ camera2CameraControl = Camera2CameraControl.create(
+ FakeCamera2CameraControlCompat(),
+ useCaseThreads,
+ ComboRequestListener()
+ ),
+ cameraStateAdapter = CameraStateAdapter(),
+ cameraGraphFlags = CameraGraph.Flags(),
+ cameraInternal = { fakeCamera },
+ cameraQuirks = CameraQuirks(
+ FakeCameraMetadata(),
+ StreamConfigurationMapCompat(null, OutputSizesCorrector(FakeCameraMetadata(), null))
+ ),
+ displayInfoManager = DisplayInfoManager(ApplicationProvider.getApplicationContext()),
+ ).also {
+ useCaseManagerList.add(it)
+ }
}
private fun createImageCapture(): ImageCapture =
diff --git a/camera/camera-camera2-pipe-testing/src/main/AndroidManifest.xml b/camera/camera-camera2-pipe-testing/src/main/AndroidManifest.xml
deleted file mode 100644
index 9515a11..0000000
--- a/camera/camera-camera2-pipe-testing/src/main/AndroidManifest.xml
+++ /dev/null
@@ -1,16 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?><!--
- 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.
- -->
-<manifest />
diff --git a/camera/camera-camera2-pipe/src/main/AndroidManifest.xml b/camera/camera-camera2-pipe/src/main/AndroidManifest.xml
deleted file mode 100644
index 9515a11..0000000
--- a/camera/camera-camera2-pipe/src/main/AndroidManifest.xml
+++ /dev/null
@@ -1,16 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?><!--
- 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.
- -->
-<manifest />
diff --git a/camera/camera-camera2/src/androidTest/java/androidx/camera/camera2/internal/compat/workaround/ExtraSupportedSurfaceCombinationsContainerDeviceTest.kt b/camera/camera-camera2/src/androidTest/java/androidx/camera/camera2/internal/compat/workaround/ExtraSupportedSurfaceCombinationsContainerDeviceTest.kt
index 053529d..cfded9e 100644
--- a/camera/camera-camera2/src/androidTest/java/androidx/camera/camera2/internal/compat/workaround/ExtraSupportedSurfaceCombinationsContainerDeviceTest.kt
+++ b/camera/camera-camera2/src/androidTest/java/androidx/camera/camera2/internal/compat/workaround/ExtraSupportedSurfaceCombinationsContainerDeviceTest.kt
@@ -174,6 +174,10 @@
val callback = FakeImageCaptureCallback()
imageCapture.takePicture(CameraXExecutors.directExecutor(), callback)
callback.awaitCapturesAndAssert()
+
+ withContext(Dispatchers.Main) {
+ cameraUseCaseAdapter.removeUseCases(cameraUseCaseAdapter.useCases)
+ }
}
@SdkSuppress(minSdkVersion = 28)
@@ -229,6 +233,10 @@
val callback = FakeImageCaptureCallback()
imageCapture.takePicture(CameraXExecutors.directExecutor(), callback)
callback.awaitCapturesAndAssert()
+
+ withContext(Dispatchers.Main) {
+ cameraUseCaseAdapter.removeUseCases(cameraUseCaseAdapter.useCases)
+ }
}
private fun enableSessionProcessor(
diff --git a/camera/camera-extensions-stub/src/main/AndroidManifest.xml b/camera/camera-extensions-stub/src/main/AndroidManifest.xml
deleted file mode 100644
index 9517533..0000000
--- a/camera/camera-extensions-stub/src/main/AndroidManifest.xml
+++ /dev/null
@@ -1,17 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
- Copyright 2019 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.
- -->
-<manifest />
\ No newline at end of file
diff --git a/camera/camera-lifecycle/src/main/AndroidManifest.xml b/camera/camera-lifecycle/src/main/AndroidManifest.xml
deleted file mode 100644
index 39dd6cb..0000000
--- a/camera/camera-lifecycle/src/main/AndroidManifest.xml
+++ /dev/null
@@ -1,16 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2019 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.
--->
-<manifest />
diff --git a/camera/camera-testlib-extensions/src/main/AndroidManifest.xml b/camera/camera-testlib-extensions/src/main/AndroidManifest.xml
deleted file mode 100644
index 9517533..0000000
--- a/camera/camera-testlib-extensions/src/main/AndroidManifest.xml
+++ /dev/null
@@ -1,17 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
- Copyright 2019 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.
- -->
-<manifest />
\ No newline at end of file
diff --git a/camera/camera-video/src/main/AndroidManifest.xml b/camera/camera-video/src/main/AndroidManifest.xml
deleted file mode 100644
index 9a5f4d9..0000000
--- a/camera/camera-video/src/main/AndroidManifest.xml
+++ /dev/null
@@ -1,16 +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.
- -->
-<manifest />
\ No newline at end of file
diff --git a/camera/camera-view/src/main/AndroidManifest.xml b/camera/camera-view/src/main/AndroidManifest.xml
deleted file mode 100644
index 39dd6cb..0000000
--- a/camera/camera-view/src/main/AndroidManifest.xml
+++ /dev/null
@@ -1,16 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2019 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.
--->
-<manifest />
diff --git a/camera/integration-tests/coretestapp/src/androidTest/java/androidx/camera/integration/core/ImageCaptureTest.kt b/camera/integration-tests/coretestapp/src/androidTest/java/androidx/camera/integration/core/ImageCaptureTest.kt
index 72473a5..1208c6a 100644
--- a/camera/integration-tests/coretestapp/src/androidTest/java/androidx/camera/integration/core/ImageCaptureTest.kt
+++ b/camera/integration-tests/coretestapp/src/androidTest/java/androidx/camera/integration/core/ImageCaptureTest.kt
@@ -99,7 +99,6 @@
import org.junit.Assume.assumeNotNull
import org.junit.Assume.assumeTrue
import org.junit.Before
-import org.junit.Ignore
import org.junit.Rule
import org.junit.Test
import org.junit.rules.TemporaryFolder
@@ -1579,8 +1578,13 @@
}
@Test
- @Ignore("b/280379397")
fun unbindVideoCaptureWithoutStartingRecorder_imageCapturingShouldSuccess() = runBlocking {
+ assumeTrue("b/280379397", implName != Camera2Config::class.simpleName)
+ assumeTrue(
+ "b/280560222: takePicture request is discarded if UseCaseCamera is recreated",
+ implName != CameraPipeConfig::class.simpleName
+ )
+
// Arrange.
val imageCapture = ImageCapture.Builder().build()
val videoStreamReceived = CompletableDeferred<Boolean>()
diff --git a/cardview/cardview/src/main/AndroidManifest.xml b/cardview/cardview/src/main/AndroidManifest.xml
deleted file mode 100644
index 6f49e23..0000000
--- a/cardview/cardview/src/main/AndroidManifest.xml
+++ /dev/null
@@ -1,16 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2014 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.
--->
-<manifest />
diff --git a/collection/collection-benchmark/src/androidMain/AndroidManifest.xml b/collection/collection-benchmark/src/androidMain/AndroidManifest.xml
deleted file mode 100644
index deac81d..0000000
--- a/collection/collection-benchmark/src/androidMain/AndroidManifest.xml
+++ /dev/null
@@ -1,17 +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.
- -->
-
-<manifest />
diff --git a/compose/animation/animation-core/samples/src/main/AndroidManifest.xml b/compose/animation/animation-core/samples/src/main/AndroidManifest.xml
deleted file mode 100644
index dc2f180..0000000
--- a/compose/animation/animation-core/samples/src/main/AndroidManifest.xml
+++ /dev/null
@@ -1,17 +0,0 @@
-<!--
- ~ Copyright (C) 2019 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
- -->
-
-<manifest />
diff --git a/compose/animation/animation-core/src/androidAndroidTest/AndroidManifest.xml b/compose/animation/animation-core/src/androidAndroidTest/AndroidManifest.xml
deleted file mode 100644
index 127ad73..0000000
--- a/compose/animation/animation-core/src/androidAndroidTest/AndroidManifest.xml
+++ /dev/null
@@ -1,16 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?><!--
- ~ 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.
- -->
-<manifest />
diff --git a/compose/animation/animation-core/src/androidMain/AndroidManifest.xml b/compose/animation/animation-core/src/androidMain/AndroidManifest.xml
deleted file mode 100644
index 34d825b..0000000
--- a/compose/animation/animation-core/src/androidMain/AndroidManifest.xml
+++ /dev/null
@@ -1,17 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
- ~ Copyright 2019 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.
- -->
-<manifest />
diff --git a/compose/animation/animation-core/src/commonMain/kotlin/androidx/compose/animation/core/Transition.kt b/compose/animation/animation-core/src/commonMain/kotlin/androidx/compose/animation/core/Transition.kt
index 21c13c8..ccbfd2a 100644
--- a/compose/animation/animation-core/src/commonMain/kotlin/androidx/compose/animation/core/Transition.kt
+++ b/compose/animation/animation-core/src/commonMain/kotlin/androidx/compose/animation/core/Transition.kt
@@ -39,6 +39,7 @@
import androidx.compose.ui.unit.IntSize
import kotlin.math.max
import androidx.compose.animation.core.internal.JvmDefaultWithCompatibility
+import androidx.compose.runtime.mutableLongStateOf
import kotlin.jvm.JvmName
/**
@@ -231,8 +232,8 @@
* @suppress
*/
@InternalAnimationApi
- var playTimeNanos by mutableStateOf(0L)
- private var startTimeNanos by mutableStateOf(AnimationConstants.UnspecifiedTime)
+ var playTimeNanos by mutableLongStateOf(0L)
+ private var startTimeNanos by mutableLongStateOf(AnimationConstants.UnspecifiedTime)
// This gets calculated every time child is updated/added
internal var updateChildrenNeeded: Boolean by mutableStateOf(true)
@@ -495,7 +496,7 @@
private set
internal var isFinished: Boolean by mutableStateOf(true)
- private var offsetTimeNanos by mutableStateOf(0L)
+ private var offsetTimeNanos by mutableLongStateOf(0L)
private var needsReset by mutableStateOf(false)
// Changed during animation, no concerns of rolling back
diff --git a/compose/animation/animation-graphics/samples/src/main/AndroidManifest.xml b/compose/animation/animation-graphics/samples/src/main/AndroidManifest.xml
deleted file mode 100644
index 3063116..0000000
--- a/compose/animation/animation-graphics/samples/src/main/AndroidManifest.xml
+++ /dev/null
@@ -1,17 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
- ~ Copyright 2021 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.
--->
-<manifest />
diff --git a/compose/animation/animation-graphics/src/androidAndroidTest/AndroidManifest.xml b/compose/animation/animation-graphics/src/androidAndroidTest/AndroidManifest.xml
deleted file mode 100644
index 3c3c224..0000000
--- a/compose/animation/animation-graphics/src/androidAndroidTest/AndroidManifest.xml
+++ /dev/null
@@ -1,17 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
- Copyright 2021 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.
- -->
-<manifest />
diff --git a/compose/animation/animation-graphics/src/androidMain/AndroidManifest.xml b/compose/animation/animation-graphics/src/androidMain/AndroidManifest.xml
deleted file mode 100644
index 3063116..0000000
--- a/compose/animation/animation-graphics/src/androidMain/AndroidManifest.xml
+++ /dev/null
@@ -1,17 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
- ~ Copyright 2021 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.
--->
-<manifest />
diff --git a/compose/animation/animation/integration-tests/animation-demos/src/main/AndroidManifest.xml b/compose/animation/animation/integration-tests/animation-demos/src/main/AndroidManifest.xml
deleted file mode 100644
index dc2f180..0000000
--- a/compose/animation/animation/integration-tests/animation-demos/src/main/AndroidManifest.xml
+++ /dev/null
@@ -1,17 +0,0 @@
-<!--
- ~ Copyright (C) 2019 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
- -->
-
-<manifest />
diff --git a/compose/animation/animation/integration-tests/animation-demos/src/main/java/androidx/compose/animation/demos/fancy/AnimatedClockDemo.kt b/compose/animation/animation/integration-tests/animation-demos/src/main/java/androidx/compose/animation/demos/fancy/AnimatedClockDemo.kt
index f7b4e9ca..e3a7df2 100644
--- a/compose/animation/animation/integration-tests/animation-demos/src/main/java/androidx/compose/animation/demos/fancy/AnimatedClockDemo.kt
+++ b/compose/animation/animation/integration-tests/animation-demos/src/main/java/androidx/compose/animation/demos/fancy/AnimatedClockDemo.kt
@@ -38,7 +38,8 @@
import androidx.compose.runtime.LaunchedEffect
import androidx.compose.runtime.State
import androidx.compose.runtime.getValue
-import androidx.compose.runtime.mutableStateOf
+import androidx.compose.runtime.mutableFloatStateOf
+import androidx.compose.runtime.mutableIntStateOf
import androidx.compose.runtime.remember
import androidx.compose.runtime.setValue
import androidx.compose.ui.Modifier
@@ -63,9 +64,9 @@
@Composable
fun AnimatedClockDemo() {
val calendar = remember { Calendar.getInstance() }
- val seconds = remember { mutableStateOf(calendar[Calendar.SECOND]) }
- val minutes = remember { mutableStateOf(calendar[Calendar.MINUTE]) }
- val hours = remember { mutableStateOf(calendar[Calendar.HOUR_OF_DAY]) }
+ val seconds = remember { mutableIntStateOf(calendar[Calendar.SECOND]) }
+ val minutes = remember { mutableIntStateOf(calendar[Calendar.MINUTE]) }
+ val hours = remember { mutableIntStateOf(calendar[Calendar.HOUR_OF_DAY]) }
LaunchedEffect(key1 = Unit) {
// Start from 23:59:50 to give an impressive animation for all numbers
calendar.set(2020, 10, 10, 23, 59, 50)
@@ -74,9 +75,9 @@
while (isActive) {
withInfiniteAnimationFrameMillis {
calendar.timeInMillis = it - firstFrameTime + initialTime
- seconds.value = calendar[Calendar.SECOND]
- minutes.value = calendar[Calendar.MINUTE]
- hours.value = calendar[Calendar.HOUR_OF_DAY]
+ seconds.intValue = calendar[Calendar.SECOND]
+ minutes.intValue = calendar[Calendar.MINUTE]
+ hours.intValue = calendar[Calendar.HOUR_OF_DAY]
}
}
}
@@ -110,7 +111,7 @@
targetValue = ((9 - digit) * digitHeight).dp,
animationSpec = tween(moveDuration),
).value
- var circleOffset by remember { mutableStateOf(0f) }
+ var circleOffset by remember { mutableFloatStateOf(0f) }
LaunchedEffect(digit) {
if (digit == 0) return@LaunchedEffect // Don't animate for 0 as direction is reversed
animate(
@@ -124,7 +125,7 @@
animationSpec = spring(dampingRatio = 0.6f)
) { animationValue, _ -> circleOffset = animationValue }
}
- var circleStretch by remember { mutableStateOf(1f) }
+ var circleStretch by remember { mutableFloatStateOf(1f) }
LaunchedEffect(digit) {
if (digit == 0) return@LaunchedEffect // Don't animate for 0 as direction is reversed
animate(
diff --git a/compose/animation/animation/integration-tests/animation-demos/src/main/java/androidx/compose/animation/demos/fancy/ChatScreenDemo.kt b/compose/animation/animation/integration-tests/animation-demos/src/main/java/androidx/compose/animation/demos/fancy/ChatScreenDemo.kt
index 565070f..8fe01ca 100644
--- a/compose/animation/animation/integration-tests/animation-demos/src/main/java/androidx/compose/animation/demos/fancy/ChatScreenDemo.kt
+++ b/compose/animation/animation/integration-tests/animation-demos/src/main/java/androidx/compose/animation/demos/fancy/ChatScreenDemo.kt
@@ -36,8 +36,8 @@
import androidx.compose.runtime.LaunchedEffect
import androidx.compose.runtime.MutableState
import androidx.compose.runtime.getValue
+import androidx.compose.runtime.mutableFloatStateOf
import androidx.compose.runtime.mutableStateListOf
-import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
@@ -113,13 +113,13 @@
@Composable
private fun animateCorner(hasSharpCorner: Boolean): MutableState<Float> {
- val state = remember { mutableStateOf(roundCornerSize) }
+ val state = remember { mutableFloatStateOf(roundCornerSize) }
LaunchedEffect(hasSharpCorner) {
animate(
- initialValue = state.value,
+ initialValue = state.floatValue,
targetValue = if (hasSharpCorner) 2f else roundCornerSize,
animationSpec = spring(stiffness = 50f, dampingRatio = 0.6f)
- ) { animationValue, _ -> state.value = animationValue }
+ ) { animationValue, _ -> state.floatValue = animationValue }
}
return state
}
diff --git a/compose/animation/animation/integration-tests/animation-demos/src/main/java/androidx/compose/animation/demos/gesture/FancyScrollingDemo.kt b/compose/animation/animation/integration-tests/animation-demos/src/main/java/androidx/compose/animation/demos/gesture/FancyScrollingDemo.kt
index c1d1e00..dadf80c 100644
--- a/compose/animation/animation/integration-tests/animation-demos/src/main/java/androidx/compose/animation/demos/gesture/FancyScrollingDemo.kt
+++ b/compose/animation/animation/integration-tests/animation-demos/src/main/java/androidx/compose/animation/demos/gesture/FancyScrollingDemo.kt
@@ -31,7 +31,7 @@
import androidx.compose.foundation.layout.height
import androidx.compose.material.Text
import androidx.compose.runtime.Composable
-import androidx.compose.runtime.mutableStateOf
+import androidx.compose.runtime.mutableFloatStateOf
import androidx.compose.runtime.remember
import androidx.compose.runtime.rememberCoroutineScope
import androidx.compose.ui.Modifier
@@ -57,7 +57,7 @@
modifier = Modifier.padding(40.dp)
)
val animScroll = remember { Animatable(0f) }
- val itemWidth = remember { mutableStateOf(0f) }
+ val itemWidth = remember { mutableFloatStateOf(0f) }
val scope = rememberCoroutineScope()
val modifier = Modifier.draggable(
orientation = Orientation.Horizontal,
diff --git a/compose/animation/animation/integration-tests/animation-demos/src/main/java/androidx/compose/animation/demos/gesture/SpringBackScrollingDemo.kt b/compose/animation/animation/integration-tests/animation-demos/src/main/java/androidx/compose/animation/demos/gesture/SpringBackScrollingDemo.kt
index b954194..71d4605 100644
--- a/compose/animation/animation/integration-tests/animation-demos/src/main/java/androidx/compose/animation/demos/gesture/SpringBackScrollingDemo.kt
+++ b/compose/animation/animation/integration-tests/animation-demos/src/main/java/androidx/compose/animation/demos/gesture/SpringBackScrollingDemo.kt
@@ -36,6 +36,7 @@
import androidx.compose.material.Text
import androidx.compose.runtime.Composable
import androidx.compose.runtime.getValue
+import androidx.compose.runtime.mutableFloatStateOf
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
import androidx.compose.runtime.setValue
@@ -64,8 +65,8 @@
fontSize = 20.sp
)
- var scrollPosition by remember { mutableStateOf(0f) }
- val itemWidth = remember { mutableStateOf(0f) }
+ var scrollPosition by remember { mutableFloatStateOf(0f) }
+ var itemWidth by remember { mutableFloatStateOf(0f) }
val mutatorMutex = remember { MutatorMutex() }
var animation by remember { mutableStateOf(AnimationState(scrollPosition)) }
@@ -96,7 +97,7 @@
val springBackTarget: Float = calculateSpringBackTarget(
target,
latestVelocityX,
- itemWidth.value
+ itemWidth
)
animation.animateDecay(exponentialDecay()) {
@@ -129,7 +130,7 @@
}
}
Canvas(gesture.fillMaxWidth().height(400.dp)) {
- itemWidth.value = size.width / 2f
+ itemWidth = size.width / 2f
if (DEBUG) {
println(
"Anim, Spring back scrolling, redrawing with new" +
diff --git a/compose/animation/animation/integration-tests/animation-demos/src/main/java/androidx/compose/animation/demos/gesture/SwipeToDismissDemo.kt b/compose/animation/animation/integration-tests/animation-demos/src/main/java/androidx/compose/animation/demos/gesture/SwipeToDismissDemo.kt
index befd745..faa1d47 100644
--- a/compose/animation/animation/integration-tests/animation-demos/src/main/java/androidx/compose/animation/demos/gesture/SwipeToDismissDemo.kt
+++ b/compose/animation/animation/integration-tests/animation-demos/src/main/java/androidx/compose/animation/demos/gesture/SwipeToDismissDemo.kt
@@ -34,7 +34,7 @@
import androidx.compose.runtime.Composable
import androidx.compose.runtime.LaunchedEffect
import androidx.compose.runtime.getValue
-import androidx.compose.runtime.mutableStateOf
+import androidx.compose.runtime.mutableIntStateOf
import androidx.compose.runtime.remember
import androidx.compose.runtime.setValue
import androidx.compose.ui.Alignment
@@ -57,7 +57,7 @@
@Composable
fun SwipeToDismissDemo() {
Column {
- var index by remember { mutableStateOf(0) }
+ var index by remember { mutableIntStateOf(0) }
Box(Modifier.requiredHeight(300.dp).fillMaxWidth()) {
Box(
Modifier.swipeToDismiss(index).align(Alignment.BottomCenter).requiredSize(150.dp)
@@ -82,7 +82,7 @@
private fun Modifier.swipeToDismiss(index: Int): Modifier = composed {
val animatedOffset = remember { Animatable(0f) }
- val height = remember { mutableStateOf(0) }
+ val height = remember { mutableIntStateOf(0) }
LaunchedEffect(index) {
animatedOffset.snapTo(0f)
}
diff --git a/compose/animation/animation/integration-tests/animation-demos/src/main/java/androidx/compose/animation/demos/layoutanimation/AnimatedContentWithContentKeyDemo.kt b/compose/animation/animation/integration-tests/animation-demos/src/main/java/androidx/compose/animation/demos/layoutanimation/AnimatedContentWithContentKeyDemo.kt
index b8edc12..88ec8f8 100644
--- a/compose/animation/animation/integration-tests/animation-demos/src/main/java/androidx/compose/animation/demos/layoutanimation/AnimatedContentWithContentKeyDemo.kt
+++ b/compose/animation/animation/integration-tests/animation-demos/src/main/java/androidx/compose/animation/demos/layoutanimation/AnimatedContentWithContentKeyDemo.kt
@@ -31,6 +31,7 @@
import androidx.compose.material.Text
import androidx.compose.runtime.Composable
import androidx.compose.runtime.getValue
+import androidx.compose.runtime.mutableIntStateOf
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
import androidx.compose.runtime.saveable.rememberSaveable
@@ -58,7 +59,7 @@
) {
if (it.type == MyScreen.Type.Count) {
holder.SaveableStateProvider(it.type) {
- var count by rememberSaveable { mutableStateOf(0) }
+ var count by rememberSaveable { mutableIntStateOf(0) }
Column(
Modifier.fillMaxSize(),
Arrangement.Center,
diff --git a/compose/animation/animation/integration-tests/animation-demos/src/main/java/androidx/compose/animation/demos/layoutanimation/AnimatedVisibilityDemo.kt b/compose/animation/animation/integration-tests/animation-demos/src/main/java/androidx/compose/animation/demos/layoutanimation/AnimatedVisibilityDemo.kt
index 46e8603..0f679fd 100644
--- a/compose/animation/animation/integration-tests/animation-demos/src/main/java/androidx/compose/animation/demos/layoutanimation/AnimatedVisibilityDemo.kt
+++ b/compose/animation/animation/integration-tests/animation-demos/src/main/java/androidx/compose/animation/demos/layoutanimation/AnimatedVisibilityDemo.kt
@@ -49,6 +49,7 @@
import androidx.compose.runtime.Composable
import androidx.compose.runtime.MutableState
import androidx.compose.runtime.getValue
+import androidx.compose.runtime.mutableIntStateOf
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
import androidx.compose.runtime.setValue
@@ -73,7 +74,7 @@
@Composable
fun AnimatedItems(animateContentSize: Boolean) {
- var itemNum by remember { mutableStateOf(0) }
+ var itemNum by remember { mutableIntStateOf(0) }
Column {
Row(
Modifier.fillMaxWidth().padding(20.dp),
diff --git a/compose/animation/animation/integration-tests/animation-demos/src/main/java/androidx/compose/animation/demos/lookahead/AnimateBoundsModifierDemo.kt b/compose/animation/animation/integration-tests/animation-demos/src/main/java/androidx/compose/animation/demos/lookahead/AnimateBoundsModifierDemo.kt
index 789d3f4..8e60214 100644
--- a/compose/animation/animation/integration-tests/animation-demos/src/main/java/androidx/compose/animation/demos/lookahead/AnimateBoundsModifierDemo.kt
+++ b/compose/animation/animation/integration-tests/animation-demos/src/main/java/androidx/compose/animation/demos/lookahead/AnimateBoundsModifierDemo.kt
@@ -28,7 +28,8 @@
import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.runtime.Composable
import androidx.compose.runtime.getValue
-import androidx.compose.runtime.mutableStateOf
+import androidx.compose.runtime.mutableFloatStateOf
+import androidx.compose.runtime.mutableIntStateOf
import androidx.compose.runtime.remember
import androidx.compose.runtime.setValue
import androidx.compose.ui.Alignment
@@ -43,22 +44,22 @@
@Composable
fun AnimateBoundsModifierDemo() {
var height by remember {
- mutableStateOf(200)
+ mutableIntStateOf(200)
}
var left by remember {
- mutableStateOf(0)
+ mutableIntStateOf(0)
}
var top by remember {
- mutableStateOf(0)
+ mutableIntStateOf(0)
}
var right by remember {
- mutableStateOf(0)
+ mutableIntStateOf(0)
}
var bottom by remember {
- mutableStateOf(0)
+ mutableIntStateOf(0)
}
var weight by remember {
- mutableStateOf(2f)
+ mutableFloatStateOf(2f)
}
LookaheadScope {
diff --git a/compose/animation/animation/integration-tests/animation-demos/src/main/java/androidx/compose/animation/demos/lookahead/CraneDemo.kt b/compose/animation/animation/integration-tests/animation-demos/src/main/java/androidx/compose/animation/demos/lookahead/CraneDemo.kt
index 4754294..dba31d2 100644
--- a/compose/animation/animation/integration-tests/animation-demos/src/main/java/androidx/compose/animation/demos/lookahead/CraneDemo.kt
+++ b/compose/animation/animation/integration-tests/animation-demos/src/main/java/androidx/compose/animation/demos/lookahead/CraneDemo.kt
@@ -39,6 +39,7 @@
import androidx.compose.runtime.Composable
import androidx.compose.runtime.getValue
import androidx.compose.runtime.movableContentWithReceiverOf
+import androidx.compose.runtime.mutableFloatStateOf
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.produceState
import androidx.compose.runtime.remember
@@ -172,7 +173,7 @@
class ProgressProviderImpl<T>(initialState: T) : ProgressProvider<T> {
override var initialState: T by mutableStateOf(initialState)
override var targetState: T by mutableStateOf(initialState)
- override var progress: Float by mutableStateOf(0f)
+ override var progress: Float by mutableFloatStateOf(0f)
}
interface ProgressProvider<T> {
diff --git a/compose/animation/animation/integration-tests/animation-demos/src/main/java/androidx/compose/animation/demos/lookahead/LookaheadWithScaffold.kt b/compose/animation/animation/integration-tests/animation-demos/src/main/java/androidx/compose/animation/demos/lookahead/LookaheadWithScaffold.kt
index 4a0fad9..36d5ffd 100644
--- a/compose/animation/animation/integration-tests/animation-demos/src/main/java/androidx/compose/animation/demos/lookahead/LookaheadWithScaffold.kt
+++ b/compose/animation/animation/integration-tests/animation-demos/src/main/java/androidx/compose/animation/demos/lookahead/LookaheadWithScaffold.kt
@@ -59,7 +59,7 @@
import androidx.compose.runtime.Composable
import androidx.compose.runtime.LaunchedEffect
import androidx.compose.runtime.getValue
-import androidx.compose.runtime.mutableStateOf
+import androidx.compose.runtime.mutableIntStateOf
import androidx.compose.runtime.produceState
import androidx.compose.runtime.remember
import androidx.compose.runtime.rememberCoroutineScope
@@ -98,7 +98,7 @@
if (hasPadding) Modifier.padding(bottom = 300.dp) else Modifier
)
) {
- var state by remember { mutableStateOf(0) }
+ var state by remember { mutableIntStateOf(0) }
val titles = listOf(
"SimpleScaffold", "W/Cutout", "SimpleSnackbar", "CustomSnackbar", "Backdrop"
)
@@ -256,7 +256,7 @@
Scaffold(
scaffoldState = scaffoldState,
floatingActionButton = {
- var clickCount by remember { mutableStateOf(0) }
+ var clickCount by remember { mutableIntStateOf(0) }
ExtendedFloatingActionButton(
text = { Text("Show snackbar") },
onClick = {
@@ -296,7 +296,7 @@
}
},
floatingActionButton = {
- var clickCount by remember { mutableStateOf(0) }
+ var clickCount by remember { mutableIntStateOf(0) }
ExtendedFloatingActionButton(
text = { Text("Show snackbar") },
onClick = {
@@ -323,7 +323,7 @@
@OptIn(ExperimentalMaterialApi::class)
fun BackdropScaffoldSample() {
val scope = rememberCoroutineScope()
- val selection = remember { mutableStateOf(1) }
+ var selection by remember { mutableIntStateOf(1) }
val scaffoldState = rememberBackdropScaffoldState(BackdropValue.Concealed)
LaunchedEffect(scaffoldState) {
scaffoldState.reveal()
@@ -345,7 +345,7 @@
}
},
actions = {
- var clickCount by remember { mutableStateOf(0) }
+ var clickCount by remember { mutableIntStateOf(0) }
IconButton(
onClick = {
// show snackbar as a suspend function
@@ -364,10 +364,10 @@
},
backLayerContent = {
LazyColumn {
- items(if (selection.value >= 3) 3 else 5) {
+ items(if (selection >= 3) 3 else 5) {
ListItem(
Modifier.clickable {
- selection.value = it
+ selection = it
scope.launch { scaffoldState.conceal() }
},
text = { Text("Select $it") }
@@ -376,7 +376,7 @@
}
},
frontLayerContent = {
- Text("Selection: ${selection.value}")
+ Text("Selection: $selection")
LazyColumn {
items(50) {
ListItem(
diff --git a/compose/animation/animation/integration-tests/animation-demos/src/main/java/androidx/compose/animation/demos/lookahead/LookaheadWithTabRowDemo.kt b/compose/animation/animation/integration-tests/animation-demos/src/main/java/androidx/compose/animation/demos/lookahead/LookaheadWithTabRowDemo.kt
index 6ec1f2b..b49e42f 100644
--- a/compose/animation/animation/integration-tests/animation-demos/src/main/java/androidx/compose/animation/demos/lookahead/LookaheadWithTabRowDemo.kt
+++ b/compose/animation/animation/integration-tests/animation-demos/src/main/java/androidx/compose/animation/demos/lookahead/LookaheadWithTabRowDemo.kt
@@ -38,7 +38,7 @@
import androidx.compose.material.Text
import androidx.compose.runtime.Composable
import androidx.compose.runtime.getValue
-import androidx.compose.runtime.mutableStateOf
+import androidx.compose.runtime.mutableIntStateOf
import androidx.compose.runtime.produceState
import androidx.compose.runtime.remember
import androidx.compose.runtime.setValue
@@ -79,7 +79,7 @@
@Composable
fun FancyTabs() {
- var state by remember { mutableStateOf(0) }
+ var state by remember { mutableIntStateOf(0) }
val titles = listOf("TAB 1", "TAB 2", "TAB 3")
Column {
TabRow(
@@ -124,7 +124,7 @@
@OptIn(ExperimentalComposeUiApi::class)
@Composable
fun ScrollingTextTabs() {
- var state by remember { mutableStateOf(0) }
+ var state by remember { mutableIntStateOf(0) }
val titles = listOf(
"Tab 1",
"Tab 2",
@@ -159,7 +159,7 @@
@Composable
fun ScrollingFancyIndicatorContainerTabs() {
- var state by remember { mutableStateOf(0) }
+ var state by remember { mutableIntStateOf(0) }
val titles = listOf(
"Tab 1",
"Tab 2",
diff --git a/compose/animation/animation/integration-tests/animation-demos/src/main/java/androidx/compose/animation/demos/statetransition/CrossfadeDemo.kt b/compose/animation/animation/integration-tests/animation-demos/src/main/java/androidx/compose/animation/demos/statetransition/CrossfadeDemo.kt
index 1cf5b4a..2f77328 100644
--- a/compose/animation/animation/integration-tests/animation-demos/src/main/java/androidx/compose/animation/demos/statetransition/CrossfadeDemo.kt
+++ b/compose/animation/animation/integration-tests/animation-demos/src/main/java/androidx/compose/animation/demos/statetransition/CrossfadeDemo.kt
@@ -27,7 +27,7 @@
import androidx.compose.foundation.layout.height
import androidx.compose.runtime.Composable
import androidx.compose.runtime.getValue
-import androidx.compose.runtime.mutableStateOf
+import androidx.compose.runtime.mutableIntStateOf
import androidx.compose.runtime.saveable.rememberSaveable
import androidx.compose.runtime.saveable.rememberSaveableStateHolder
import androidx.compose.runtime.setValue
@@ -41,7 +41,7 @@
@Preview
@Composable
fun CrossfadeDemo() {
- var current by rememberSaveable { mutableStateOf(0) }
+ var current by rememberSaveable { mutableIntStateOf(0) }
Column {
Row {
tabs.forEachIndexed { index, tab ->
diff --git a/compose/animation/animation/integration-tests/animation-demos/src/main/java/androidx/compose/animation/demos/statetransition/MultiDimensionalAnimationDemo.kt b/compose/animation/animation/integration-tests/animation-demos/src/main/java/androidx/compose/animation/demos/statetransition/MultiDimensionalAnimationDemo.kt
index c3b4274..a32e677 100644
--- a/compose/animation/animation/integration-tests/animation-demos/src/main/java/androidx/compose/animation/demos/statetransition/MultiDimensionalAnimationDemo.kt
+++ b/compose/animation/animation/integration-tests/animation-demos/src/main/java/androidx/compose/animation/demos/statetransition/MultiDimensionalAnimationDemo.kt
@@ -27,6 +27,7 @@
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.runtime.Composable
import androidx.compose.runtime.getValue
+import androidx.compose.runtime.mutableFloatStateOf
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
import androidx.compose.runtime.setValue
@@ -50,8 +51,8 @@
}
}
- var width by remember { mutableStateOf(0f) }
- var height by remember { mutableStateOf(0f) }
+ var width by remember { mutableFloatStateOf(0f) }
+ var height by remember { mutableFloatStateOf(0f) }
val transition = updateTransition(currentState)
val rect by transition.animateRect(transitionSpec = { spring(stiffness = 100f) }) {
when (it) {
diff --git a/compose/animation/animation/integration-tests/animation-demos/src/main/java/androidx/compose/animation/demos/suspendfun/InfiniteAnimationDemo.kt b/compose/animation/animation/integration-tests/animation-demos/src/main/java/androidx/compose/animation/demos/suspendfun/InfiniteAnimationDemo.kt
index 9910030..b8e5bad 100644
--- a/compose/animation/animation/integration-tests/animation-demos/src/main/java/androidx/compose/animation/demos/suspendfun/InfiniteAnimationDemo.kt
+++ b/compose/animation/animation/integration-tests/animation-demos/src/main/java/androidx/compose/animation/demos/suspendfun/InfiniteAnimationDemo.kt
@@ -27,8 +27,10 @@
import androidx.compose.material.icons.filled.Favorite
import androidx.compose.runtime.Composable
import androidx.compose.runtime.LaunchedEffect
-import androidx.compose.runtime.mutableStateOf
+import androidx.compose.runtime.getValue
+import androidx.compose.runtime.mutableFloatStateOf
import androidx.compose.runtime.remember
+import androidx.compose.runtime.setValue
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
@@ -38,7 +40,7 @@
@Preview
@Composable
fun InfiniteAnimationDemo() {
- val alpha = remember { mutableStateOf(1f) }
+ var alpha by remember { mutableFloatStateOf(1f) }
LaunchedEffect(Unit) {
animate(
initialValue = 1f,
@@ -48,7 +50,7 @@
repeatMode = RepeatMode.Reverse
)
) { value, _ ->
- alpha.value = value
+ alpha = value
}
}
Box(Modifier.fillMaxSize()) {
@@ -59,7 +61,7 @@
.graphicsLayer(
scaleX = 3.0f,
scaleY = 3.0f,
- alpha = alpha.value
+ alpha = alpha
),
tint = Color.Red
)
diff --git a/compose/animation/animation/integration-tests/animation-demos/src/main/java/androidx/compose/animation/demos/suspendfun/SuspendDoubleTapToLikeDemo.kt b/compose/animation/animation/integration-tests/animation-demos/src/main/java/androidx/compose/animation/demos/suspendfun/SuspendDoubleTapToLikeDemo.kt
index 600de97..b3691cc 100644
--- a/compose/animation/animation/integration-tests/animation-demos/src/main/java/androidx/compose/animation/demos/suspendfun/SuspendDoubleTapToLikeDemo.kt
+++ b/compose/animation/animation/integration-tests/animation-demos/src/main/java/androidx/compose/animation/demos/suspendfun/SuspendDoubleTapToLikeDemo.kt
@@ -27,7 +27,7 @@
import androidx.compose.material.icons.filled.Favorite
import androidx.compose.runtime.Composable
import androidx.compose.runtime.getValue
-import androidx.compose.runtime.mutableStateOf
+import androidx.compose.runtime.mutableFloatStateOf
import androidx.compose.runtime.remember
import androidx.compose.runtime.rememberCoroutineScope
import androidx.compose.runtime.setValue
@@ -43,8 +43,8 @@
@Preview
@Composable
fun SuspendDoubleTapToLikeDemo() {
- var alpha by remember { mutableStateOf(0f) }
- var scale by remember { mutableStateOf(0f) }
+ var alpha by remember { mutableFloatStateOf(0f) }
+ var scale by remember { mutableFloatStateOf(0f) }
val mutatorMutex = MutatorMutex()
val scope = rememberCoroutineScope()
diff --git a/compose/animation/animation/integration-tests/animation-demos/src/main/java/androidx/compose/animation/demos/visualinspection/AnimatedContentWithInterruptions.kt b/compose/animation/animation/integration-tests/animation-demos/src/main/java/androidx/compose/animation/demos/visualinspection/AnimatedContentWithInterruptions.kt
index 4e58285..48187047 100644
--- a/compose/animation/animation/integration-tests/animation-demos/src/main/java/androidx/compose/animation/demos/visualinspection/AnimatedContentWithInterruptions.kt
+++ b/compose/animation/animation/integration-tests/animation-demos/src/main/java/androidx/compose/animation/demos/visualinspection/AnimatedContentWithInterruptions.kt
@@ -35,7 +35,7 @@
import androidx.compose.runtime.Composable
import androidx.compose.runtime.LaunchedEffect
import androidx.compose.runtime.getValue
-import androidx.compose.runtime.mutableStateOf
+import androidx.compose.runtime.mutableIntStateOf
import androidx.compose.runtime.remember
import androidx.compose.runtime.setValue
import androidx.compose.ui.Modifier
@@ -47,7 +47,7 @@
@OptIn(ExperimentalAnimationApi::class)
@Composable
fun AnimatedContentWithInterruptions() {
- var count by remember { mutableStateOf(0) }
+ var count by remember { mutableIntStateOf(0) }
AnimatedContent(targetState = count, transitionSpec = {
if (targetState == 0) {
(slideInVertically { it } togetherWith fadeOut(targetAlpha = 0.88f))
diff --git a/compose/animation/animation/integration-tests/animation-demos/src/main/java/androidx/compose/animation/demos/visualinspection/SeekingDebugging.kt b/compose/animation/animation/integration-tests/animation-demos/src/main/java/androidx/compose/animation/demos/visualinspection/SeekingDebugging.kt
index 6b38572..21756cd 100644
--- a/compose/animation/animation/integration-tests/animation-demos/src/main/java/androidx/compose/animation/demos/visualinspection/SeekingDebugging.kt
+++ b/compose/animation/animation/integration-tests/animation-demos/src/main/java/androidx/compose/animation/demos/visualinspection/SeekingDebugging.kt
@@ -49,6 +49,7 @@
import androidx.compose.runtime.Composable
import androidx.compose.runtime.LaunchedEffect
import androidx.compose.runtime.getValue
+import androidx.compose.runtime.mutableFloatStateOf
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
import androidx.compose.runtime.setValue
@@ -69,7 +70,7 @@
val transition = updateTransition(true)
var entering by remember { mutableStateOf(true) }
- var progress by remember { mutableStateOf(0f) }
+ var progress by remember { mutableFloatStateOf(0f) }
Column(
Modifier.fillMaxSize().padding(10.dp),
verticalArrangement = Arrangement.spacedBy(20.dp)
diff --git a/compose/animation/animation/samples/src/main/AndroidManifest.xml b/compose/animation/animation/samples/src/main/AndroidManifest.xml
deleted file mode 100644
index dc2f180..0000000
--- a/compose/animation/animation/samples/src/main/AndroidManifest.xml
+++ /dev/null
@@ -1,17 +0,0 @@
-<!--
- ~ Copyright (C) 2019 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
- -->
-
-<manifest />
diff --git a/compose/animation/animation/src/androidAndroidTest/AndroidManifest.xml b/compose/animation/animation/src/androidAndroidTest/AndroidManifest.xml
deleted file mode 100644
index 9cd4123..0000000
--- a/compose/animation/animation/src/androidAndroidTest/AndroidManifest.xml
+++ /dev/null
@@ -1,17 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
- 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.
- -->
-<manifest />
diff --git a/compose/animation/animation/src/androidMain/AndroidManifest.xml b/compose/animation/animation/src/androidMain/AndroidManifest.xml
deleted file mode 100644
index 34d825b..0000000
--- a/compose/animation/animation/src/androidMain/AndroidManifest.xml
+++ /dev/null
@@ -1,17 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
- ~ Copyright 2019 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.
- -->
-<manifest />
diff --git a/compose/animation/animation/src/commonMain/kotlin/androidx/compose/animation/AnimatedContent.kt b/compose/animation/animation/src/commonMain/kotlin/androidx/compose/animation/AnimatedContent.kt
index 06a90b9..d1ac4ac 100644
--- a/compose/animation/animation/src/commonMain/kotlin/androidx/compose/animation/AnimatedContent.kt
+++ b/compose/animation/animation/src/commonMain/kotlin/androidx/compose/animation/AnimatedContent.kt
@@ -41,6 +41,7 @@
import androidx.compose.runtime.State
import androidx.compose.runtime.getValue
import androidx.compose.runtime.key
+import androidx.compose.runtime.mutableFloatStateOf
import androidx.compose.runtime.mutableStateListOf
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
@@ -196,7 +197,7 @@
* to 0f. Content with higher zIndex will be drawn over lower `zIndex`ed content. Among
* content with the same index, the target content will be placed on top.
*/
- var targetContentZIndex by mutableStateOf(targetContentZIndex)
+ var targetContentZIndex by mutableFloatStateOf(targetContentZIndex)
/**
* [sizeTransform] manages the expanding and shrinking of the container if there is any size
diff --git a/compose/animation/animation/src/commonMain/kotlin/androidx/compose/animation/EnterExitTransition.kt b/compose/animation/animation/src/commonMain/kotlin/androidx/compose/animation/EnterExitTransition.kt
index 93c840e..6c7d2fa 100644
--- a/compose/animation/animation/src/commonMain/kotlin/androidx/compose/animation/EnterExitTransition.kt
+++ b/compose/animation/animation/src/commonMain/kotlin/androidx/compose/animation/EnterExitTransition.kt
@@ -36,6 +36,7 @@
import androidx.compose.runtime.State
import androidx.compose.runtime.getValue
import androidx.compose.runtime.key
+import androidx.compose.runtime.mutableFloatStateOf
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
import androidx.compose.runtime.rememberUpdatedState
@@ -938,7 +939,7 @@
convertFromVector = { TransformOrigin(it.v1, it.v2) }
)
-private val DefaultAlpha = mutableStateOf(1f)
+private val DefaultAlpha = mutableFloatStateOf(1f)
private val DefaultAlphaAndScaleSpring = spring<Float>(stiffness = Spring.StiffnessMediumLow)
private fun Modifier.slideInOut(
diff --git a/compose/benchmark-utils/src/androidTest/AndroidManifest.xml b/compose/benchmark-utils/src/androidTest/AndroidManifest.xml
deleted file mode 100644
index e865f27..0000000
--- a/compose/benchmark-utils/src/androidTest/AndroidManifest.xml
+++ /dev/null
@@ -1,17 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
- ~ Copyright 2021 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.
- -->
-<manifest />
diff --git a/compose/compiler/compiler-hosted/integration-tests/src/test/java/androidx/compose/compiler/plugins/kotlin/ComposerParamTransformTests.kt b/compose/compiler/compiler-hosted/integration-tests/src/test/java/androidx/compose/compiler/plugins/kotlin/ComposerParamTransformTests.kt
index e3ca786..611c856 100644
--- a/compose/compiler/compiler-hosted/integration-tests/src/test/java/androidx/compose/compiler/plugins/kotlin/ComposerParamTransformTests.kt
+++ b/compose/compiler/compiler-hosted/integration-tests/src/test/java/androidx/compose/compiler/plugins/kotlin/ComposerParamTransformTests.kt
@@ -697,6 +697,7 @@
}
class Bar {
+ @get:Composable
val foo by Foo()
}
diff --git a/compose/compiler/compiler-hosted/integration-tests/src/test/java/androidx/compose/compiler/plugins/kotlin/analysis/ComposableCheckerTests.kt b/compose/compiler/compiler-hosted/integration-tests/src/test/java/androidx/compose/compiler/plugins/kotlin/analysis/ComposableCheckerTests.kt
index 9211731..b198df57 100644
--- a/compose/compiler/compiler-hosted/integration-tests/src/test/java/androidx/compose/compiler/plugins/kotlin/analysis/ComposableCheckerTests.kt
+++ b/compose/compiler/compiler-hosted/integration-tests/src/test/java/androidx/compose/compiler/plugins/kotlin/analysis/ComposableCheckerTests.kt
@@ -1363,7 +1363,10 @@
}
class Bar {
- val foo by Foo()
+ val <!COMPOSABLE_EXPECTED!>foo<!> by Foo()
+
+ @get:Composable
+ val foo2 by Foo()
}
"""
)
diff --git a/compose/compiler/compiler-hosted/src/main/java/androidx/compose/compiler/plugins/kotlin/ComposableCallChecker.kt b/compose/compiler/compiler-hosted/src/main/java/androidx/compose/compiler/plugins/kotlin/ComposableCallChecker.kt
index 848bf03..25c7023 100644
--- a/compose/compiler/compiler-hosted/src/main/java/androidx/compose/compiler/plugins/kotlin/ComposableCallChecker.kt
+++ b/compose/compiler/compiler-hosted/src/main/java/androidx/compose/compiler/plugins/kotlin/ComposableCallChecker.kt
@@ -1,5 +1,5 @@
/*
- * Copyright 2020 The Android Open Source Project
+ * Copyright 2023 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.
@@ -50,8 +50,6 @@
import org.jetbrains.kotlin.psi.KtTryExpression
import org.jetbrains.kotlin.resolve.BindingContext
import org.jetbrains.kotlin.resolve.BindingContext.DELEGATED_PROPERTY_RESOLVED_CALL
-import org.jetbrains.kotlin.resolve.calls.util.getResolvedCall
-import org.jetbrains.kotlin.resolve.calls.util.getValueArgumentForExpression
import org.jetbrains.kotlin.resolve.calls.checkers.AdditionalTypeChecker
import org.jetbrains.kotlin.resolve.calls.checkers.CallChecker
import org.jetbrains.kotlin.resolve.calls.checkers.CallCheckerContext
@@ -60,6 +58,8 @@
import org.jetbrains.kotlin.resolve.calls.model.ArgumentMatch
import org.jetbrains.kotlin.resolve.calls.model.ResolvedCall
import org.jetbrains.kotlin.resolve.calls.model.VariableAsFunctionResolvedCall
+import org.jetbrains.kotlin.resolve.calls.util.getResolvedCall
+import org.jetbrains.kotlin.resolve.calls.util.getValueArgumentForExpression
import org.jetbrains.kotlin.resolve.inline.InlineUtil.isInlinedArgument
import org.jetbrains.kotlin.resolve.sam.getSingleAbstractMethodOrNull
import org.jetbrains.kotlin.types.KotlinType
@@ -243,6 +243,10 @@
// setValue delegate is not allowed for now.
illegalComposableDelegate(context, reportOn)
}
+ if (descriptor is PropertyDescriptor &&
+ descriptor.getter?.hasComposableAnnotation() != true) {
+ composableExpected(context, node.nameIdentifier ?: node)
+ }
return
}
}
@@ -318,10 +322,17 @@
) {
context.trace.report(ComposeErrors.COMPOSABLE_INVOCATION.on(callEl))
if (functionEl != null) {
- context.trace.report(ComposeErrors.COMPOSABLE_EXPECTED.on(functionEl))
+ composableExpected(context, functionEl)
}
}
+ private fun composableExpected(
+ context: CallCheckerContext,
+ functionEl: PsiElement
+ ) {
+ context.trace.report(ComposeErrors.COMPOSABLE_EXPECTED.on(functionEl))
+ }
+
private fun illegalCallMustBeReadonly(
context: CallCheckerContext,
callEl: PsiElement
diff --git a/compose/compiler/compiler-hosted/src/main/java/androidx/compose/compiler/plugins/kotlin/lower/ComposerParamTransformer.kt b/compose/compiler/compiler-hosted/src/main/java/androidx/compose/compiler/plugins/kotlin/lower/ComposerParamTransformer.kt
index 7bb80ae..fd4a4db 100644
--- a/compose/compiler/compiler-hosted/src/main/java/androidx/compose/compiler/plugins/kotlin/lower/ComposerParamTransformer.kt
+++ b/compose/compiler/compiler-hosted/src/main/java/androidx/compose/compiler/plugins/kotlin/lower/ComposerParamTransformer.kt
@@ -34,7 +34,6 @@
import org.jetbrains.kotlin.ir.declarations.IrFunction
import org.jetbrains.kotlin.ir.declarations.IrLocalDelegatedProperty
import org.jetbrains.kotlin.ir.declarations.IrModuleFragment
-import org.jetbrains.kotlin.ir.declarations.IrProperty
import org.jetbrains.kotlin.ir.declarations.IrSimpleFunction
import org.jetbrains.kotlin.ir.declarations.IrValueParameter
import org.jetbrains.kotlin.ir.declarations.copyAttributes
@@ -174,18 +173,6 @@
return super.visitLocalDelegatedProperty(declaration)
}
- override fun visitProperty(declaration: IrProperty): IrStatement {
- if (declaration.getter?.isComposableDelegatedAccessor() == true) {
- declaration.getter!!.annotations += createComposableAnnotation()
- }
-
- if (declaration.setter?.isComposableDelegatedAccessor() == true) {
- declaration.setter!!.annotations += createComposableAnnotation()
- }
-
- return super.visitProperty(declaration)
- }
-
private fun createComposableAnnotation() =
IrConstructorCallImpl(
startOffset = SYNTHETIC_OFFSET,
diff --git a/compose/foundation/foundation-layout/integration-tests/layout-demos/src/main/AndroidManifest.xml b/compose/foundation/foundation-layout/integration-tests/layout-demos/src/main/AndroidManifest.xml
deleted file mode 100644
index d04f9bb..0000000
--- a/compose/foundation/foundation-layout/integration-tests/layout-demos/src/main/AndroidManifest.xml
+++ /dev/null
@@ -1,17 +0,0 @@
-<!--
- ~ Copyright (C) 2016 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
- -->
-
-<manifest />
\ No newline at end of file
diff --git a/compose/foundation/foundation-layout/samples/src/main/AndroidManifest.xml b/compose/foundation/foundation-layout/samples/src/main/AndroidManifest.xml
deleted file mode 100644
index b962196..0000000
--- a/compose/foundation/foundation-layout/samples/src/main/AndroidManifest.xml
+++ /dev/null
@@ -1,17 +0,0 @@
-<!--
- Copyright 2019 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.
- -->
-
-<manifest />
\ No newline at end of file
diff --git a/compose/foundation/foundation-layout/src/androidAndroidTest/kotlin/androidx/compose/foundation/layout/WindowInsetsAnimationTest.kt b/compose/foundation/foundation-layout/src/androidAndroidTest/kotlin/androidx/compose/foundation/layout/WindowInsetsAnimationTest.kt
index fab47f7..9cabe4e 100644
--- a/compose/foundation/foundation-layout/src/androidAndroidTest/kotlin/androidx/compose/foundation/layout/WindowInsetsAnimationTest.kt
+++ b/compose/foundation/foundation-layout/src/androidAndroidTest/kotlin/androidx/compose/foundation/layout/WindowInsetsAnimationTest.kt
@@ -31,6 +31,7 @@
import java.util.concurrent.TimeUnit
import org.junit.After
import org.junit.Before
+import org.junit.Ignore
import org.junit.Rule
import org.junit.Test
@@ -57,6 +58,7 @@
@SdkSuppress(minSdkVersion = 22) // b/266742122
@OptIn(ExperimentalLayoutApi::class)
@Test
+ @Ignore("b/266742122")
fun imeAnimationWhenShowingIme() {
val imeAnimationSourceValues = mutableListOf<Int>()
val imeAnimationTargetValues = mutableListOf<Int>()
diff --git a/compose/foundation/foundation-layout/src/androidMain/AndroidManifest.xml b/compose/foundation/foundation-layout/src/androidMain/AndroidManifest.xml
deleted file mode 100644
index b47339d..0000000
--- a/compose/foundation/foundation-layout/src/androidMain/AndroidManifest.xml
+++ /dev/null
@@ -1,16 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2019 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.
--->
-<manifest />
diff --git a/compose/foundation/foundation/api/public_plus_experimental_current.txt b/compose/foundation/foundation/api/public_plus_experimental_current.txt
index c37d48d..260f499 100644
--- a/compose/foundation/foundation/api/public_plus_experimental_current.txt
+++ b/compose/foundation/foundation/api/public_plus_experimental_current.txt
@@ -777,6 +777,7 @@
method public abstract androidx.compose.foundation.lazy.layout.IntervalList<Interval> getIntervals();
method public final int getItemCount();
method public final Object getKey(int index);
+ method public final inline <T> T withInterval(int globalIndex, kotlin.jvm.functions.Function2<? super java.lang.Integer,? super Interval,? extends T> block);
property public abstract androidx.compose.foundation.lazy.layout.IntervalList<Interval> intervals;
property public final int itemCount;
}
@@ -788,12 +789,8 @@
property public default kotlin.jvm.functions.Function1<java.lang.Integer,java.lang.Object> type;
}
- public final class LazyLayoutIntervalContentKt {
- method @androidx.compose.foundation.ExperimentalFoundationApi @androidx.compose.runtime.Composable public static <T extends androidx.compose.foundation.lazy.layout.LazyLayoutIntervalContent.Interval> void PinnableItem(androidx.compose.foundation.lazy.layout.LazyLayoutIntervalContent<T>, int index, androidx.compose.foundation.lazy.layout.LazyLayoutPinnedItemList pinnedItemList, kotlin.jvm.functions.Function2<? super T,? super java.lang.Integer,kotlin.Unit> content);
- }
-
@androidx.compose.foundation.ExperimentalFoundationApi @androidx.compose.runtime.Stable public interface LazyLayoutItemProvider {
- method @androidx.compose.runtime.Composable public void Item(int index);
+ method @androidx.compose.runtime.Composable public void Item(int index, Object key);
method public default Object? getContentType(int index);
method public default int getIndex(Object key);
method public int getItemCount();
diff --git a/compose/foundation/foundation/integration-tests/foundation-demos/src/main/AndroidManifest.xml b/compose/foundation/foundation/integration-tests/foundation-demos/src/main/AndroidManifest.xml
deleted file mode 100644
index 6a69672..0000000
--- a/compose/foundation/foundation/integration-tests/foundation-demos/src/main/AndroidManifest.xml
+++ /dev/null
@@ -1,17 +0,0 @@
-<!--
- Copyright 2019 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.
- -->
-
-<manifest />
diff --git a/compose/foundation/foundation/integration-tests/foundation-demos/src/main/java/androidx/compose/foundation/demos/LazyColumnDragAndDropDemo.kt b/compose/foundation/foundation/integration-tests/foundation-demos/src/main/java/androidx/compose/foundation/demos/LazyColumnDragAndDropDemo.kt
index 5993f24..303631a 100644
--- a/compose/foundation/foundation/integration-tests/foundation-demos/src/main/java/androidx/compose/foundation/demos/LazyColumnDragAndDropDemo.kt
+++ b/compose/foundation/foundation/integration-tests/foundation-demos/src/main/java/androidx/compose/foundation/demos/LazyColumnDragAndDropDemo.kt
@@ -40,6 +40,8 @@
import androidx.compose.runtime.Composable
import androidx.compose.runtime.LaunchedEffect
import androidx.compose.runtime.getValue
+import androidx.compose.runtime.mutableFloatStateOf
+import androidx.compose.runtime.mutableIntStateOf
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
import androidx.compose.runtime.rememberCoroutineScope
@@ -117,8 +119,8 @@
internal val scrollChannel = Channel<Float>()
- private var draggingItemDraggedDelta by mutableStateOf(0f)
- private var draggingItemInitialOffset by mutableStateOf(0)
+ private var draggingItemDraggedDelta by mutableFloatStateOf(0f)
+ private var draggingItemInitialOffset by mutableIntStateOf(0)
internal val draggingItemOffset: Float
get() = draggingItemLayoutInfo?.let { item ->
draggingItemInitialOffset + draggingItemDraggedDelta - item.offset
diff --git a/compose/foundation/foundation/integration-tests/foundation-demos/src/main/java/androidx/compose/foundation/demos/ListDemos.kt b/compose/foundation/foundation/integration-tests/foundation-demos/src/main/java/androidx/compose/foundation/demos/ListDemos.kt
index c7d9378..4634941 100644
--- a/compose/foundation/foundation/integration-tests/foundation-demos/src/main/java/androidx/compose/foundation/demos/ListDemos.kt
+++ b/compose/foundation/foundation/integration-tests/foundation-demos/src/main/java/androidx/compose/foundation/demos/ListDemos.kt
@@ -80,6 +80,7 @@
import androidx.compose.runtime.Composable
import androidx.compose.runtime.CompositionLocalProvider
import androidx.compose.runtime.getValue
+import androidx.compose.runtime.mutableIntStateOf
import androidx.compose.runtime.mutableStateListOf
import androidx.compose.runtime.mutableStateMapOf
import androidx.compose.runtime.mutableStateOf
@@ -158,8 +159,8 @@
@Preview
@Composable
private fun ListAddRemoveItemsDemo() {
- var numItems by remember { mutableStateOf(0) }
- var offset by remember { mutableStateOf(0) }
+ var numItems by remember { mutableIntStateOf(0) }
+ var offset by remember { mutableIntStateOf(0) }
Column {
Row {
val buttonModifier = Modifier.padding(8.dp)
@@ -406,8 +407,8 @@
@Composable
private fun LazyListArrangements() {
- var count by remember { mutableStateOf(3) }
- var arrangement by remember { mutableStateOf(6) }
+ var count by remember { mutableIntStateOf(3) }
+ var arrangement by remember { mutableIntStateOf(6) }
Column {
Row {
Button(onClick = { count-- }) {
@@ -480,7 +481,7 @@
Column {
val scrollState = rememberScrollState()
val lazyState = rememberLazyListState()
- var count by remember { mutableStateOf(10) }
+ var count by remember { mutableIntStateOf(10) }
var reverse by remember { mutableStateOf(false) }
var rtl by remember { mutableStateOf(false) }
var column by remember { mutableStateOf(true) }
@@ -634,7 +635,7 @@
.background(Color.LightGray),
contentAlignment = Alignment.Center
) {
- var state by rememberSaveable { mutableStateOf(0) }
+ var state by rememberSaveable { mutableIntStateOf(0) }
Button(onClick = { state++ }) {
Text("Index=$index State=$state")
}
@@ -660,7 +661,7 @@
GridCells.Fixed(3),
GridCells.Adaptive(minSize = 60.dp)
)
- var currentMode by remember { mutableStateOf(0) }
+ var currentMode by remember { mutableIntStateOf(0) }
Column {
Button(
modifier = Modifier.wrapContentSize(),
@@ -709,10 +710,10 @@
}
}
)
- var currentMode by remember { mutableStateOf(0) }
- var horizontalSpacing by remember { mutableStateOf(8) }
+ var currentMode by remember { mutableIntStateOf(0) }
+ var horizontalSpacing by remember { mutableIntStateOf(8) }
var horizontalSpacingExpanded by remember { mutableStateOf(false) }
- var verticalSpacing by remember { mutableStateOf(8) }
+ var verticalSpacing by remember { mutableIntStateOf(8) }
var verticalSpacingExpanded by remember { mutableStateOf(false) }
Column {
Row {
@@ -860,7 +861,7 @@
}
LazyColumn {
item {
- var counter by rememberSaveable { mutableStateOf(0) }
+ var counter by rememberSaveable { mutableIntStateOf(0) }
Button(onClick = { counter++ }) {
Text("Header has $counter")
}
@@ -869,7 +870,7 @@
items = names,
key = { it }
) {
- var counter by rememberSaveable { mutableStateOf(0) }
+ var counter by rememberSaveable { mutableIntStateOf(0) }
Button(onClick = { counter++ }, modifier = Modifier.animateItemPlacement()) {
Text("$it has $counter")
}
@@ -962,7 +963,7 @@
mutableStateOf(List(100) { it })
}
- var count by remember { mutableStateOf(10) }
+ var count by remember { mutableIntStateOf(10) }
var reverseLayout by remember { mutableStateOf(false) }
var rtl by remember { mutableStateOf(false) }
diff --git a/compose/foundation/foundation/integration-tests/foundation-demos/src/main/java/androidx/compose/foundation/demos/ScrollableFocusedChildDemo.kt b/compose/foundation/foundation/integration-tests/foundation-demos/src/main/java/androidx/compose/foundation/demos/ScrollableFocusedChildDemo.kt
index 8ba6e1e..92d0c13 100644
--- a/compose/foundation/foundation/integration-tests/foundation-demos/src/main/java/androidx/compose/foundation/demos/ScrollableFocusedChildDemo.kt
+++ b/compose/foundation/foundation/integration-tests/foundation-demos/src/main/java/androidx/compose/foundation/demos/ScrollableFocusedChildDemo.kt
@@ -41,6 +41,7 @@
import androidx.compose.material.Text
import androidx.compose.runtime.Composable
import androidx.compose.runtime.getValue
+import androidx.compose.runtime.mutableIntStateOf
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
import androidx.compose.runtime.setValue
@@ -153,8 +154,8 @@
}
private class ResizableState {
- var widthOverride by mutableStateOf(-1)
- var heightOverride by mutableStateOf(-1)
+ var widthOverride by mutableIntStateOf(-1)
+ var heightOverride by mutableIntStateOf(-1)
fun resetToMaxSize() {
widthOverride = -1
diff --git a/compose/foundation/foundation/integration-tests/foundation-demos/src/main/java/androidx/compose/foundation/demos/SuspendingGesturesDemo.kt b/compose/foundation/foundation/integration-tests/foundation-demos/src/main/java/androidx/compose/foundation/demos/SuspendingGesturesDemo.kt
index 183a7d9..6bae60a 100644
--- a/compose/foundation/foundation/integration-tests/foundation-demos/src/main/java/androidx/compose/foundation/demos/SuspendingGesturesDemo.kt
+++ b/compose/foundation/foundation/integration-tests/foundation-demos/src/main/java/androidx/compose/foundation/demos/SuspendingGesturesDemo.kt
@@ -43,6 +43,7 @@
import androidx.compose.material.Text
import androidx.compose.runtime.Composable
import androidx.compose.runtime.getValue
+import androidx.compose.runtime.mutableFloatStateOf
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
import androidx.compose.runtime.setValue
@@ -109,12 +110,12 @@
*/
@Composable
fun CoroutineTapDemo() {
- var tapHue by remember { mutableStateOf(randomHue()) }
- var longPressHue by remember { mutableStateOf(randomHue()) }
- var doubleTapHue by remember { mutableStateOf(randomHue()) }
- var pressHue by remember { mutableStateOf(randomHue()) }
- var releaseHue by remember { mutableStateOf(randomHue()) }
- var cancelHue by remember { mutableStateOf(randomHue()) }
+ var tapHue by remember { mutableFloatStateOf(randomHue()) }
+ var longPressHue by remember { mutableFloatStateOf(randomHue()) }
+ var doubleTapHue by remember { mutableFloatStateOf(randomHue()) }
+ var pressHue by remember { mutableFloatStateOf(randomHue()) }
+ var releaseHue by remember { mutableFloatStateOf(randomHue()) }
+ var cancelHue by remember { mutableFloatStateOf(randomHue()) }
Column {
Text("The boxes change color when you tap the white box.")
@@ -214,7 +215,7 @@
@Composable
fun TouchSlopDragGestures() {
Column {
- var width by remember { mutableStateOf(0f) }
+ var width by remember { mutableFloatStateOf(0f) }
Box(
Modifier.fillMaxWidth()
.background(Color.Cyan)
@@ -241,7 +242,7 @@
}
Box(Modifier.weight(1f)) {
- var height by remember { mutableStateOf(0f) }
+ var height by remember { mutableFloatStateOf(0f) }
Box(
Modifier.fillMaxHeight()
.background(Color.Yellow)
@@ -328,23 +329,23 @@
@Composable
fun Drag2DGestures() {
var size by remember { mutableStateOf(IntSize.Zero) }
- val offsetX = remember { mutableStateOf(0f) }
- val offsetY = remember { mutableStateOf(0f) }
+ var offsetX by remember { mutableFloatStateOf(0f) }
+ var offsetY by remember { mutableFloatStateOf(0f) }
Box(
Modifier.onSizeChanged {
size = it
}.fillMaxSize()
) {
Box(
- Modifier.offset { IntOffset(offsetX.value.roundToInt(), offsetY.value.roundToInt()) }
+ Modifier.offset { IntOffset(offsetX.roundToInt(), offsetY.roundToInt()) }
.background(Color.Blue)
.requiredSize(50.dp)
.pointerInput(Unit) {
detectDragGestures { _, dragAmount ->
- offsetX.value = (offsetX.value + dragAmount.x)
+ offsetX = (offsetX + dragAmount.x)
.coerceIn(0f, size.width.toFloat() - 50.dp.toPx())
- offsetY.value = (offsetY.value + dragAmount.y)
+ offsetY = (offsetY + dragAmount.y)
.coerceIn(0f, size.height.toFloat() - 50.dp.toPx())
}
}
@@ -361,10 +362,10 @@
) -> Unit
) {
val matrix by remember { mutableStateOf(Matrix()) }
- var angle by remember { mutableStateOf(0f) }
- var zoom by remember { mutableStateOf(1f) }
- var offsetX by remember { mutableStateOf(0f) }
- var offsetY by remember { mutableStateOf(0f) }
+ var angle by remember { mutableFloatStateOf(0f) }
+ var zoom by remember { mutableFloatStateOf(1f) }
+ var offsetX by remember { mutableFloatStateOf(0f) }
+ var offsetY by remember { mutableFloatStateOf(0f) }
Box(
Modifier.fillMaxSize().pointerInput(Unit) {
diff --git a/compose/foundation/foundation/integration-tests/foundation-demos/src/main/java/androidx/compose/foundation/demos/text/ComposeLineHeight.kt b/compose/foundation/foundation/integration-tests/foundation-demos/src/main/java/androidx/compose/foundation/demos/text/ComposeLineHeight.kt
index 085258f..a91e0d2 100644
--- a/compose/foundation/foundation/integration-tests/foundation-demos/src/main/java/androidx/compose/foundation/demos/text/ComposeLineHeight.kt
+++ b/compose/foundation/foundation/integration-tests/foundation-demos/src/main/java/androidx/compose/foundation/demos/text/ComposeLineHeight.kt
@@ -36,6 +36,7 @@
import androidx.compose.runtime.Composable
import androidx.compose.runtime.MutableState
import androidx.compose.runtime.getValue
+import androidx.compose.runtime.mutableFloatStateOf
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
import androidx.compose.runtime.setValue
@@ -70,8 +71,8 @@
Modifier.verticalScroll(rememberScrollState())
.background(TextMetricColors.Default.background)
) {
- var lineHeightSp = remember { mutableStateOf(60f) }
- var lineHeightEm = remember { mutableStateOf(1f) }
+ var lineHeightSp = remember { mutableFloatStateOf(60f) }
+ var lineHeightEm = remember { mutableFloatStateOf(1f) }
var lineHeightEnabled = remember { mutableStateOf(false) }
val lineHeightStyleEnabled = remember { mutableStateOf(false) }
var lineHeightAlignment = remember {
@@ -97,8 +98,8 @@
Spacer(Modifier.padding(16.dp))
TextWithLineHeight(
lineHeightEnabled.value,
- lineHeightSp.value,
- lineHeightEm.value,
+ lineHeightSp.floatValue,
+ lineHeightEm.floatValue,
if (lineHeightStyleEnabled.value) {
LineHeightStyle(
alignment = lineHeightAlignment.value,
@@ -336,7 +337,7 @@
snap: Boolean = true,
enabled: Boolean = true
) {
- var lastValue by remember(value) { mutableStateOf(value) }
+ var lastValue by remember(value) { mutableFloatStateOf(value) }
val increment = valueRange.endInclusive / (steps + 1).toFloat()
val snapValue = round(value / increment / 2f) * increment
diff --git a/compose/foundation/foundation/integration-tests/foundation-demos/src/main/java/androidx/compose/foundation/demos/text/ComposeText.kt b/compose/foundation/foundation/integration-tests/foundation-demos/src/main/java/androidx/compose/foundation/demos/text/ComposeText.kt
index bf5e4dd..709067a 100644
--- a/compose/foundation/foundation/integration-tests/foundation-demos/src/main/java/androidx/compose/foundation/demos/text/ComposeText.kt
+++ b/compose/foundation/foundation/integration-tests/foundation-demos/src/main/java/androidx/compose/foundation/demos/text/ComposeText.kt
@@ -54,6 +54,7 @@
import androidx.compose.runtime.Composable
import androidx.compose.runtime.CompositionLocalProvider
import androidx.compose.runtime.getValue
+import androidx.compose.runtime.mutableFloatStateOf
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
import androidx.compose.runtime.setValue
@@ -562,7 +563,7 @@
val textStyleHyphensOff = TextStyle(fontSize = fontSize8, color = Color.Blue,
hyphens = Hyphens.None)
Column {
- var width by remember { mutableStateOf(30f) }
+ var width by remember { mutableFloatStateOf(30f) }
Slider(
value = width,
onValueChange = { width = it },
diff --git a/compose/foundation/foundation/integration-tests/foundation-demos/src/main/java/androidx/compose/foundation/demos/text/FontFamilyDemo.kt b/compose/foundation/foundation/integration-tests/foundation-demos/src/main/java/androidx/compose/foundation/demos/text/FontFamilyDemo.kt
index d7aae18..0b21ea8 100644
--- a/compose/foundation/foundation/integration-tests/foundation-demos/src/main/java/androidx/compose/foundation/demos/text/FontFamilyDemo.kt
+++ b/compose/foundation/foundation/integration-tests/foundation-demos/src/main/java/androidx/compose/foundation/demos/text/FontFamilyDemo.kt
@@ -28,6 +28,7 @@
import androidx.compose.material.TextField
import androidx.compose.runtime.Composable
import androidx.compose.runtime.getValue
+import androidx.compose.runtime.mutableIntStateOf
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
import androidx.compose.runtime.setValue
@@ -64,7 +65,7 @@
@Composable
fun AsyncFontFamilyDemo() {
- var recreateFontFamily by remember { mutableStateOf(0) }
+ var recreateFontFamily by remember { mutableIntStateOf(0) }
var showW800 by remember {
mutableStateOf(false)
}
diff --git a/compose/foundation/foundation/integration-tests/foundation-demos/src/main/java/androidx/compose/foundation/demos/text/InteractiveText.kt b/compose/foundation/foundation/integration-tests/foundation-demos/src/main/java/androidx/compose/foundation/demos/text/InteractiveText.kt
index b671f6b..57d039b 100644
--- a/compose/foundation/foundation/integration-tests/foundation-demos/src/main/java/androidx/compose/foundation/demos/text/InteractiveText.kt
+++ b/compose/foundation/foundation/integration-tests/foundation-demos/src/main/java/androidx/compose/foundation/demos/text/InteractiveText.kt
@@ -25,8 +25,11 @@
import androidx.compose.material.MaterialTheme
import androidx.compose.material.Text
import androidx.compose.runtime.Composable
+import androidx.compose.runtime.getValue
+import androidx.compose.runtime.mutableIntStateOf
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
+import androidx.compose.runtime.setValue
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.text.AnnotatedString
@@ -38,7 +41,7 @@
fun InteractiveTextDemo() {
val clickedOffset = remember { mutableStateOf<Int?>(null) }
val hoveredOffset = remember { mutableStateOf<Int?>(null) }
- val numOnHoverInvocations = remember { mutableStateOf(0) }
+ var numOnHoverInvocations by remember { mutableIntStateOf(0) }
Column(
modifier = Modifier.padding(horizontal = 10.dp)
) {
@@ -47,14 +50,14 @@
Text(text = "Click/Hover the lorem ipsum text below.")
Text(text = "Clicked offset: ${clickedOffset.value ?: "No click yet"}")
Text(text = "Hovered offset: ${hoveredOffset.value ?: "Not hovering"}")
- Text(text = "Number of onHover invocations: ${numOnHoverInvocations.value}")
+ Text(text = "Number of onHover invocations: $numOnHoverInvocations")
ClickableText(
text = AnnotatedString(loremIpsum(wordCount = 30)),
modifier = Modifier.border(Dp.Hairline, Color.Black),
style = MaterialTheme.typography.body1,
onHover = {
- numOnHoverInvocations.value = numOnHoverInvocations.value + 1
+ numOnHoverInvocations++
hoveredOffset.value = it
}
) { offset ->
@@ -65,7 +68,7 @@
onClick = {
clickedOffset.value = null
hoveredOffset.value = null
- numOnHoverInvocations.value = 0
+ numOnHoverInvocations = 0
}
) {
Text(text = "Reset Offsets/Counter")
diff --git a/compose/foundation/foundation/integration-tests/foundation-demos/src/main/java/androidx/compose/foundation/demos/text/LetterSpacingDemo.kt b/compose/foundation/foundation/integration-tests/foundation-demos/src/main/java/androidx/compose/foundation/demos/text/LetterSpacingDemo.kt
index 654faea..045a0c1 100644
--- a/compose/foundation/foundation/integration-tests/foundation-demos/src/main/java/androidx/compose/foundation/demos/text/LetterSpacingDemo.kt
+++ b/compose/foundation/foundation/integration-tests/foundation-demos/src/main/java/androidx/compose/foundation/demos/text/LetterSpacingDemo.kt
@@ -26,6 +26,7 @@
import androidx.compose.material.Text
import androidx.compose.runtime.Composable
import androidx.compose.runtime.getValue
+import androidx.compose.runtime.mutableFloatStateOf
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
import androidx.compose.runtime.setValue
@@ -42,8 +43,8 @@
Column(
Modifier.padding(horizontal = 16.dp)
) {
- var letterSpacing: Float by remember { mutableStateOf(0.0f) }
- var fontSize: Float by remember { mutableStateOf(12f) }
+ var letterSpacing: Float by remember { mutableFloatStateOf(0.0f) }
+ var fontSize: Float by remember { mutableFloatStateOf(12f) }
Text("LetterSpacing: ${letterSpacing.toString().take(4)}.sp")
Slider(
diff --git a/compose/foundation/foundation/integration-tests/foundation-demos/src/main/java/androidx/compose/foundation/demos/text/LineBreakDemo.kt b/compose/foundation/foundation/integration-tests/foundation-demos/src/main/java/androidx/compose/foundation/demos/text/LineBreakDemo.kt
index 55ccf56..f571dc0 100644
--- a/compose/foundation/foundation/integration-tests/foundation-demos/src/main/java/androidx/compose/foundation/demos/text/LineBreakDemo.kt
+++ b/compose/foundation/foundation/integration-tests/foundation-demos/src/main/java/androidx/compose/foundation/demos/text/LineBreakDemo.kt
@@ -26,8 +26,10 @@
import androidx.compose.material.Slider
import androidx.compose.material.Text
import androidx.compose.runtime.Composable
-import androidx.compose.runtime.mutableStateOf
+import androidx.compose.runtime.getValue
+import androidx.compose.runtime.mutableFloatStateOf
import androidx.compose.runtime.remember
+import androidx.compose.runtime.setValue
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.text.SpanStyle
@@ -55,13 +57,13 @@
@Composable
fun TextLineBreakDemo() {
- val selectedFontSize = remember { mutableStateOf(16f) }
+ var selectedFontSize by remember { mutableFloatStateOf(16f) }
Column(modifier = Modifier.fillMaxSize()) {
- Text("Font size: ${selectedFontSize.value}")
+ Text("Font size: $selectedFontSize")
Slider(
- value = selectedFontSize.value,
- onValueChange = { value -> selectedFontSize.value = value },
+ value = selectedFontSize,
+ onValueChange = { value -> selectedFontSize = value },
valueRange = 8f..48f
)
@@ -82,7 +84,7 @@
},
style = TextStyle(
lineBreak = preset,
- fontSize = selectedFontSize.value.sp
+ fontSize = selectedFontSize.sp
),
modifier = textModifier.weight(1f)
)
diff --git a/compose/foundation/foundation/integration-tests/foundation-demos/src/main/java/androidx/compose/foundation/demos/text/StrokeDemo.kt b/compose/foundation/foundation/integration-tests/foundation-demos/src/main/java/androidx/compose/foundation/demos/text/StrokeDemo.kt
index c3c5211..bc0cda0 100644
--- a/compose/foundation/foundation/integration-tests/foundation-demos/src/main/java/androidx/compose/foundation/demos/text/StrokeDemo.kt
+++ b/compose/foundation/foundation/integration-tests/foundation-demos/src/main/java/androidx/compose/foundation/demos/text/StrokeDemo.kt
@@ -27,6 +27,7 @@
import androidx.compose.runtime.Composable
import androidx.compose.runtime.derivedStateOf
import androidx.compose.runtime.getValue
+import androidx.compose.runtime.mutableFloatStateOf
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
import androidx.compose.runtime.setValue
@@ -45,7 +46,7 @@
@OptIn(ExperimentalTextApi::class)
@Composable
fun TextStrokeDemo() {
- var dashInterval by remember { mutableStateOf(2f) }
+ var dashInterval by remember { mutableFloatStateOf(2f) }
var stroke by remember {
mutableStateOf(
Stroke(
diff --git a/compose/foundation/foundation/integration-tests/foundation-demos/src/main/java/androidx/compose/foundation/demos/text/TextFieldsInDialogDemo.kt b/compose/foundation/foundation/integration-tests/foundation-demos/src/main/java/androidx/compose/foundation/demos/text/TextFieldsInDialogDemo.kt
index bce2a5f..15f6d1e 100644
--- a/compose/foundation/foundation/integration-tests/foundation-demos/src/main/java/androidx/compose/foundation/demos/text/TextFieldsInDialogDemo.kt
+++ b/compose/foundation/foundation/integration-tests/foundation-demos/src/main/java/androidx/compose/foundation/demos/text/TextFieldsInDialogDemo.kt
@@ -32,6 +32,7 @@
import androidx.compose.runtime.Composable
import androidx.compose.runtime.LaunchedEffect
import androidx.compose.runtime.getValue
+import androidx.compose.runtime.mutableIntStateOf
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
import androidx.compose.runtime.saveable.rememberSaveable
@@ -106,7 +107,7 @@
@Composable
fun TextFieldsInDialogDemo() {
val listState = rememberLazyListState()
- val (currentDemoIndex, setDemoIndex) = rememberSaveable { mutableStateOf(-1) }
+ val (currentDemoIndex, setDemoIndex) = rememberSaveable { mutableIntStateOf(-1) }
if (currentDemoIndex == -1) {
LazyColumn(state = listState) {
diff --git a/compose/foundation/foundation/integration-tests/foundation-demos/src/main/java/androidx/compose/foundation/demos/text/VariableFontsDemo.kt b/compose/foundation/foundation/integration-tests/foundation-demos/src/main/java/androidx/compose/foundation/demos/text/VariableFontsDemo.kt
index ba89fe4..843f8fe 100644
--- a/compose/foundation/foundation/integration-tests/foundation-demos/src/main/java/androidx/compose/foundation/demos/text/VariableFontsDemo.kt
+++ b/compose/foundation/foundation/integration-tests/foundation-demos/src/main/java/androidx/compose/foundation/demos/text/VariableFontsDemo.kt
@@ -37,6 +37,7 @@
import androidx.compose.material.Text
import androidx.compose.runtime.Composable
import androidx.compose.runtime.LaunchedEffect
+import androidx.compose.runtime.mutableFloatStateOf
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
import androidx.compose.ui.Alignment
@@ -65,7 +66,7 @@
Text("Variable fonts are only supported on API 26+")
}
- val (weight, setWeight) = remember { mutableStateOf(1000f) }
+ val (weight, setWeight) = remember { mutableFloatStateOf(1000f) }
val (italic, setItalic) = remember { mutableStateOf(false) }
LazyColumn {
this.stickyHeader {
diff --git a/compose/foundation/foundation/samples/src/main/AndroidManifest.xml b/compose/foundation/foundation/samples/src/main/AndroidManifest.xml
deleted file mode 100644
index 6a69672..0000000
--- a/compose/foundation/foundation/samples/src/main/AndroidManifest.xml
+++ /dev/null
@@ -1,17 +0,0 @@
-<!--
- Copyright 2019 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.
- -->
-
-<manifest />
diff --git a/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/BackgroundTest.kt b/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/BackgroundTest.kt
index 1bf2f65..7cc04da 100644
--- a/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/BackgroundTest.kt
+++ b/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/BackgroundTest.kt
@@ -21,9 +21,12 @@
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.size
import androidx.compose.foundation.shape.CircleShape
+import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.runtime.Composable
import androidx.compose.runtime.CompositionLocalProvider
+import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableStateOf
+import androidx.compose.runtime.setValue
import androidx.compose.testutils.assertShape
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
@@ -180,6 +183,42 @@
}
@Test
+ fun background_changeShape() {
+ var shape by mutableStateOf(RoundedCornerShape(10f))
+
+ rule.setContent {
+ SemanticParent {
+ Box(
+ Modifier.size(40f.toDp())
+ .background(Color.Magenta)
+ .background(color = Color.White, shape = shape)
+ )
+ }
+ }
+
+ val bitmap = rule.onNodeWithTag(contentTag).captureToImage()
+ bitmap.assertShape(
+ density = rule.density,
+ backgroundColor = Color.Magenta,
+ shape = RoundedCornerShape(10f),
+ shapeColor = Color.White,
+ shapeOverlapPixelCount = 2.0f
+ )
+
+ shape = CircleShape
+ rule.waitForIdle()
+
+ val bitmap2 = rule.onNodeWithTag(contentTag).captureToImage()
+ bitmap2.assertShape(
+ density = rule.density,
+ backgroundColor = Color.Magenta,
+ shape = CircleShape,
+ shapeColor = Color.White,
+ shapeOverlapPixelCount = 2.0f
+ )
+ }
+
+ @Test
fun background_rtl_initially() {
rule.setContent {
SemanticParent {
diff --git a/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/lazy/grid/LazyCustomKeysTest.kt b/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/lazy/grid/LazyCustomKeysTest.kt
index aa07638..76103d9 100644
--- a/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/lazy/grid/LazyCustomKeysTest.kt
+++ b/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/lazy/grid/LazyCustomKeysTest.kt
@@ -422,6 +422,26 @@
}
}
+ @Test
+ fun keysLambdaIsCalledOnlyOnce() {
+ var keyCalls = 0
+
+ rule.setContent {
+ LazyVerticalGrid(GridCells.Fixed(1)) {
+ items(1, key = {
+ keyCalls++
+ 0
+ }) {
+ Item("item")
+ }
+ }
+ }
+
+ rule.runOnIdle {
+ assertThat(keyCalls).isEqualTo(1)
+ }
+ }
+
private fun testReordering(content: LazyGridScope.(List<MyClass>) -> Unit) {
var list by mutableStateOf(listOf(MyClass(0), MyClass(1), MyClass(2)))
diff --git a/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/lazy/layout/LazyLayoutStateRestorationTest.kt b/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/lazy/layout/LazyLayoutStateRestorationTest.kt
index e8dcc77..d05d1f1 100644
--- a/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/lazy/layout/LazyLayoutStateRestorationTest.kt
+++ b/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/lazy/layout/LazyLayoutStateRestorationTest.kt
@@ -305,7 +305,7 @@
override val itemCount: Int = itemCount()
@Composable
- override fun Item(index: Int) {
+ override fun Item(index: Int, key: Any) {
content(index)
}
diff --git a/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/lazy/layout/LazyLayoutTest.kt b/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/lazy/layout/LazyLayoutTest.kt
index 603ac21..c9c1a87 100644
--- a/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/lazy/layout/LazyLayoutTest.kt
+++ b/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/lazy/layout/LazyLayoutTest.kt
@@ -23,6 +23,7 @@
import androidx.compose.runtime.Composable
import androidx.compose.runtime.DisposableEffect
import androidx.compose.runtime.getValue
+import androidx.compose.runtime.mutableStateListOf
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.setValue
import androidx.compose.ui.Modifier
@@ -467,13 +468,47 @@
}
}
+ @Test
+ fun skippingItemBlockWhenKeyIsObservableButDidntChange() {
+ val stateList = mutableStateListOf(0)
+ var itemCalls = 0
+ val itemProvider = object : LazyLayoutItemProvider {
+ @Composable
+ override fun Item(index: Int, key: Any) {
+ assertThat(index).isEqualTo(0)
+ assertThat(key).isEqualTo(index)
+ itemCalls++
+ }
+
+ override val itemCount: Int get() = stateList.size
+
+ override fun getKey(index: Int) = stateList[index]
+ }
+ rule.setContent {
+ LazyLayout(itemProvider) { constraint ->
+ measure(0, constraint)
+ layout(100, 100) {}
+ }
+ }
+
+ rule.runOnIdle {
+ assertThat(itemCalls).isEqualTo(1)
+
+ stateList += 1
+ }
+
+ rule.runOnIdle {
+ assertThat(itemCalls).isEqualTo(1)
+ }
+ }
+
private fun itemProvider(
itemCount: () -> Int,
itemContent: @Composable (Int) -> Unit
): LazyLayoutItemProvider {
return object : LazyLayoutItemProvider {
@Composable
- override fun Item(index: Int) {
+ override fun Item(index: Int, key: Any) {
itemContent(index)
}
diff --git a/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/lazy/list/LazyCustomKeysTest.kt b/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/lazy/list/LazyCustomKeysTest.kt
index fcb0408..9c97094 100644
--- a/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/lazy/list/LazyCustomKeysTest.kt
+++ b/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/lazy/list/LazyCustomKeysTest.kt
@@ -429,6 +429,26 @@
}
}
+ @Test
+ fun keysLambdaIsCalledOnlyOnce() {
+ var keyCalls = 0
+
+ rule.setContent {
+ LazyColumn {
+ items(1, key = {
+ keyCalls++
+ 0
+ }) {
+ Item("item")
+ }
+ }
+ }
+
+ rule.runOnIdle {
+ assertThat(keyCalls).isEqualTo(1)
+ }
+ }
+
private fun testReordering(content: LazyListScope.(List<MyClass>) -> Unit) {
var list by mutableStateOf(listOf(MyClass(0), MyClass(1), MyClass(2)))
diff --git a/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/lazy/staggeredgrid/LazyStaggeredGridCustomKeysTest.kt b/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/lazy/staggeredgrid/LazyStaggeredGridCustomKeysTest.kt
new file mode 100644
index 0000000..554a393
--- /dev/null
+++ b/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/lazy/staggeredgrid/LazyStaggeredGridCustomKeysTest.kt
@@ -0,0 +1,508 @@
+/*
+ * Copyright 2021 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 androidx.compose.foundation.lazy.staggeredgrid
+
+import androidx.compose.foundation.layout.Spacer
+import androidx.compose.foundation.layout.fillMaxSize
+import androidx.compose.foundation.layout.size
+import androidx.compose.runtime.Composable
+import androidx.compose.runtime.LaunchedEffect
+import androidx.compose.runtime.getValue
+import androidx.compose.runtime.mutableStateListOf
+import androidx.compose.runtime.mutableStateOf
+import androidx.compose.runtime.remember
+import androidx.compose.runtime.setValue
+import androidx.compose.ui.Modifier
+import androidx.compose.ui.platform.testTag
+import androidx.compose.ui.test.assertHeightIsEqualTo
+import androidx.compose.ui.test.assertTopPositionInRootIsEqualTo
+import androidx.compose.ui.test.junit4.createComposeRule
+import androidx.compose.ui.test.onNodeWithTag
+import androidx.compose.ui.unit.dp
+import androidx.test.ext.junit.runners.AndroidJUnit4
+import androidx.test.filters.MediumTest
+import com.google.common.truth.Truth.assertThat
+import org.junit.Rule
+import org.junit.Test
+import org.junit.runner.RunWith
+
+@MediumTest
+@RunWith(AndroidJUnit4::class)
+class LazyCustomKeysTest {
+
+ @get:Rule
+ val rule = createComposeRule()
+
+ val itemSize = with(rule.density) {
+ 100.toDp()
+ }
+ val columns = 2
+
+ @Test
+ fun itemsWithKeysAreLaidOutCorrectly() {
+ val list = listOf(MyClass(0), MyClass(1), MyClass(2))
+
+ rule.setContent {
+ LazyVerticalStaggeredGrid(StaggeredGridCells.Fixed(columns)) {
+ items(list, key = { it.id }) {
+ Item("${it.id}")
+ }
+ }
+ }
+
+ assertItems("0", "1", "2")
+ }
+
+ @Test
+ fun removing_statesAreMoved() {
+ var list by mutableStateOf(listOf(MyClass(0), MyClass(1), MyClass(2)))
+
+ rule.setContent {
+ LazyVerticalStaggeredGrid(StaggeredGridCells.Fixed(columns)) {
+ items(list, key = { it.id }) {
+ Item(remember { "${it.id}" })
+ }
+ }
+ }
+
+ rule.runOnIdle {
+ list = listOf(list[0], list[2])
+ }
+
+ assertItems("0", "2")
+ }
+
+ @Test
+ fun reordering_statesAreMoved_list() {
+ testReordering { grid ->
+ items(grid, key = { it.id }) {
+ Item(remember { "${it.id}" })
+ }
+ }
+ }
+
+ @Test
+ fun reordering_statesAreMoved_list_indexed() {
+ testReordering { grid ->
+ itemsIndexed(grid, key = { _, item -> item.id }) { _, item ->
+ Item(remember { "${item.id}" })
+ }
+ }
+ }
+
+ @Test
+ fun reordering_statesAreMoved_array() {
+ testReordering { grid ->
+ val array = grid.toTypedArray()
+ items(array, key = { it.id }) {
+ Item(remember { "${it.id}" })
+ }
+ }
+ }
+
+ @Test
+ fun reordering_statesAreMoved_array_indexed() {
+ testReordering { grid ->
+ val array = grid.toTypedArray()
+ itemsIndexed(array, key = { _, item -> item.id }) { _, item ->
+ Item(remember { "${item.id}" })
+ }
+ }
+ }
+
+ @Test
+ fun reordering_statesAreMoved_itemsWithCount() {
+ testReordering { grid ->
+ items(grid.size, key = { grid[it].id }) {
+ Item(remember { "${grid[it].id}" })
+ }
+ }
+ }
+
+ @Test
+ fun fullyReplacingTheList() {
+ var list by mutableStateOf(listOf(MyClass(0), MyClass(1), MyClass(2)))
+ var counter = 0
+
+ rule.setContent {
+ LazyVerticalStaggeredGrid(StaggeredGridCells.Fixed(columns)) {
+ items(list, key = { it.id }) {
+ Item(remember { counter++ }.toString())
+ }
+ }
+ }
+
+ rule.runOnIdle {
+ list = listOf(MyClass(3), MyClass(4), MyClass(5), MyClass(6))
+ }
+
+ assertItems("3", "4", "5", "6")
+ }
+
+ @Test
+ fun keepingOneItem() {
+ var list by mutableStateOf(listOf(MyClass(0), MyClass(1), MyClass(2)))
+ var counter = 0
+
+ rule.setContent {
+ LazyVerticalStaggeredGrid(StaggeredGridCells.Fixed(columns)) {
+ items(list, key = { it.id }) {
+ Item(remember { counter++ }.toString())
+ }
+ }
+ }
+
+ rule.runOnIdle {
+ list = listOf(MyClass(1))
+ }
+
+ assertItems("1")
+ }
+
+ @Test
+ fun keepingOneItemAndAddingMore() {
+ var list by mutableStateOf(listOf(MyClass(0), MyClass(1), MyClass(2)))
+ var counter = 0
+
+ rule.setContent {
+ LazyVerticalStaggeredGrid(StaggeredGridCells.Fixed(columns)) {
+ items(list, key = { it.id }) {
+ Item(remember { counter++ }.toString())
+ }
+ }
+ }
+
+ rule.runOnIdle {
+ list = listOf(MyClass(1), MyClass(3))
+ }
+
+ assertItems("1", "3")
+ }
+
+ @Test
+ fun mixingKeyedItemsAndNot() {
+ testReordering { list ->
+ item {
+ Item("${list.first().id}")
+ }
+ items(list.subList(fromIndex = 1, toIndex = list.size), key = { it.id }) {
+ Item(remember { "${it.id}" })
+ }
+ }
+ }
+
+ @Test
+ fun updatingTheDataSetIsCorrectlyApplied() {
+ val state = mutableStateOf(emptyList<Int>())
+
+ rule.setContent {
+ LaunchedEffect(Unit) {
+ state.value = listOf(4, 1, 3)
+ }
+
+ val list = state.value
+
+ LazyVerticalStaggeredGrid(StaggeredGridCells.Fixed(columns), Modifier.fillMaxSize()) {
+ items(list, key = { it }) {
+ Item(it.toString())
+ }
+ }
+ }
+
+ assertItems("4", "1", "3")
+
+ rule.runOnIdle {
+ state.value = listOf(2, 4, 6, 1, 3, 5)
+ }
+
+ assertItems("2", "4", "6", "1", "3", "5")
+ }
+
+ @Test
+ fun reordering_usingMutableStateListOf() {
+ val list = mutableStateListOf(MyClass(0), MyClass(1), MyClass(2))
+
+ rule.setContent {
+ LazyVerticalStaggeredGrid(StaggeredGridCells.Fixed(columns)) {
+ items(list, key = { it.id }) {
+ Item(remember { "${it.id}" })
+ }
+ }
+ }
+
+ rule.runOnIdle {
+ list.add(list.removeAt(1))
+ }
+
+ assertItems("0", "2", "1")
+ }
+
+ @Test
+ fun keysInLazyListItemInfoAreCorrect() {
+ val list = listOf(MyClass(0), MyClass(1), MyClass(2))
+ lateinit var state: LazyStaggeredGridState
+
+ rule.setContent {
+ state = rememberLazyStaggeredGridState()
+ LazyVerticalStaggeredGrid(StaggeredGridCells.Fixed(columns), state = state) {
+ items(list, key = { it.id }) {
+ Item(remember { "${it.id}" })
+ }
+ }
+ }
+
+ rule.runOnIdle {
+ assertThat(
+ state.visibleKeys
+ ).isEqualTo(listOf(0, 1, 2))
+ }
+ }
+
+ @Test
+ fun keysInLazyListItemInfoAreCorrectAfterReordering() {
+ var list by mutableStateOf(listOf(MyClass(0), MyClass(1), MyClass(2)))
+ lateinit var state: LazyStaggeredGridState
+
+ rule.setContent {
+ state = rememberLazyStaggeredGridState()
+ LazyVerticalStaggeredGrid(columns = StaggeredGridCells.Fixed(columns), state = state) {
+ items(list, key = { it.id }) {
+ Item(remember { "${it.id}" })
+ }
+ }
+ }
+
+ rule.runOnIdle {
+ list = listOf(list[0], list[2], list[1])
+ }
+
+ rule.runOnIdle {
+ assertThat(
+ state.visibleKeys
+ ).isEqualTo(listOf(0, 2, 1))
+ }
+ }
+
+ @Test
+ fun addingItemsBeforeWithoutKeysIsMaintainingTheIndex() {
+ var list by mutableStateOf((10..15).toList())
+ lateinit var state: LazyStaggeredGridState
+
+ rule.setContent {
+ state = rememberLazyStaggeredGridState()
+ LazyVerticalStaggeredGrid(
+ StaggeredGridCells.Fixed(columns),
+ Modifier.size(itemSize * 2.5f),
+ state
+ ) {
+ items(list) {
+ Item(remember { "$it" })
+ }
+ }
+ }
+
+ rule.runOnIdle {
+ list = (0..15).toList()
+ }
+
+ rule.runOnIdle {
+ assertThat(state.firstVisibleItemIndex).isEqualTo(0)
+ }
+ }
+
+ @Test
+ fun addingItemsBeforeKeepingThisItemFirst() {
+ var list by mutableStateOf((10..15).toList())
+ lateinit var state: LazyStaggeredGridState
+
+ rule.setContent {
+ state = rememberLazyStaggeredGridState()
+ LazyVerticalStaggeredGrid(
+ StaggeredGridCells.Fixed(columns),
+ Modifier.size(itemSize * 2.5f),
+ state
+ ) {
+ items(list, key = { it }) {
+ Item(remember { "$it" })
+ }
+ }
+ }
+
+ rule.runOnIdle {
+ list = (0..15).toList()
+ }
+
+ rule.runOnIdle {
+ assertThat(state.firstVisibleItemIndex).isEqualTo(10)
+ assertThat(
+ state.visibleKeys
+ ).isEqualTo(listOf(10, 11, 12, 13, 14, 15))
+ }
+ }
+
+ @Test
+ fun addingItemsRightAfterKeepingThisItemFirst() {
+ var list by mutableStateOf((0..5).toList() + (10..15).toList())
+ lateinit var state: LazyStaggeredGridState
+
+ rule.setContent {
+ state = rememberLazyStaggeredGridState(5)
+ LazyVerticalStaggeredGrid(
+ StaggeredGridCells.Fixed(1),
+ Modifier.size(itemSize * 2.5f),
+ state
+ ) {
+ items(list, key = { it }) {
+ Item(remember { "$it" })
+ }
+ }
+ }
+
+ rule.runOnIdle {
+ list = (0..15).toList()
+ }
+
+ rule.runOnIdle {
+ assertThat(state.firstVisibleItemIndex).isEqualTo(5)
+ assertThat(
+ state.visibleKeys
+ ).isEqualTo(listOf(5, 6, 7))
+ }
+ }
+
+ @Test
+ fun addingItemsBeforeWhileCurrentItemIsNotInTheBeginning() {
+ var list by mutableStateOf((10..30).toList())
+ lateinit var state: LazyStaggeredGridState
+
+ rule.setContent {
+ state = rememberLazyStaggeredGridState(10) // key 20 is the first item
+ LazyVerticalStaggeredGrid(
+ StaggeredGridCells.Fixed(columns),
+ Modifier.size(itemSize * 2.5f),
+ state
+ ) {
+ items(list, key = { it }) {
+ Item(remember { "$it" })
+ }
+ }
+ }
+
+ rule.runOnIdle {
+ list = (0..30).toList()
+ }
+
+ rule.runOnIdle {
+ assertThat(state.firstVisibleItemIndex).isEqualTo(20)
+ assertThat(
+ state.visibleKeys
+ ).isEqualTo(listOf(20, 21, 22, 23, 24, 25))
+ }
+ }
+
+ @Test
+ fun removingTheCurrentItemMaintainsTheIndex() {
+ var list by mutableStateOf((0..20).toList())
+ lateinit var state: LazyStaggeredGridState
+
+ rule.setContent {
+ state = rememberLazyStaggeredGridState(8)
+ LazyVerticalStaggeredGrid(
+ StaggeredGridCells.Fixed(columns),
+ Modifier.size(itemSize * 2.5f),
+ state
+ ) {
+ items(list, key = { it }) {
+ Item(remember { "$it" })
+ }
+ }
+ }
+
+ rule.runOnIdle {
+ list = (0..20) - 8
+ }
+
+ rule.runOnIdle {
+ assertThat(state.firstVisibleItemIndex).isEqualTo(8)
+ assertThat(state.visibleKeys).isEqualTo(listOf(9, 10, 11, 12, 13, 14))
+ }
+ }
+
+ @Test
+ fun keysLambdaIsCalledOnlyOnce() {
+ var keyCalls = 0
+
+ rule.setContent {
+ LazyVerticalStaggeredGrid(StaggeredGridCells.Fixed(1)) {
+ items(1, key = {
+ keyCalls++
+ 0
+ }) {
+ Item("item")
+ }
+ }
+ }
+
+ rule.runOnIdle {
+ assertThat(keyCalls).isEqualTo(1)
+ }
+ }
+
+ private fun testReordering(content: LazyStaggeredGridScope.(List<MyClass>) -> Unit) {
+ var list by mutableStateOf(listOf(MyClass(0), MyClass(1), MyClass(2)))
+
+ rule.setContent {
+ LazyVerticalStaggeredGrid(StaggeredGridCells.Fixed(columns)) {
+ content(list)
+ }
+ }
+
+ rule.runOnIdle {
+ list = listOf(list[0], list[2], list[1])
+ }
+
+ assertItems("0", "2", "1")
+ }
+
+ private fun assertItems(vararg tags: String) {
+ var currentTop = 0.dp
+ var column = 0
+ tags.forEach {
+ rule.onNodeWithTag(it)
+ .assertTopPositionInRootIsEqualTo(currentTop)
+ .assertHeightIsEqualTo(itemSize)
+ ++column
+ if (column == columns) {
+ currentTop += itemSize
+ column = 0
+ }
+ }
+ }
+
+ @Composable
+ private fun Item(tag: String) {
+ Spacer(
+ Modifier
+ .testTag(tag)
+ .size(itemSize)
+ )
+ }
+
+ private class MyClass(val id: Int)
+}
+
+val LazyStaggeredGridState.visibleKeys: List<Any> get() = layoutInfo.visibleItemsInfo.map { it.key }
diff --git a/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/pager/PagerCustomKeyTest.kt b/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/pager/PagerCustomKeyTest.kt
new file mode 100644
index 0000000..5e3afed
--- /dev/null
+++ b/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/pager/PagerCustomKeyTest.kt
@@ -0,0 +1,59 @@
+/*
+ * Copyright 2023 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 androidx.compose.foundation.pager
+
+import androidx.compose.foundation.ExperimentalFoundationApi
+import androidx.compose.foundation.layout.Spacer
+import androidx.compose.foundation.layout.fillMaxSize
+import androidx.compose.ui.Modifier
+import androidx.compose.ui.test.junit4.createComposeRule
+import androidx.test.ext.junit.runners.AndroidJUnit4
+import androidx.test.filters.MediumTest
+import com.google.common.truth.Truth
+import org.junit.Rule
+import org.junit.Test
+import org.junit.runner.RunWith
+
+@OptIn(ExperimentalFoundationApi::class)
+@MediumTest
+@RunWith(AndroidJUnit4::class)
+class PagerCustomKeyTest {
+
+ @get:Rule
+ val rule = createComposeRule()
+
+ @Test
+ fun keysLambdaIsCalledOnlyOnce() {
+ var keyCalls = 0
+
+ rule.setContent {
+ HorizontalPager(
+ state = rememberPagerState { 1 },
+ key = {
+ keyCalls++
+ 0
+ }
+ ) {
+ Spacer(Modifier.fillMaxSize())
+ }
+ }
+
+ rule.runOnIdle {
+ Truth.assertThat(keyCalls).isEqualTo(1)
+ }
+ }
+}
diff --git a/compose/foundation/foundation/src/androidMain/AndroidManifest.xml b/compose/foundation/foundation/src/androidMain/AndroidManifest.xml
deleted file mode 100644
index 7535bfb..0000000
--- a/compose/foundation/foundation/src/androidMain/AndroidManifest.xml
+++ /dev/null
@@ -1,17 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
- ~ Copyright 2018 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.
- -->
-<manifest />
diff --git a/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/Background.kt b/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/Background.kt
index 748d6b1..7fb11a3 100644
--- a/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/Background.kt
+++ b/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/Background.kt
@@ -143,6 +143,7 @@
private var lastSize: Size? = null
private var lastLayoutDirection: LayoutDirection? = null
private var lastOutline: Outline? = null
+ private var lastShape: Shape? = null
override fun ContentDrawScope.draw() {
if (shape === RectangleShape) {
@@ -161,7 +162,7 @@
private fun ContentDrawScope.drawOutline() {
val outline =
- if (size == lastSize && layoutDirection == lastLayoutDirection) {
+ if (size == lastSize && layoutDirection == lastLayoutDirection && lastShape == shape) {
lastOutline!!
} else {
shape.createOutline(size, layoutDirection, this)
@@ -171,5 +172,6 @@
lastOutline = outline
lastSize = size
lastLayoutDirection = layoutDirection
+ lastShape = shape
}
}
\ No newline at end of file
diff --git a/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/BasicMarquee.kt b/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/BasicMarquee.kt
index 61d3630..c96bdb3 100644
--- a/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/BasicMarquee.kt
+++ b/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/BasicMarquee.kt
@@ -32,6 +32,7 @@
import androidx.compose.runtime.Stable
import androidx.compose.runtime.derivedStateOf
import androidx.compose.runtime.getValue
+import androidx.compose.runtime.mutableIntStateOf
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.setValue
import androidx.compose.runtime.snapshotFlow
@@ -201,8 +202,8 @@
DrawModifierNode,
FocusEventModifierNode {
- private var contentWidth by mutableStateOf(0)
- private var containerWidth by mutableStateOf(0)
+ private var contentWidth by mutableIntStateOf(0)
+ private var containerWidth by mutableIntStateOf(0)
private var hasFocus by mutableStateOf(false)
var spacing: MarqueeSpacing by mutableStateOf(spacing)
var animationMode: MarqueeAnimationMode by mutableStateOf(animationMode)
diff --git a/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/Scroll.kt b/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/Scroll.kt
index 0ce2c64..4eefc4c 100644
--- a/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/Scroll.kt
+++ b/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/Scroll.kt
@@ -33,7 +33,6 @@
import androidx.compose.runtime.derivedStateOf
import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableIntStateOf
-import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
import androidx.compose.runtime.rememberCoroutineScope
import androidx.compose.runtime.saveable.Saver
@@ -96,7 +95,7 @@
/**
* current scroll position value in pixels
*/
- var value: Int by mutableStateOf(initial)
+ var value: Int by mutableIntStateOf(initial)
private set
/**
@@ -114,7 +113,7 @@
/**
* Size of the viewport on the scrollable axis, or 0 if still unknown.
*/
- internal var viewportSize: Int by mutableStateOf(0)
+ internal var viewportSize: Int by mutableIntStateOf(0)
/**
* [InteractionSource] that will be used to dispatch drag events when this
diff --git a/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/lazy/DataIndex.kt b/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/lazy/DataIndex.kt
deleted file mode 100644
index 8a98269..0000000
--- a/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/lazy/DataIndex.kt
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- * Copyright 2021 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 androidx.compose.foundation.lazy
-
-/**
- * Represents an index in the list of items of lazy layout.
- */
-@Suppress("NOTHING_TO_INLINE")
-@kotlin.jvm.JvmInline
-internal value class DataIndex(val value: Int) {
- inline operator fun inc(): DataIndex = DataIndex(value + 1)
- inline operator fun dec(): DataIndex = DataIndex(value - 1)
- inline operator fun plus(i: Int): DataIndex = DataIndex(value + i)
- inline operator fun minus(i: Int): DataIndex = DataIndex(value - i)
- inline operator fun minus(i: DataIndex): DataIndex = DataIndex(value - i.value)
- inline operator fun compareTo(other: DataIndex): Int = value - other.value
-}
diff --git a/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/lazy/LazyList.kt b/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/lazy/LazyList.kt
index 4994b52..05949c7 100644
--- a/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/lazy/LazyList.kt
+++ b/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/lazy/LazyList.kt
@@ -262,9 +262,9 @@
) { index, key, contentType, placeables ->
// we add spaceBetweenItems as an extra spacing for all items apart from the last one so
// the lazy list measuring logic will take it into account.
- val spacing = if (index.value == itemsCount - 1) 0 else spaceBetweenItems
+ val spacing = if (index == itemsCount - 1) 0 else spaceBetweenItems
LazyListMeasuredItem(
- index = index.value,
+ index = index,
placeables = placeables,
isVertical = isVertical,
horizontalAlignment = horizontalAlignment,
@@ -281,10 +281,10 @@
}
state.premeasureConstraints = measuredItemProvider.childConstraints
- val firstVisibleItemIndex: DataIndex
+ val firstVisibleItemIndex: Int
val firstVisibleScrollOffset: Int
Snapshot.withoutReadObservation {
- firstVisibleItemIndex = DataIndex(state.firstVisibleItemIndex)
+ firstVisibleItemIndex = state.firstVisibleItemIndex
firstVisibleScrollOffset = state.firstVisibleItemScrollOffset
}
diff --git a/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/lazy/LazyListHeaders.kt b/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/lazy/LazyListHeaders.kt
index 2631561..978d3a8 100644
--- a/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/lazy/LazyListHeaders.kt
+++ b/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/lazy/LazyListHeaders.kt
@@ -70,7 +70,7 @@
return null
}
- val measuredHeaderItem = itemProvider.getAndMeasure(DataIndex(currentHeaderListPosition))
+ val measuredHeaderItem = itemProvider.getAndMeasure(currentHeaderListPosition)
var headerOffset = if (currentHeaderOffset != Int.MIN_VALUE) {
maxOf(-beforeContentPadding, currentHeaderOffset)
diff --git a/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/lazy/LazyListItemPlacementAnimator.kt b/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/lazy/LazyListItemPlacementAnimator.kt
index 15ebac4..497ba6d 100644
--- a/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/lazy/LazyListItemPlacementAnimator.kt
+++ b/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/lazy/LazyListItemPlacementAnimator.kt
@@ -33,7 +33,7 @@
private val activeKeys = mutableSetOf<Any>()
// snapshot of the key to index map used for the last measuring.
- private var keyToIndexMap: LazyLayoutKeyIndexMap = LazyLayoutKeyIndexMap.Empty
+ private var keyIndexMap: LazyLayoutKeyIndexMap = LazyLayoutKeyIndexMap.Empty
// keeps the index of the first visible item index.
private var firstVisibleIndex = 0
@@ -66,8 +66,8 @@
val previousFirstVisibleIndex = firstVisibleIndex
firstVisibleIndex = positionedItems.firstOrNull()?.index ?: 0
- val previousKeyToIndexMap = keyToIndexMap
- keyToIndexMap = itemProvider.keyToIndexMap
+ val previousKeyToIndexMap = keyIndexMap
+ keyIndexMap = itemProvider.keyIndexMap
val mainAxisLayoutSize = if (isVertical) layoutHeight else layoutWidth
@@ -87,7 +87,7 @@
if (item.hasAnimations) {
if (!activeKeys.contains(item.key)) {
activeKeys += item.key
- val previousIndex = previousKeyToIndexMap[item.key]
+ val previousIndex = previousKeyToIndexMap.getIndex(item.key)
if (previousIndex != -1 && item.index != previousIndex) {
if (previousIndex < previousFirstVisibleIndex) {
// the larger index will be in the start of the list
@@ -116,7 +116,7 @@
}
var accumulatedOffset = 0
- movingInFromStartBound.sortByDescending { previousKeyToIndexMap[it.key] }
+ movingInFromStartBound.sortByDescending { previousKeyToIndexMap.getIndex(it.key) }
movingInFromStartBound.fastForEach { item ->
accumulatedOffset += item.size
val mainAxisOffset = 0 - accumulatedOffset
@@ -124,7 +124,7 @@
startAnimationsIfNeeded(item)
}
accumulatedOffset = 0
- movingInFromEndBound.sortBy { previousKeyToIndexMap[it.key] }
+ movingInFromEndBound.sortBy { previousKeyToIndexMap.getIndex(it.key) }
movingInFromEndBound.fastForEach { item ->
val mainAxisOffset = mainAxisLayoutSize + accumulatedOffset
accumulatedOffset += item.size
@@ -135,12 +135,12 @@
movingAwayKeys.forEach { key ->
// found an item which was in our map previously but is not a part of the
// positionedItems now
- val newIndex = keyToIndexMap[key]
+ val newIndex = keyIndexMap.getIndex(key)
if (newIndex == -1) {
activeKeys.remove(key)
} else {
- val item = itemProvider.getAndMeasure(DataIndex(newIndex))
+ val item = itemProvider.getAndMeasure(newIndex)
// check if we have any active placement animation on the item
var inProgress = false
repeat(item.placeablesCount) {
@@ -149,7 +149,7 @@
return@repeat
}
}
- if ((!inProgress && newIndex == previousKeyToIndexMap[key])) {
+ if ((!inProgress && newIndex == previousKeyToIndexMap.getIndex(key))) {
activeKeys.remove(key)
} else {
if (newIndex < firstVisibleIndex) {
@@ -162,7 +162,7 @@
}
accumulatedOffset = 0
- movingAwayToStartBound.sortByDescending { keyToIndexMap[it.key] }
+ movingAwayToStartBound.sortByDescending { keyIndexMap.getIndex(it.key) }
movingAwayToStartBound.fastForEach { item ->
accumulatedOffset += item.size
val mainAxisOffset = 0 - accumulatedOffset
@@ -172,7 +172,7 @@
startAnimationsIfNeeded(positionedItem)
}
accumulatedOffset = 0
- movingAwayToEndBound.sortBy { keyToIndexMap[it.key] }
+ movingAwayToEndBound.sortBy { keyIndexMap.getIndex(it.key) }
movingAwayToEndBound.fastForEach { item ->
val mainAxisOffset = mainAxisLayoutSize + accumulatedOffset
accumulatedOffset += item.size
@@ -195,7 +195,7 @@
*/
fun reset() {
activeKeys.clear()
- keyToIndexMap = LazyLayoutKeyIndexMap.Empty
+ keyIndexMap = LazyLayoutKeyIndexMap.Empty
firstVisibleIndex = -1
}
diff --git a/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/lazy/LazyListItemProvider.kt b/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/lazy/LazyListItemProvider.kt
index 31cbd85..1a5eb66 100644
--- a/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/lazy/LazyListItemProvider.kt
+++ b/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/lazy/LazyListItemProvider.kt
@@ -19,7 +19,7 @@
import androidx.compose.foundation.ExperimentalFoundationApi
import androidx.compose.foundation.lazy.layout.LazyLayoutItemProvider
import androidx.compose.foundation.lazy.layout.LazyLayoutKeyIndexMap
-import androidx.compose.foundation.lazy.layout.PinnableItem
+import androidx.compose.foundation.lazy.layout.LazyLayoutPinnableItem
import androidx.compose.foundation.lazy.layout.NearestRangeKeyIndexMapState
import androidx.compose.runtime.Composable
import androidx.compose.runtime.derivedStateOf
@@ -30,7 +30,7 @@
@ExperimentalFoundationApi
internal interface LazyListItemProvider : LazyLayoutItemProvider {
- val keyToIndexMap: LazyLayoutKeyIndexMap
+ val keyIndexMap: LazyLayoutKeyIndexMap
/** The list of indexes of the sticky header items */
val headerIndexes: List<Int>
/** The scope used by the item content lambdas */
@@ -66,26 +66,28 @@
override val itemCount: Int get() = listContent.itemCount
@Composable
- override fun Item(index: Int) {
- listContent.PinnableItem(index, state.pinnedItems) { localIndex ->
- with(itemScope) { item(localIndex) }
+ override fun Item(index: Int, key: Any) {
+ LazyLayoutPinnableItem(key, index, state.pinnedItems) {
+ listContent.withInterval(index) { localIndex, content ->
+ content.item(itemScope, localIndex)
+ }
}
}
- override fun getKey(index: Int): Any = listContent.getKey(index)
+ override fun getKey(index: Int): Any = keyIndexMap.getKey(index) ?: listContent.getKey(index)
override fun getContentType(index: Int): Any? = listContent.getContentType(index)
override val headerIndexes: List<Int> get() = listContent.headerIndexes
- override val keyToIndexMap by NearestRangeKeyIndexMapState(
+ override val keyIndexMap by NearestRangeKeyIndexMapState(
firstVisibleItemIndex = { state.firstVisibleItemIndex },
slidingWindowSize = { NearestItemsSlidingWindowSize },
extraItemCount = { NearestItemsExtraItemCount },
content = { listContent }
)
- override fun getIndex(key: Any): Int = keyToIndexMap[key]
+ override fun getIndex(key: Any): Int = keyIndexMap.getIndex(key)
}
/**
diff --git a/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/lazy/LazyListMeasure.kt b/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/lazy/LazyListMeasure.kt
index 0c97ea2..91d0350 100644
--- a/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/lazy/LazyListMeasure.kt
+++ b/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/lazy/LazyListMeasure.kt
@@ -44,7 +44,7 @@
beforeContentPadding: Int,
afterContentPadding: Int,
spaceBetweenItems: Int,
- firstVisibleItemIndex: DataIndex,
+ firstVisibleItemIndex: Int,
firstVisibleItemScrollOffset: Int,
scrollToBeConsumed: Float,
constraints: Constraints,
@@ -81,10 +81,10 @@
} else {
var currentFirstItemIndex = firstVisibleItemIndex
var currentFirstItemScrollOffset = firstVisibleItemScrollOffset
- if (currentFirstItemIndex.value >= itemsCount) {
+ if (currentFirstItemIndex >= itemsCount) {
// the data set has been updated and now we have less items that we were
// scrolled to before
- currentFirstItemIndex = DataIndex(itemsCount - 1)
+ currentFirstItemIndex = itemsCount - 1
currentFirstItemScrollOffset = 0
}
@@ -96,7 +96,7 @@
currentFirstItemScrollOffset -= scrollDelta
// if the current scroll offset is less than minimally possible
- if (currentFirstItemIndex == DataIndex(0) && currentFirstItemScrollOffset < 0) {
+ if (currentFirstItemIndex == 0 && currentFirstItemScrollOffset < 0) {
scrollDelta += currentFirstItemScrollOffset
currentFirstItemScrollOffset = 0
}
@@ -119,8 +119,8 @@
// we had scrolled backward or we compose items in the start padding area, which means
// items before current firstItemScrollOffset should be visible. compose them and update
// firstItemScrollOffset
- while (currentFirstItemScrollOffset < 0 && currentFirstItemIndex > DataIndex(0)) {
- val previous = DataIndex(currentFirstItemIndex.value - 1)
+ while (currentFirstItemScrollOffset < 0 && currentFirstItemIndex > 0) {
+ val previous = currentFirstItemIndex - 1
val measuredItem = measuredItemProvider.getAndMeasure(previous)
visibleItems.add(0, measuredItem)
maxCrossAxis = maxOf(maxCrossAxis, measuredItem.crossAxisSize)
@@ -151,7 +151,7 @@
// then composing visible items forward until we fill the whole viewport.
// we want to have at least one item in visibleItems even if in fact all the items are
// offscreen, this can happen if the content padding is larger than the available size.
- while (index.value < itemsCount &&
+ while (index < itemsCount &&
(currentMainAxisOffset < maxMainAxis ||
currentMainAxisOffset <= 0 || // filling beforeContentPadding area
visibleItems.isEmpty())
@@ -159,7 +159,7 @@
val measuredItem = measuredItemProvider.getAndMeasure(index)
currentMainAxisOffset += measuredItem.sizeWithSpacings
- if (currentMainAxisOffset <= minOffset && index.value != itemsCount - 1) {
+ if (currentMainAxisOffset <= minOffset && index != itemsCount - 1) {
// this item is offscreen and will not be placed. advance firstVisibleItemIndex
currentFirstItemIndex = index + 1
currentFirstItemScrollOffset -= measuredItem.sizeWithSpacings
@@ -178,9 +178,9 @@
currentFirstItemScrollOffset -= toScrollBack
currentMainAxisOffset += toScrollBack
while (currentFirstItemScrollOffset < beforeContentPadding &&
- currentFirstItemIndex > DataIndex(0)
+ currentFirstItemIndex > 0
) {
- val previousIndex = DataIndex(currentFirstItemIndex.value - 1)
+ val previousIndex = currentFirstItemIndex - 1
val measuredItem = measuredItemProvider.getAndMeasure(previousIndex)
visibleItems.add(0, measuredItem)
maxCrossAxis = maxOf(maxCrossAxis, measuredItem.crossAxisSize)
@@ -305,7 +305,7 @@
return LazyListMeasureResult(
firstVisibleItem = firstItem,
firstVisibleItemScrollOffset = currentFirstItemScrollOffset,
- canScrollForward = index.value < itemsCount || currentMainAxisOffset > maxOffset,
+ canScrollForward = index < itemsCount || currentMainAxisOffset > maxOffset,
consumedScroll = consumedScroll,
measureResult = layout(layoutWidth, layoutHeight) {
positionedItems.fastForEach {
@@ -345,7 +345,7 @@
fun addItem(index: Int) {
if (list == null) list = mutableListOf()
requireNotNull(list).add(
- measuredItemProvider.getAndMeasure(DataIndex(index))
+ measuredItemProvider.getAndMeasure(index)
)
}
@@ -365,25 +365,25 @@
}
private fun createItemsBeforeList(
- currentFirstItemIndex: DataIndex,
+ currentFirstItemIndex: Int,
measuredItemProvider: LazyListMeasuredItemProvider,
beyondBoundsItemCount: Int,
pinnedItems: List<Int>
): List<LazyListMeasuredItem> {
var list: MutableList<LazyListMeasuredItem>? = null
- var start = currentFirstItemIndex.value
+ var start = currentFirstItemIndex
fun addItem(index: Int) {
if (list == null) list = mutableListOf()
requireNotNull(list).add(
- measuredItemProvider.getAndMeasure(DataIndex(index))
+ measuredItemProvider.getAndMeasure(index)
)
}
start = maxOf(0, start - beyondBoundsItemCount)
- for (i in currentFirstItemIndex.value - 1 downTo start) {
+ for (i in currentFirstItemIndex - 1 downTo start) {
addItem(i)
}
diff --git a/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/lazy/LazyListMeasuredItemProvider.kt b/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/lazy/LazyListMeasuredItemProvider.kt
index 38baf57..77ec076 100644
--- a/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/lazy/LazyListMeasuredItemProvider.kt
+++ b/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/lazy/LazyListMeasuredItemProvider.kt
@@ -43,10 +43,10 @@
* Used to subcompose items of lazy lists. Composed placeables will be measured with the
* correct constraints and wrapped into [LazyListMeasuredItem].
*/
- fun getAndMeasure(index: DataIndex): LazyListMeasuredItem {
- val key = itemProvider.getKey(index.value)
- val contentType = itemProvider.getContentType(index.value)
- val placeables = measureScope.measure(index.value, childConstraints)
+ fun getAndMeasure(index: Int): LazyListMeasuredItem {
+ val key = keyIndexMap.getKey(index) ?: itemProvider.getKey(index)
+ val contentType = itemProvider.getContentType(index)
+ val placeables = measureScope.measure(index, childConstraints)
return measuredItemFactory.createItem(index, key, contentType, placeables)
}
@@ -54,13 +54,13 @@
* Contains the mapping between the key and the index. It could contain not all the items of
* the list as an optimization.
**/
- val keyToIndexMap: LazyLayoutKeyIndexMap get() = itemProvider.keyToIndexMap
+ val keyIndexMap: LazyLayoutKeyIndexMap = itemProvider.keyIndexMap
}
// This interface allows to avoid autoboxing on index param
internal fun interface MeasuredItemFactory {
fun createItem(
- index: DataIndex,
+ index: Int,
key: Any,
contentType: Any?,
placeables: List<Placeable>
diff --git a/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/lazy/LazyListScrollPosition.kt b/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/lazy/LazyListScrollPosition.kt
index 4717a84..16eb1c7 100644
--- a/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/lazy/LazyListScrollPosition.kt
+++ b/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/lazy/LazyListScrollPosition.kt
@@ -19,7 +19,7 @@
import androidx.compose.foundation.ExperimentalFoundationApi
import androidx.compose.foundation.lazy.layout.findIndexByKey
import androidx.compose.runtime.getValue
-import androidx.compose.runtime.mutableStateOf
+import androidx.compose.runtime.mutableIntStateOf
import androidx.compose.runtime.setValue
import androidx.compose.runtime.snapshots.Snapshot
@@ -31,9 +31,9 @@
initialIndex: Int = 0,
initialScrollOffset: Int = 0
) {
- var index by mutableStateOf(DataIndex(initialIndex))
+ var index by mutableIntStateOf(initialIndex)
- var scrollOffset by mutableStateOf(initialScrollOffset)
+ var scrollOffset by mutableIntStateOf(initialScrollOffset)
private set
private var hadFirstNotEmptyLayout = false
@@ -56,7 +56,7 @@
Snapshot.withoutReadObservation {
update(
- DataIndex(measureResult.firstVisibleItem?.index ?: 0),
+ measureResult.firstVisibleItem?.index ?: 0,
scrollOffset
)
}
@@ -74,7 +74,7 @@
* c) there will be not enough items to fill the viewport after the requested index, so we
* would have to compose few elements before the asked index, changing the first visible item.
*/
- fun requestPosition(index: DataIndex, scrollOffset: Int) {
+ fun requestPosition(index: Int, scrollOffset: Int) {
update(index, scrollOffset)
// clear the stored key as we have a direct request to scroll to [index] position and the
// next [checkIfFirstVisibleItemWasMoved] shouldn't override this.
@@ -91,14 +91,14 @@
fun updateScrollPositionIfTheFirstItemWasMoved(itemProvider: LazyListItemProvider) {
Snapshot.withoutReadObservation {
update(
- DataIndex(itemProvider.findIndexByKey(lastKnownFirstItemKey, index.value)),
+ itemProvider.findIndexByKey(lastKnownFirstItemKey, index),
scrollOffset
)
}
}
- private fun update(index: DataIndex, scrollOffset: Int) {
- require(index.value >= 0f) { "Index should be non-negative (${index.value})" }
+ private fun update(index: Int, scrollOffset: Int) {
+ require(index >= 0f) { "Index should be non-negative ($index)" }
if (index != this.index) {
this.index = index
}
diff --git a/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/lazy/LazyListState.kt b/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/lazy/LazyListState.kt
index 1e5742f..3bd36be 100644
--- a/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/lazy/LazyListState.kt
+++ b/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/lazy/LazyListState.kt
@@ -103,7 +103,7 @@
* derived state in order to only have recompositions when the derived value changes:
* @sample androidx.compose.foundation.samples.UsingListScrollPositionInCompositionSample
*/
- val firstVisibleItemIndex: Int get() = scrollPosition.index.value
+ val firstVisibleItemIndex: Int get() = scrollPosition.index
/**
* The scroll offset of the first visible item. Scrolling forward is positive - i.e., the
@@ -245,7 +245,7 @@
}
internal fun snapToItemIndexInternal(index: Int, scrollOffset: Int) {
- scrollPosition.requestPosition(DataIndex(index), scrollOffset)
+ scrollPosition.requestPosition(index, scrollOffset)
// placement animation is not needed because we snap into a new position.
placementAnimator.reset()
remeasurement?.forceRemeasure()
diff --git a/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/lazy/grid/ItemIndex.kt b/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/lazy/grid/ItemIndex.kt
deleted file mode 100644
index 7207064..0000000
--- a/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/lazy/grid/ItemIndex.kt
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * Copyright 2021 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 androidx.compose.foundation.lazy.grid
-
-/**
- * Represents a line index in the lazy grid.
- */
-@Suppress("NOTHING_TO_INLINE")
-@kotlin.jvm.JvmInline
-internal value class LineIndex(val value: Int) {
- inline operator fun inc(): LineIndex = LineIndex(value + 1)
- inline operator fun dec(): LineIndex = LineIndex(value - 1)
- inline operator fun plus(i: Int): LineIndex = LineIndex(value + i)
- inline operator fun minus(i: Int): LineIndex = LineIndex(value - i)
- inline operator fun minus(i: LineIndex): LineIndex = LineIndex(value - i.value)
- inline operator fun compareTo(other: LineIndex): Int = value - other.value
-}
-
-/**
- * Represents an item index in the lazy grid.
- */
-@Suppress("NOTHING_TO_INLINE")
-@kotlin.jvm.JvmInline
-internal value class ItemIndex(val value: Int) {
- inline operator fun inc(): ItemIndex = ItemIndex(value + 1)
- inline operator fun dec(): ItemIndex = ItemIndex(value - 1)
- inline operator fun plus(i: Int): ItemIndex = ItemIndex(value + i)
- inline operator fun minus(i: Int): ItemIndex = ItemIndex(value - i)
- inline operator fun minus(i: ItemIndex): ItemIndex = ItemIndex(value - i.value)
- inline operator fun compareTo(other: ItemIndex): Int = value - other.value
-}
diff --git a/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/lazy/grid/LazyGrid.kt b/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/lazy/grid/LazyGrid.kt
index c752ea4..4f84478 100644
--- a/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/lazy/grid/LazyGrid.kt
+++ b/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/lazy/grid/LazyGrid.kt
@@ -286,26 +286,24 @@
spans = spans,
slots = resolvedSlots,
isVertical = isVertical,
- slotsPerLine = slotsPerLine,
- layoutDirection = layoutDirection,
mainAxisSpacing = mainAxisSpacing,
)
}
state.prefetchInfoRetriever = { line ->
- val lineConfiguration = spanLayoutProvider.getLineConfiguration(line.value)
- var index = ItemIndex(lineConfiguration.firstItemIndex)
+ val lineConfiguration = spanLayoutProvider.getLineConfiguration(line)
+ var index = lineConfiguration.firstItemIndex
var slot = 0
val result = ArrayList<Pair<Int, Constraints>>(lineConfiguration.spans.size)
lineConfiguration.spans.fastForEach {
val span = it.currentLineSpan
- result.add(index.value to measuredLineProvider.childConstraints(slot, span))
+ result.add(index to measuredLineProvider.childConstraints(slot, span))
++index
slot += span
}
result
}
- val firstVisibleLineIndex: LineIndex
+ val firstVisibleLineIndex: Int
val firstVisibleLineScrollOffset: Int
Snapshot.withoutReadObservation {
diff --git a/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/lazy/grid/LazyGridItemPlacementAnimator.kt b/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/lazy/grid/LazyGridItemPlacementAnimator.kt
index 2f36dec..fbd96ee 100644
--- a/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/lazy/grid/LazyGridItemPlacementAnimator.kt
+++ b/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/lazy/grid/LazyGridItemPlacementAnimator.kt
@@ -34,7 +34,7 @@
private val keyToItemInfoMap = mutableMapOf<Any, ItemInfo>()
// snapshot of the key to index map used for the last measuring.
- private var keyToIndexMap: LazyLayoutKeyIndexMap = LazyLayoutKeyIndexMap.Empty
+ private var keyIndexMap: LazyLayoutKeyIndexMap = LazyLayoutKeyIndexMap.Empty
// keeps the index of the first visible item index.
private var firstVisibleIndex = 0
@@ -68,8 +68,8 @@
val previousFirstVisibleIndex = firstVisibleIndex
firstVisibleIndex = positionedItems.firstOrNull()?.index ?: 0
- val previousKeyToIndexMap = keyToIndexMap
- keyToIndexMap = itemProvider.keyToIndexMap
+ val previousKeyToIndexMap = keyIndexMap
+ keyIndexMap = itemProvider.keyIndexMap
val mainAxisLayoutSize = if (isVertical) layoutHeight else layoutWidth
@@ -92,7 +92,7 @@
if (itemInfo == null) {
keyToItemInfoMap[item.key] =
ItemInfo(item.getCrossAxisSize(), item.getCrossAxisOffset())
- val previousIndex = previousKeyToIndexMap[item.key]
+ val previousIndex = previousKeyToIndexMap.getIndex(item.key)
if (previousIndex != -1 && item.index != previousIndex) {
if (previousIndex < previousFirstVisibleIndex) {
// the larger index will be in the start of the list
@@ -125,7 +125,7 @@
var accumulatedOffset = 0
var previousLine = -1
var previousLineMainAxisSize = 0
- movingInFromStartBound.sortByDescending { previousKeyToIndexMap[it.key] }
+ movingInFromStartBound.sortByDescending { previousKeyToIndexMap.getIndex(it.key) }
movingInFromStartBound.fastForEach { item ->
val line = if (isVertical) item.row else item.column
if (line != -1 && line == previousLine) {
@@ -142,7 +142,7 @@
accumulatedOffset = 0
previousLine = -1
previousLineMainAxisSize = 0
- movingInFromEndBound.sortBy { previousKeyToIndexMap[it.key] }
+ movingInFromEndBound.sortBy { previousKeyToIndexMap.getIndex(it.key) }
movingInFromEndBound.fastForEach { item ->
val line = if (isVertical) item.row else item.column
if (line != -1 && line == previousLine) {
@@ -161,13 +161,13 @@
// found an item which was in our map previously but is not a part of the
// positionedItems now
val itemInfo = keyToItemInfoMap.getValue(key)
- val newIndex = keyToIndexMap[key]
+ val newIndex = keyIndexMap.getIndex(key)
if (newIndex == -1) {
keyToItemInfoMap.remove(key)
} else {
val item = itemProvider.getAndMeasure(
- ItemIndex(newIndex),
+ newIndex,
constraints = if (isVertical) {
Constraints.fixedWidth(itemInfo.crossAxisSize)
} else {
@@ -182,7 +182,7 @@
return@repeat
}
}
- if ((!inProgress && newIndex == previousKeyToIndexMap[key])) {
+ if ((!inProgress && newIndex == previousKeyToIndexMap.getIndex(key))) {
keyToItemInfoMap.remove(key)
} else {
if (newIndex < firstVisibleIndex) {
@@ -197,9 +197,9 @@
accumulatedOffset = 0
previousLine = -1
previousLineMainAxisSize = 0
- movingAwayToStartBound.sortByDescending { keyToIndexMap[it.key] }
+ movingAwayToStartBound.sortByDescending { keyIndexMap.getIndex(it.key) }
movingAwayToStartBound.fastForEach { item ->
- val line = spanLayoutProvider.getLineIndexOfItem(item.index.value).value
+ val line = spanLayoutProvider.getLineIndexOfItem(item.index)
if (line != -1 && line == previousLine) {
previousLineMainAxisSize = maxOf(previousLineMainAxisSize, item.mainAxisSize)
} else {
@@ -225,9 +225,9 @@
accumulatedOffset = 0
previousLine = -1
previousLineMainAxisSize = 0
- movingAwayToEndBound.sortBy { keyToIndexMap[it.key] }
+ movingAwayToEndBound.sortBy { keyIndexMap.getIndex(it.key) }
movingAwayToEndBound.fastForEach { item ->
- val line = spanLayoutProvider.getLineIndexOfItem(item.index.value).value
+ val line = spanLayoutProvider.getLineIndexOfItem(item.index)
if (line != -1 && line == previousLine) {
previousLineMainAxisSize = maxOf(previousLineMainAxisSize, item.mainAxisSize)
} else {
@@ -264,7 +264,7 @@
*/
fun reset() {
keyToItemInfoMap.clear()
- keyToIndexMap = LazyLayoutKeyIndexMap.Empty
+ keyIndexMap = LazyLayoutKeyIndexMap.Empty
firstVisibleIndex = -1
}
diff --git a/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/lazy/grid/LazyGridItemProvider.kt b/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/lazy/grid/LazyGridItemProvider.kt
index 2cd5f0a7..95c2af3 100644
--- a/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/lazy/grid/LazyGridItemProvider.kt
+++ b/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/lazy/grid/LazyGridItemProvider.kt
@@ -19,7 +19,7 @@
import androidx.compose.foundation.ExperimentalFoundationApi
import androidx.compose.foundation.lazy.layout.LazyLayoutItemProvider
import androidx.compose.foundation.lazy.layout.LazyLayoutKeyIndexMap
-import androidx.compose.foundation.lazy.layout.PinnableItem
+import androidx.compose.foundation.lazy.layout.LazyLayoutPinnableItem
import androidx.compose.foundation.lazy.layout.NearestRangeKeyIndexMapState
import androidx.compose.runtime.Composable
import androidx.compose.runtime.derivedStateOf
@@ -30,7 +30,7 @@
@ExperimentalFoundationApi
internal interface LazyGridItemProvider : LazyLayoutItemProvider {
- val keyToIndexMap: LazyLayoutKeyIndexMap
+ val keyIndexMap: LazyLayoutKeyIndexMap
val spanLayoutProvider: LazyGridSpanLayoutProvider
}
@@ -58,7 +58,7 @@
LazyGridIntervalContent(latestContent())
}
- override val keyToIndexMap: LazyLayoutKeyIndexMap by NearestRangeKeyIndexMapState(
+ override val keyIndexMap: LazyLayoutKeyIndexMap by NearestRangeKeyIndexMapState(
firstVisibleItemIndex = { state.firstVisibleItemIndex },
slidingWindowSize = { NearestItemsSlidingWindowSize },
extraItemCount = { NearestItemsExtraItemCount },
@@ -67,15 +67,15 @@
override val itemCount: Int get() = gridContent.itemCount
- override fun getKey(index: Int): Any = gridContent.getKey(index)
+ override fun getKey(index: Int): Any = keyIndexMap.getKey(index) ?: gridContent.getKey(index)
override fun getContentType(index: Int): Any? = gridContent.getContentType(index)
@Composable
- override fun Item(index: Int) {
- gridContent.PinnableItem(index, state.pinnedItems) { localIndex ->
- with(LazyGridItemScopeImpl) {
- item(localIndex)
+ override fun Item(index: Int, key: Any) {
+ LazyLayoutPinnableItem(key, index, state.pinnedItems) {
+ gridContent.withInterval(index) { localIndex, content ->
+ content.item(LazyGridItemScopeImpl, localIndex)
}
}
}
@@ -83,7 +83,7 @@
override val spanLayoutProvider: LazyGridSpanLayoutProvider
get() = gridContent.spanLayoutProvider
- override fun getIndex(key: Any): Int = keyToIndexMap[key]
+ override fun getIndex(key: Any): Int = keyIndexMap.getIndex(key)
}
/**
diff --git a/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/lazy/grid/LazyGridMeasure.kt b/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/lazy/grid/LazyGridMeasure.kt
index a2a11fe..d5fa3ec 100644
--- a/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/lazy/grid/LazyGridMeasure.kt
+++ b/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/lazy/grid/LazyGridMeasure.kt
@@ -47,7 +47,7 @@
beforeContentPadding: Int,
afterContentPadding: Int,
spaceBetweenLines: Int,
- firstVisibleLineIndex: LineIndex,
+ firstVisibleLineIndex: Int,
firstVisibleLineScrollOffset: Int,
scrollToBeConsumed: Float,
constraints: Constraints,
@@ -92,7 +92,7 @@
currentFirstLineScrollOffset -= scrollDelta
// if the current scroll offset is less than minimally possible
- if (currentFirstLineIndex == LineIndex(0) && currentFirstLineScrollOffset < 0) {
+ if (currentFirstLineIndex == 0 && currentFirstLineScrollOffset < 0) {
scrollDelta += currentFirstLineScrollOffset
currentFirstLineScrollOffset = 0
}
@@ -112,8 +112,8 @@
// we had scrolled backward or we compose items in the start padding area, which means
// items before current firstLineScrollOffset should be visible. compose them and update
// firstLineScrollOffset
- while (currentFirstLineScrollOffset < 0 && currentFirstLineIndex > LineIndex(0)) {
- val previous = LineIndex(currentFirstLineIndex.value - 1)
+ while (currentFirstLineScrollOffset < 0 && currentFirstLineIndex > 0) {
+ val previous = currentFirstLineIndex - 1
val measuredLine = measuredLineProvider.getAndMeasure(previous)
visibleLines.add(0, measuredLine)
currentFirstLineScrollOffset += measuredLine.mainAxisSizeWithSpacings
@@ -143,7 +143,7 @@
// then composing visible lines forward until we fill the whole viewport.
// we want to have at least one line in visibleItems even if in fact all the items are
// offscreen, this can happen if the content padding is larger than the available size.
- while (index.value < itemsCount &&
+ while (index < itemsCount &&
(currentMainAxisOffset < maxMainAxis ||
currentMainAxisOffset <= 0 || // filling beforeContentPadding area
visibleLines.isEmpty())
@@ -155,7 +155,7 @@
currentMainAxisOffset += measuredLine.mainAxisSizeWithSpacings
if (currentMainAxisOffset <= minOffset &&
- measuredLine.items.last().index.value != itemsCount - 1) {
+ measuredLine.items.last().index != itemsCount - 1) {
// this line is offscreen and will not be placed. advance firstVisibleLineIndex
currentFirstLineIndex = index + 1
currentFirstLineScrollOffset -= measuredLine.mainAxisSizeWithSpacings
@@ -172,9 +172,9 @@
currentFirstLineScrollOffset -= toScrollBack
currentMainAxisOffset += toScrollBack
while (currentFirstLineScrollOffset < beforeContentPadding &&
- currentFirstLineIndex > LineIndex(0)
+ currentFirstLineIndex > 0
) {
- val previousIndex = LineIndex(currentFirstLineIndex.value - 1)
+ val previousIndex = currentFirstLineIndex - 1
val measuredLine = measuredLineProvider.getAndMeasure(previousIndex)
visibleLines.add(0, measuredLine)
currentFirstLineScrollOffset += measuredLine.mainAxisSizeWithSpacings
@@ -205,8 +205,8 @@
val visibleLinesScrollOffset = -currentFirstLineScrollOffset
var firstLine = visibleLines.first()
- val firstItemIndex = firstLine.items.firstOrNull()?.index?.value ?: 0
- val lastItemIndex = visibleLines.lastOrNull()?.items?.lastOrNull()?.index?.value ?: 0
+ val firstItemIndex = firstLine.items.firstOrNull()?.index ?: 0
+ val lastItemIndex = visibleLines.lastOrNull()?.items?.lastOrNull()?.index ?: 0
val extraItemsBefore = calculateExtraItems(
pinnedItems,
measuredItemProvider,
@@ -304,17 +304,16 @@
private inline fun calculateExtraItems(
pinnedItems: List<Int>,
measuredItemProvider: LazyGridMeasuredItemProvider,
- itemConstraints: (ItemIndex) -> Constraints,
+ itemConstraints: (Int) -> Constraints,
filter: (Int) -> Boolean
): List<LazyGridMeasuredItem> {
var items: MutableList<LazyGridMeasuredItem>? = null
pinnedItems.fastForEach { index ->
if (filter(index)) {
- val itemIndex = ItemIndex(index)
- val constraints = itemConstraints(itemIndex)
+ val constraints = itemConstraints(index)
val measuredItem = measuredItemProvider.getAndMeasure(
- itemIndex,
+ index,
constraints = constraints
)
if (items == null) {
diff --git a/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/lazy/grid/LazyGridMeasuredItem.kt b/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/lazy/grid/LazyGridMeasuredItem.kt
index 9db0fd0..74a6896 100644
--- a/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/lazy/grid/LazyGridMeasuredItem.kt
+++ b/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/lazy/grid/LazyGridMeasuredItem.kt
@@ -28,7 +28,7 @@
* if the user emit multiple layout nodes in the item callback.
*/
internal class LazyGridMeasuredItem(
- val index: ItemIndex,
+ val index: Int,
val key: Any,
private val isVertical: Boolean,
/**
@@ -101,7 +101,7 @@
} else {
IntOffset(mainAxisOffset, crossAxisOffset)
},
- index = index.value,
+ index = index,
key = key,
row = row,
column = column,
diff --git a/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/lazy/grid/LazyGridMeasuredItemProvider.kt b/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/lazy/grid/LazyGridMeasuredItemProvider.kt
index ae9a1d8e..c984631 100644
--- a/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/lazy/grid/LazyGridMeasuredItemProvider.kt
+++ b/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/lazy/grid/LazyGridMeasuredItemProvider.kt
@@ -37,13 +37,13 @@
* with the provided [constraints] and wrapped into [LazyGridMeasuredItem].
*/
fun getAndMeasure(
- index: ItemIndex,
+ index: Int,
mainAxisSpacing: Int = defaultMainAxisSpacing,
constraints: Constraints
): LazyGridMeasuredItem {
- val key = itemProvider.getKey(index.value)
- val contentType = itemProvider.getContentType(index.value)
- val placeables = measureScope.measure(index.value, constraints)
+ val key = keyIndexMap.getKey(index) ?: itemProvider.getKey(index)
+ val contentType = itemProvider.getContentType(index)
+ val placeables = measureScope.measure(index, constraints)
val crossAxisSize = if (constraints.hasFixedWidth) {
constraints.minWidth
} else {
@@ -64,13 +64,13 @@
* Contains the mapping between the key and the index. It could contain not all the items of
* the list as an optimization.
**/
- val keyToIndexMap: LazyLayoutKeyIndexMap get() = itemProvider.keyToIndexMap
+ val keyIndexMap: LazyLayoutKeyIndexMap = itemProvider.keyIndexMap
}
// This interface allows to avoid autoboxing on index param
internal fun interface MeasuredItemFactory {
fun createItem(
- index: ItemIndex,
+ index: Int,
key: Any,
contentType: Any?,
crossAxisSize: Int,
diff --git a/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/lazy/grid/LazyGridMeasuredLine.kt b/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/lazy/grid/LazyGridMeasuredLine.kt
index b70f8bf..0b3f5e0 100644
--- a/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/lazy/grid/LazyGridMeasuredLine.kt
+++ b/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/lazy/grid/LazyGridMeasuredLine.kt
@@ -17,7 +17,6 @@
package androidx.compose.foundation.lazy.grid
import androidx.compose.foundation.ExperimentalFoundationApi
-import androidx.compose.ui.unit.LayoutDirection
/**
* Represents one measured line of the lazy list. Each item on the line can in fact consist of
@@ -25,13 +24,11 @@
*/
@OptIn(ExperimentalFoundationApi::class)
internal class LazyGridMeasuredLine constructor(
- val index: LineIndex,
+ val index: Int,
val items: Array<LazyGridMeasuredItem>,
private val slots: LazyGridSlots,
private val spans: List<GridItemSpan>,
private val isVertical: Boolean,
- private val slotsPerLine: Int,
- private val layoutDirection: LayoutDirection,
/**
* Spacing to be added after [mainAxisSize], in the main axis direction.
*/
@@ -80,8 +77,8 @@
crossAxisOffset = slots.positions[startSlot],
layoutWidth = layoutWidth,
layoutHeight = layoutHeight,
- row = if (isVertical) index.value else startSlot,
- column = if (isVertical) startSlot else index.value
+ row = if (isVertical) index else startSlot,
+ column = if (isVertical) startSlot else index
).also {
usedSpan += span
}
diff --git a/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/lazy/grid/LazyGridMeasuredLineProvider.kt b/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/lazy/grid/LazyGridMeasuredLineProvider.kt
index f0d8250..fe5ff54 100644
--- a/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/lazy/grid/LazyGridMeasuredLineProvider.kt
+++ b/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/lazy/grid/LazyGridMeasuredLineProvider.kt
@@ -48,9 +48,9 @@
}
}
- fun itemConstraints(itemIndex: ItemIndex): Constraints {
+ fun itemConstraints(itemIndex: Int): Constraints {
val span = spanLayoutProvider.spanOf(
- itemIndex.value,
+ itemIndex,
spanLayoutProvider.slotsPerLine
)
return childConstraints(0, span)
@@ -60,8 +60,8 @@
* Used to subcompose items on lines of lazy grids. Composed placeables will be measured
* with the correct constraints and wrapped into [LazyGridMeasuredLine].
*/
- fun getAndMeasure(lineIndex: LineIndex): LazyGridMeasuredLine {
- val lineConfiguration = spanLayoutProvider.getLineConfiguration(lineIndex.value)
+ fun getAndMeasure(lineIndex: Int): LazyGridMeasuredLine {
+ val lineConfiguration = spanLayoutProvider.getLineConfiguration(lineIndex)
val lineItemsCount = lineConfiguration.spans.size
// we add space between lines as an extra spacing for all lines apart from the last one
@@ -78,7 +78,7 @@
val span = lineConfiguration.spans[it].currentLineSpan
val constraints = childConstraints(startSlot, span)
measuredItemProvider.getAndMeasure(
- ItemIndex(lineConfiguration.firstItemIndex + it),
+ lineConfiguration.firstItemIndex + it,
mainAxisSpacing,
constraints
).also { startSlot += span }
@@ -95,14 +95,14 @@
* Contains the mapping between the key and the index. It could contain not all the items of
* the list as an optimization.
**/
- val keyToIndexMap: LazyLayoutKeyIndexMap get() = measuredItemProvider.keyToIndexMap
+ val keyIndexMap: LazyLayoutKeyIndexMap get() = measuredItemProvider.keyIndexMap
}
// This interface allows to avoid autoboxing on index param
@OptIn(ExperimentalFoundationApi::class)
internal fun interface MeasuredLineFactory {
fun createLine(
- index: LineIndex,
+ index: Int,
items: Array<LazyGridMeasuredItem>,
spans: List<GridItemSpan>,
mainAxisSpacing: Int
diff --git a/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/lazy/grid/LazyGridScrollPosition.kt b/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/lazy/grid/LazyGridScrollPosition.kt
index 32575e7..7b19619 100644
--- a/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/lazy/grid/LazyGridScrollPosition.kt
+++ b/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/lazy/grid/LazyGridScrollPosition.kt
@@ -19,7 +19,7 @@
import androidx.compose.foundation.ExperimentalFoundationApi
import androidx.compose.foundation.lazy.layout.findIndexByKey
import androidx.compose.runtime.getValue
-import androidx.compose.runtime.mutableStateOf
+import androidx.compose.runtime.mutableIntStateOf
import androidx.compose.runtime.setValue
import androidx.compose.runtime.snapshots.Snapshot
@@ -32,10 +32,10 @@
initialIndex: Int = 0,
initialScrollOffset: Int = 0
) {
- var index by mutableStateOf(ItemIndex(initialIndex))
+ var index by mutableIntStateOf(initialIndex)
private set
- var scrollOffset by mutableStateOf(initialScrollOffset)
+ var scrollOffset by mutableIntStateOf(initialScrollOffset)
private set
private var hadFirstNotEmptyLayout = false
@@ -58,9 +58,7 @@
Snapshot.withoutReadObservation {
update(
- ItemIndex(
- measureResult.firstVisibleLine?.items?.firstOrNull()?.index?.value ?: 0
- ),
+ measureResult.firstVisibleLine?.items?.firstOrNull()?.index ?: 0,
scrollOffset
)
}
@@ -78,7 +76,7 @@
* c) there will be not enough items to fill the viewport after the requested index, so we
* would have to compose few elements before the asked index, changing the first visible item.
*/
- fun requestPosition(index: ItemIndex, scrollOffset: Int) {
+ fun requestPosition(index: Int, scrollOffset: Int) {
update(index, scrollOffset)
// clear the stored key as we have a direct request to scroll to [index] position and the
// next [checkIfFirstVisibleItemWasMoved] shouldn't override this.
@@ -94,14 +92,14 @@
fun updateScrollPositionIfTheFirstItemWasMoved(itemProvider: LazyGridItemProvider) {
Snapshot.withoutReadObservation {
update(
- ItemIndex(itemProvider.findIndexByKey(lastKnownFirstItemKey, index.value)),
+ itemProvider.findIndexByKey(lastKnownFirstItemKey, index),
scrollOffset
)
}
}
- private fun update(index: ItemIndex, scrollOffset: Int) {
- require(index.value >= 0f) { "Index should be non-negative (${index.value})" }
+ private fun update(index: Int, scrollOffset: Int) {
+ require(index >= 0f) { "Index should be non-negative ($index)" }
if (index != this.index) {
this.index = index
}
diff --git a/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/lazy/grid/LazyGridSpanLayoutProvider.kt b/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/lazy/grid/LazyGridSpanLayoutProvider.kt
index c5c802a..ac6ac2a 100644
--- a/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/lazy/grid/LazyGridSpanLayoutProvider.kt
+++ b/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/lazy/grid/LazyGridSpanLayoutProvider.kt
@@ -167,13 +167,13 @@
/**
* Calculate the line of index [itemIndex].
*/
- fun getLineIndexOfItem(itemIndex: Int): LineIndex {
+ fun getLineIndexOfItem(itemIndex: Int): Int {
if (totalSize <= 0) {
- return LineIndex(0)
+ return 0
}
require(itemIndex < totalSize)
if (!gridContent.hasCustomSpans) {
- return LineIndex(itemIndex / slotsPerLine)
+ return itemIndex / slotsPerLine
}
val lowerBoundBucket = buckets.binarySearch { it.firstItemIndex - itemIndex }.let {
@@ -207,7 +207,7 @@
++currentLine
}
- return LineIndex(currentLine)
+ return currentLine
}
fun spanOf(itemIndex: Int, maxSpan: Int): Int =
diff --git a/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/lazy/grid/LazyGridState.kt b/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/lazy/grid/LazyGridState.kt
index b2115d2..193dfe2 100644
--- a/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/lazy/grid/LazyGridState.kt
+++ b/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/lazy/grid/LazyGridState.kt
@@ -32,6 +32,7 @@
import androidx.compose.runtime.Stable
import androidx.compose.runtime.collection.mutableVectorOf
import androidx.compose.runtime.getValue
+import androidx.compose.runtime.mutableIntStateOf
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.saveable.Saver
import androidx.compose.runtime.saveable.listSaver
@@ -104,7 +105,7 @@
* derived state in order to only have recompositions when the derived value changes:
* @sample androidx.compose.foundation.samples.UsingGridScrollPositionInCompositionSample
*/
- val firstVisibleItemIndex: Int get() = scrollPosition.index.value
+ val firstVisibleItemIndex: Int get() = scrollPosition.index
/**
* The scroll offset of the first visible item. Scrolling forward is positive - i.e., the
@@ -149,7 +150,7 @@
/**
* Needed for [animateScrollToItem]. Updated on every measure.
*/
- internal var slotsPerLine: Int by mutableStateOf(0)
+ internal var slotsPerLine: Int by mutableIntStateOf(0)
/**
* Needed for [animateScrollToItem]. Updated on every measure.
@@ -221,7 +222,7 @@
/**
* Finds items on a line and their measurement constraints. Used for prefetching.
*/
- internal var prefetchInfoRetriever: (line: LineIndex) -> List<Pair<Int, Constraints>> by
+ internal var prefetchInfoRetriever: (line: Int) -> List<Pair<Int, Constraints>> by
mutableStateOf({ emptyList() })
internal val placementAnimator = LazyGridItemPlacementAnimator()
@@ -255,7 +256,7 @@
}
internal fun snapToItemIndexInternal(index: Int, scrollOffset: Int) {
- scrollPosition.requestPosition(ItemIndex(index), scrollOffset)
+ scrollPosition.requestPosition(index, scrollOffset)
// placement animation is not needed because we snap into a new position.
placementAnimator.reset()
remeasurement?.forceRemeasure()
@@ -359,7 +360,7 @@
this.wasScrollingForward = scrollingForward
this.lineToPrefetch = lineToPrefetch
currentLinePrefetchHandles.clear()
- prefetchInfoRetriever(LineIndex(lineToPrefetch)).fastForEach {
+ prefetchInfoRetriever(lineToPrefetch).fastForEach {
currentLinePrefetchHandles.add(
prefetchState.schedulePrefetch(it.first, it.second)
)
@@ -414,7 +415,7 @@
layoutInfoState.value = result
canScrollForward = result.canScrollForward
- canScrollBackward = (result.firstVisibleLine?.index?.value ?: 0) != 0 ||
+ canScrollBackward = (result.firstVisibleLine?.index ?: 0) != 0 ||
result.firstVisibleLineScrollOffset != 0
numMeasurePasses++
diff --git a/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/lazy/layout/LazyLayoutIntervalContent.kt b/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/lazy/layout/LazyLayoutIntervalContent.kt
index aeb9028..90665f1 100644
--- a/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/lazy/layout/LazyLayoutIntervalContent.kt
+++ b/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/lazy/layout/LazyLayoutIntervalContent.kt
@@ -17,7 +17,6 @@
package androidx.compose.foundation.lazy.layout
import androidx.compose.foundation.ExperimentalFoundationApi
-import androidx.compose.runtime.Composable
/**
* Common parts backing the interval-based content of lazy layout defined through `item` DSL.
@@ -26,24 +25,37 @@
abstract class LazyLayoutIntervalContent<Interval : LazyLayoutIntervalContent.Interval> {
abstract val intervals: IntervalList<Interval>
+ /**
+ * The total amount of items in all the intervals.
+ */
val itemCount: Int get() = intervals.size
+ /**
+ * Returns item key based on a global index.
+ */
fun getKey(index: Int): Any =
- withLocalIntervalIndex(index) { localIndex, content ->
+ withInterval(index) { localIndex, content ->
content.key?.invoke(localIndex) ?: getDefaultLazyLayoutKey(index)
}
+ /**
+ * Returns content type based on a global index.
+ */
fun getContentType(index: Int): Any? =
- withLocalIntervalIndex(index) { localIndex, content ->
+ withInterval(index) { localIndex, content ->
content.type.invoke(localIndex)
}
- private inline fun <T> withLocalIntervalIndex(
- index: Int,
- block: (localIndex: Int, content: Interval) -> T
+ /**
+ * Runs a [block] on the content of the interval associated with the provided [globalIndex]
+ * with providing a local index in the given interval.
+ */
+ inline fun <T> withInterval(
+ globalIndex: Int,
+ block: (localIntervalIndex: Int, content: Interval) -> T
): T {
- val interval = intervals[index]
- val localIntervalIndex = index - interval.startIndex
+ val interval = intervals[globalIndex]
+ val localIntervalIndex = globalIndex - interval.startIndex
return block(localIntervalIndex, interval.value)
}
@@ -63,25 +75,3 @@
val type: ((index: Int) -> Any?) get() = { null }
}
}
-
-/**
- * Defines a composable content of item in a lazy layout to support focus pinning.
- * See [LazyLayoutPinnableItem] for more details.
- */
-@ExperimentalFoundationApi
-@Composable
-fun <T : LazyLayoutIntervalContent.Interval> LazyLayoutIntervalContent<T>.PinnableItem(
- index: Int,
- pinnedItemList: LazyLayoutPinnedItemList,
- content: @Composable T.(index: Int) -> Unit
-) {
- val interval = intervals[index]
- val localIndex = index - interval.startIndex
- LazyLayoutPinnableItem(
- interval.value.key?.invoke(localIndex),
- index,
- pinnedItemList
- ) {
- interval.value.content(localIndex)
- }
-}
\ No newline at end of file
diff --git a/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/lazy/layout/LazyLayoutItemContentFactory.kt b/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/lazy/layout/LazyLayoutItemContentFactory.kt
index 9b61189..0b3039b 100644
--- a/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/lazy/layout/LazyLayoutItemContentFactory.kt
+++ b/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/lazy/layout/LazyLayoutItemContentFactory.kt
@@ -22,7 +22,7 @@
import androidx.compose.runtime.ReusableContentHost
import androidx.compose.runtime.Stable
import androidx.compose.runtime.getValue
-import androidx.compose.runtime.mutableStateOf
+import androidx.compose.runtime.mutableIntStateOf
import androidx.compose.runtime.saveable.SaveableStateHolder
import androidx.compose.runtime.setValue
@@ -84,7 +84,7 @@
val key: Any,
val type: Any?
) {
- var lastKnownIndex by mutableStateOf(initialIndex)
+ var lastKnownIndex by mutableIntStateOf(initialIndex)
private set
private var _content: (@Composable () -> Unit)? = null
@@ -93,15 +93,20 @@
private fun createContentLambda() = @Composable {
val itemProvider = itemProvider()
- val index = itemProvider.findIndexByKey(key, lastKnownIndex).also {
- lastKnownIndex = it
+
+ var index = lastKnownIndex
+ if (index >= itemProvider.itemCount || itemProvider.getKey(index) != key) {
+ index = itemProvider.getIndex(key)
+ if (index != -1) lastKnownIndex = index
}
- val indexIsUpToDate =
- index < itemProvider.itemCount && itemProvider.getKey(index) == key
- ReusableContentHost(active = indexIsUpToDate) {
- StableSaveProvider(StableValue(saveableStateHolder), StableValue(key)) {
- itemProvider.Item(index)
- }
+
+ ReusableContentHost(active = index != -1) {
+ SkippableItem(
+ itemProvider,
+ StableValue(saveableStateHolder),
+ index,
+ StableValue(key)
+ )
}
DisposableEffect(key) {
onDispose {
@@ -118,14 +123,18 @@
private value class StableValue<T>(val value: T)
/**
- * Hack around skippable functions to force restart for unstable saveable state holder that uses
- * [Any] as key.
+ * Hack around skippable functions to force skip SaveableStateProvider and Item block when
+ * nothing changed. It allows us to skip heavy-weight composition local providers.
*/
+@OptIn(ExperimentalFoundationApi::class)
@Composable
-private fun StableSaveProvider(
+private fun SkippableItem(
+ itemProvider: LazyLayoutItemProvider,
saveableStateHolder: StableValue<SaveableStateHolder>,
- key: StableValue<Any>,
- content: @Composable () -> Unit
+ index: Int,
+ key: StableValue<Any>
) {
- saveableStateHolder.value.SaveableStateProvider(key.value, content)
+ saveableStateHolder.value.SaveableStateProvider(key.value) {
+ itemProvider.Item(index, key.value)
+ }
}
diff --git a/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/lazy/layout/LazyLayoutItemProvider.kt b/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/lazy/layout/LazyLayoutItemProvider.kt
index 98a6b0a..9498578 100644
--- a/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/lazy/layout/LazyLayoutItemProvider.kt
+++ b/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/lazy/layout/LazyLayoutItemProvider.kt
@@ -34,10 +34,10 @@
val itemCount: Int
/**
- * The item for the given [index].
+ * The item for the given [index] and [key].
*/
@Composable
- fun Item(index: Int)
+ fun Item(index: Int, key: Any)
/**
* Returns the content type for the item on this index. It is used to improve the item
diff --git a/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/lazy/layout/LazyLayoutKeyIndexMap.kt b/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/lazy/layout/LazyLayoutKeyIndexMap.kt
index c46335a..a6485ee 100644
--- a/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/lazy/layout/LazyLayoutKeyIndexMap.kt
+++ b/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/lazy/layout/LazyLayoutKeyIndexMap.kt
@@ -33,14 +33,20 @@
/**
* @return current index for given [key] or `-1` if not found.
*/
- operator fun get(key: Any): Int
+ fun getIndex(key: Any): Int
+
+ /**
+ * @return key for a given [index] if it is known, or null otherwise.
+ */
+ fun getKey(index: Int): Any?
/**
* Empty map implementation, always returning `-1` for any key.
*/
companion object Empty : LazyLayoutKeyIndexMap {
@Suppress("AutoBoxing")
- override fun get(key: Any): Int = -1
+ override fun getIndex(key: Any): Int = -1
+ override fun getKey(index: Int) = null
}
}
@@ -90,44 +96,55 @@
nearestRange: IntRange,
content: LazyLayoutIntervalContent<*>
) : LazyLayoutKeyIndexMap {
- private val map = generateKeyToIndexMap(nearestRange, content.intervals)
+ private val map: Map<Any, Int>
+ private val keys: Array<Any?>
+ private val keysStartIndex: Int
- override fun get(key: Any): Int = map.getOrElse(key) { -1 }
-
- companion object {
- /**
- * Traverses the interval [list] in order to create a mapping from the key to the index for all
- * the indexes in the passed [range].
- * The returned map will not contain the values for intervals with no key mapping provided.
- */
- private fun generateKeyToIndexMap(
- range: IntRange,
- list: IntervalList<LazyLayoutIntervalContent.Interval>
- ): Map<Any, Int> {
- val first = range.first
- check(first >= 0)
- val last = minOf(range.last, list.size - 1)
- return if (last < first) {
- emptyMap()
- } else {
- hashMapOf<Any, Int>().also { map ->
- list.forEach(
- fromIndex = first,
- toIndex = last,
- ) {
- if (it.value.key != null) {
- val keyFactory = requireNotNull(it.value.key)
- val start = maxOf(first, it.startIndex)
- val end = minOf(last, it.startIndex + it.size - 1)
- for (i in start..end) {
- map[keyFactory(i - it.startIndex)] = i
- }
+ init {
+ // Traverses the interval [list] in order to create a mapping from the key to the index for all
+ // the indexes in the passed [range].
+ // The returned map will not contain the values for intervals with no key mapping provided.
+ val list = content.intervals
+ val first = nearestRange.first
+ check(first >= 0)
+ val last = minOf(nearestRange.last, list.size - 1)
+ if (last < first) {
+ map = emptyMap()
+ keys = emptyArray()
+ keysStartIndex = 0
+ } else {
+ var tmpKeys = emptyArray<Any?>()
+ var tmpKeysStartIndex = 0
+ map = hashMapOf<Any, Int>().also { map ->
+ list.forEach(
+ fromIndex = first,
+ toIndex = last,
+ ) {
+ if (it.value.key != null) {
+ val keyFactory = requireNotNull(it.value.key)
+ val start = maxOf(first, it.startIndex)
+ if (tmpKeys.isEmpty()) {
+ tmpKeysStartIndex = start
+ tmpKeys = Array(last - start + 1) { null }
+ }
+ val end = minOf(last, it.startIndex + it.size - 1)
+ for (i in start..end) {
+ val key = keyFactory(i - it.startIndex)
+ map[key] = i
+ tmpKeys[i - tmpKeysStartIndex] = key
}
}
}
}
+ keys = tmpKeys
+ keysStartIndex = tmpKeysStartIndex
}
}
+
+ override fun getIndex(key: Any): Int = map.getOrElse(key) { -1 }
+
+ override fun getKey(index: Int) =
+ keys.getOrElse(index - keysStartIndex) { null }
}
/**
diff --git a/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/lazy/layout/LazyLayoutPinnableItem.kt b/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/lazy/layout/LazyLayoutPinnableItem.kt
index 768c234..680f8b5 100644
--- a/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/lazy/layout/LazyLayoutPinnableItem.kt
+++ b/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/lazy/layout/LazyLayoutPinnableItem.kt
@@ -21,6 +21,7 @@
import androidx.compose.runtime.CompositionLocalProvider
import androidx.compose.runtime.DisposableEffect
import androidx.compose.runtime.getValue
+import androidx.compose.runtime.mutableIntStateOf
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
import androidx.compose.runtime.setValue
@@ -101,13 +102,13 @@
/**
* Current index associated with this item.
*/
- override var index by mutableStateOf(-1)
+ override var index by mutableIntStateOf(-1)
/**
* It is a valid use case when users of this class call [pin] multiple times individually,
* so we want to do the unpinning only when all of the users called [release].
*/
- private var pinsCount by mutableStateOf(0)
+ private var pinsCount by mutableIntStateOf(0)
/**
* Handle associated with the current [parentPinnableContainer].
diff --git a/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/lazy/staggeredgrid/LazyStaggeredGridItemPlacementAnimator.kt b/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/lazy/staggeredgrid/LazyStaggeredGridItemPlacementAnimator.kt
index 11895ed..f9dec0d 100644
--- a/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/lazy/staggeredgrid/LazyStaggeredGridItemPlacementAnimator.kt
+++ b/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/lazy/staggeredgrid/LazyStaggeredGridItemPlacementAnimator.kt
@@ -34,7 +34,7 @@
private val keyToItemInfoMap = mutableMapOf<Any, ItemInfo>()
// snapshot of the key to index map used for the last measuring.
- private var keyToIndexMap: LazyLayoutKeyIndexMap = LazyLayoutKeyIndexMap
+ private var keyIndexMap: LazyLayoutKeyIndexMap = LazyLayoutKeyIndexMap
// keeps the index of the first visible item index.
private var firstVisibleIndex = 0
@@ -68,8 +68,8 @@
val previousFirstVisibleIndex = firstVisibleIndex
firstVisibleIndex = positionedItems.firstOrNull()?.index ?: 0
- val previousKeyToIndexMap = keyToIndexMap
- keyToIndexMap = itemProvider.keyToIndexMap
+ val previousKeyToIndexMap = keyIndexMap
+ keyIndexMap = itemProvider.keyIndexMap
val mainAxisLayoutSize = if (isVertical) layoutHeight else layoutWidth
@@ -92,7 +92,7 @@
if (itemInfo == null) {
keyToItemInfoMap[item.key] =
ItemInfo(item.lane, item.span, item.crossAxisOffset)
- val previousIndex = previousKeyToIndexMap[item.key]
+ val previousIndex = previousKeyToIndexMap.getIndex(item.key)
if (previousIndex != -1 && item.index != previousIndex) {
if (previousIndex < previousFirstVisibleIndex) {
// the larger index will be in the start of the list
@@ -125,7 +125,7 @@
val accumulatedOffsetPerLane = IntArray(laneCount) { 0 }
if (movingInFromStartBound.isNotEmpty()) {
- movingInFromStartBound.sortByDescending { previousKeyToIndexMap[it.key] }
+ movingInFromStartBound.sortByDescending { previousKeyToIndexMap.getIndex(it.key) }
movingInFromStartBound.fastForEach { item ->
accumulatedOffsetPerLane[item.lane] += item.mainAxisSize
val mainAxisOffset = 0 - accumulatedOffsetPerLane[item.lane]
@@ -135,7 +135,7 @@
accumulatedOffsetPerLane.fill(0)
}
if (movingInFromEndBound.isNotEmpty()) {
- movingInFromEndBound.sortBy { previousKeyToIndexMap[it.key] }
+ movingInFromEndBound.sortBy { previousKeyToIndexMap.getIndex(it.key) }
movingInFromEndBound.fastForEach { item ->
val mainAxisOffset = mainAxisLayoutSize + accumulatedOffsetPerLane[item.lane]
accumulatedOffsetPerLane[item.lane] += item.mainAxisSize
@@ -149,7 +149,7 @@
// found an item which was in our map previously but is not a part of the
// positionedItems now
val itemInfo = keyToItemInfoMap.getValue(key)
- val newIndex = keyToIndexMap[key]
+ val newIndex = keyIndexMap.getIndex(key)
if (newIndex == -1) {
keyToItemInfoMap.remove(key)
@@ -166,7 +166,7 @@
return@repeat
}
}
- if ((!inProgress && newIndex == previousKeyToIndexMap[key])) {
+ if ((!inProgress && newIndex == previousKeyToIndexMap.getIndex(key))) {
keyToItemInfoMap.remove(key)
} else {
if (newIndex < firstVisibleIndex) {
@@ -179,7 +179,7 @@
}
if (movingAwayToStartBound.isNotEmpty()) {
- movingAwayToStartBound.sortByDescending { keyToIndexMap[it.key] }
+ movingAwayToStartBound.sortByDescending { keyIndexMap.getIndex(it.key) }
movingAwayToStartBound.fastForEach { item ->
accumulatedOffsetPerLane[item.lane] += item.mainAxisSize
val mainAxisOffset = 0 - accumulatedOffsetPerLane[item.lane]
@@ -193,7 +193,7 @@
accumulatedOffsetPerLane.fill(0)
}
if (movingAwayToEndBound.isNotEmpty()) {
- movingAwayToEndBound.sortBy { keyToIndexMap[it.key] }
+ movingAwayToEndBound.sortBy { keyIndexMap.getIndex(it.key) }
movingAwayToEndBound.fastForEach { item ->
val mainAxisOffset = mainAxisLayoutSize + accumulatedOffsetPerLane[item.lane]
accumulatedOffsetPerLane[item.lane] += item.mainAxisSize
@@ -219,7 +219,7 @@
*/
fun reset() {
keyToItemInfoMap.clear()
- keyToIndexMap = LazyLayoutKeyIndexMap
+ keyIndexMap = LazyLayoutKeyIndexMap
firstVisibleIndex = -1
}
diff --git a/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/lazy/staggeredgrid/LazyStaggeredGridItemProvider.kt b/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/lazy/staggeredgrid/LazyStaggeredGridItemProvider.kt
index b54bd72..b76423c 100644
--- a/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/lazy/staggeredgrid/LazyStaggeredGridItemProvider.kt
+++ b/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/lazy/staggeredgrid/LazyStaggeredGridItemProvider.kt
@@ -19,7 +19,7 @@
import androidx.compose.foundation.ExperimentalFoundationApi
import androidx.compose.foundation.lazy.layout.LazyLayoutItemProvider
import androidx.compose.foundation.lazy.layout.LazyLayoutKeyIndexMap
-import androidx.compose.foundation.lazy.layout.PinnableItem
+import androidx.compose.foundation.lazy.layout.LazyLayoutPinnableItem
import androidx.compose.foundation.lazy.layout.NearestRangeKeyIndexMapState
import androidx.compose.runtime.Composable
import androidx.compose.runtime.derivedStateOf
@@ -31,7 +31,7 @@
@OptIn(ExperimentalFoundationApi::class)
internal interface LazyStaggeredGridItemProvider : LazyLayoutItemProvider {
val spanProvider: LazyStaggeredGridSpanProvider
- val keyToIndexMap: LazyLayoutKeyIndexMap
+ val keyIndexMap: LazyLayoutKeyIndexMap
}
@Composable
@@ -57,7 +57,7 @@
LazyStaggeredGridIntervalContent(latestContent())
}
- override val keyToIndexMap: LazyLayoutKeyIndexMap by NearestRangeKeyIndexMapState(
+ override val keyIndexMap: LazyLayoutKeyIndexMap by NearestRangeKeyIndexMapState(
firstVisibleItemIndex = { state.firstVisibleItemIndex },
slidingWindowSize = { 90 },
extraItemCount = { 200 },
@@ -66,17 +66,18 @@
override val itemCount: Int get() = staggeredGridContent.itemCount
- override fun getKey(index: Int): Any = staggeredGridContent.getKey(index)
+ override fun getKey(index: Int): Any =
+ keyIndexMap.getKey(index) ?: staggeredGridContent.getKey(index)
- override fun getIndex(key: Any): Int = keyToIndexMap[key]
+ override fun getIndex(key: Any): Int = keyIndexMap.getIndex(key)
override fun getContentType(index: Int): Any? = staggeredGridContent.getContentType(index)
@Composable
- override fun Item(index: Int) {
- staggeredGridContent.PinnableItem(index, state.pinnedItems) { localIndex ->
- with(LazyStaggeredGridItemScopeImpl) {
- item(localIndex)
+ override fun Item(index: Int, key: Any) {
+ LazyLayoutPinnableItem(key, index, state.pinnedItems) {
+ staggeredGridContent.withInterval(index) { localIndex, content ->
+ content.item(LazyStaggeredGridItemScopeImpl, localIndex)
}
}
}
diff --git a/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/lazy/staggeredgrid/LazyStaggeredGridMeasure.kt b/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/lazy/staggeredgrid/LazyStaggeredGridMeasure.kt
index 62c4e2c..d92ad20 100644
--- a/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/lazy/staggeredgrid/LazyStaggeredGridMeasure.kt
+++ b/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/lazy/staggeredgrid/LazyStaggeredGridMeasure.kt
@@ -1013,7 +1013,7 @@
}
fun getAndMeasure(index: Int, span: SpanRange): LazyStaggeredGridMeasuredItem {
- val key = itemProvider.getKey(index)
+ val key = keyIndexMap.getKey(index) ?: itemProvider.getKey(index)
val contentType = itemProvider.getContentType(index)
val placeables = measureScope.measure(index, childConstraints(span.start, span.size))
return measuredItemFactory.createItem(
@@ -1026,7 +1026,7 @@
)
}
- val keyToIndexMap: LazyLayoutKeyIndexMap get() = itemProvider.keyToIndexMap
+ val keyIndexMap: LazyLayoutKeyIndexMap = itemProvider.keyIndexMap
}
// This interface allows to avoid autoboxing on index param
diff --git a/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/pager/LazyLayoutPager.kt b/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/pager/LazyLayoutPager.kt
index 5d8d4093..d42eaed 100644
--- a/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/pager/LazyLayoutPager.kt
+++ b/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/pager/LazyLayoutPager.kt
@@ -32,9 +32,9 @@
import androidx.compose.foundation.lazy.layout.LazyLayoutIntervalContent
import androidx.compose.foundation.lazy.layout.LazyLayoutItemProvider
import androidx.compose.foundation.lazy.layout.LazyLayoutKeyIndexMap
+import androidx.compose.foundation.lazy.layout.LazyLayoutPinnableItem
import androidx.compose.foundation.lazy.layout.MutableIntervalList
import androidx.compose.foundation.lazy.layout.NearestRangeKeyIndexMapState
-import androidx.compose.foundation.lazy.layout.PinnableItem
import androidx.compose.foundation.lazy.layout.lazyLayoutSemantics
import androidx.compose.foundation.overscroll
import androidx.compose.runtime.Composable
@@ -199,15 +199,17 @@
get() = pagerContent.itemCount
@Composable
- override fun Item(index: Int) {
- pagerContent.PinnableItem(index, state.pinnedPages) { localIndex ->
- item(pagerScopeImpl, localIndex)
+ override fun Item(index: Int, key: Any) {
+ LazyLayoutPinnableItem(key, index, state.pinnedPages) {
+ pagerContent.withInterval(index) { localIndex, content ->
+ content.item(pagerScopeImpl, localIndex)
+ }
}
}
- override fun getKey(index: Int): Any = pagerContent.getKey(index)
+ override fun getKey(index: Int): Any = keyToIndexMap.getKey(index) ?: pagerContent.getKey(index)
- override fun getIndex(key: Any): Int = keyToIndexMap[key]
+ override fun getIndex(key: Any): Int = keyToIndexMap.getIndex(key)
}
@OptIn(ExperimentalFoundationApi::class)
diff --git a/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/pager/PagerScrollPosition.kt b/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/pager/PagerScrollPosition.kt
index cf2cb6b..cecb371 100644
--- a/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/pager/PagerScrollPosition.kt
+++ b/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/pager/PagerScrollPosition.kt
@@ -18,7 +18,7 @@
import androidx.compose.foundation.ExperimentalFoundationApi
import androidx.compose.runtime.getValue
-import androidx.compose.runtime.mutableStateOf
+import androidx.compose.runtime.mutableIntStateOf
import androidx.compose.runtime.setValue
import androidx.compose.runtime.snapshots.Snapshot
@@ -31,10 +31,10 @@
initialPage: Int = 0,
initialScrollOffset: Int = 0
) {
- var firstVisiblePage by mutableStateOf(initialPage)
- var currentPage by mutableStateOf(initialPage)
+ var firstVisiblePage by mutableIntStateOf(initialPage)
+ var currentPage by mutableIntStateOf(initialPage)
- var scrollOffset by mutableStateOf(initialScrollOffset)
+ var scrollOffset by mutableIntStateOf(initialScrollOffset)
private set
private var hadFirstNotEmptyLayout = false
diff --git a/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/pager/PagerState.kt b/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/pager/PagerState.kt
index 3e749b6..715fe0a 100644
--- a/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/pager/PagerState.kt
+++ b/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/pager/PagerState.kt
@@ -35,6 +35,8 @@
import androidx.compose.runtime.Stable
import androidx.compose.runtime.derivedStateOf
import androidx.compose.runtime.getValue
+import androidx.compose.runtime.mutableFloatStateOf
+import androidx.compose.runtime.mutableIntStateOf
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.saveable.Saver
import androidx.compose.runtime.saveable.listSaver
@@ -181,7 +183,7 @@
* Difference between the last up and last down events of a scroll event.
*/
internal var upDownDifference: Offset by mutableStateOf(Offset.Zero)
- internal var snapRemainingScrollOffset by mutableStateOf(0f)
+ internal var snapRemainingScrollOffset by mutableFloatStateOf(0f)
private val scrollPosition = PagerScrollPosition(initialPage, 0)
@@ -283,9 +285,9 @@
*/
val currentPage: Int get() = scrollPosition.currentPage
- private var animationTargetPage by mutableStateOf(-1)
+ private var animationTargetPage by mutableIntStateOf(-1)
- private var settledPageState by mutableStateOf(initialPage)
+ private var settledPageState by mutableIntStateOf(initialPage)
/**
* The page that is currently "settled". This is an animation/gesture unaware page in the sense
diff --git a/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/text/TextFieldScroll.kt b/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/text/TextFieldScroll.kt
index 0122d8e..e238c52 100644
--- a/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/text/TextFieldScroll.kt
+++ b/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/text/TextFieldScroll.kt
@@ -25,6 +25,7 @@
import androidx.compose.runtime.Stable
import androidx.compose.runtime.derivedStateOf
import androidx.compose.runtime.getValue
+import androidx.compose.runtime.mutableFloatStateOf
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
import androidx.compose.runtime.saveable.listSaver
@@ -250,13 +251,13 @@
* Taken with the opposite sign defines the x or y position of the text field in the
* horizontal or vertical scroller container correspondingly.
*/
- var offset by mutableStateOf(initial)
+ var offset by mutableFloatStateOf(initial)
/**
* Maximum length by which the text field can be scrolled. Defined as a difference in
* size between the scroller container and the text field.
*/
- var maximum by mutableStateOf(0f)
+ var maximum by mutableFloatStateOf(0f)
private set
/**
diff --git a/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/text/modifiers/TextStringSimpleNode.kt b/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/text/modifiers/TextStringSimpleNode.kt
index e046446..2496e86 100644
--- a/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/text/modifiers/TextStringSimpleNode.kt
+++ b/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/text/modifiers/TextStringSimpleNode.kt
@@ -73,7 +73,7 @@
private var minLines: Int = DefaultMinLines,
private var overrideColor: ColorProducer? = null
) : Modifier.Node(), LayoutModifierNode, DrawModifierNode, SemanticsModifierNode {
- private var baselineCache: Map<AlignmentLine, Int>? = null
+ private var baselineCache: MutableMap<AlignmentLine, Int>? = null
private var _layoutCache: ParagraphLayoutCache? = null
private val layoutCache: ParagraphLayoutCache
@@ -224,10 +224,13 @@
if (didChangeLayout) {
invalidateLayer()
- baselineCache = mapOf(
- FirstBaseline to paragraph.firstBaseline.roundToInt(),
- LastBaseline to paragraph.lastBaseline.roundToInt()
- )
+ var cache = baselineCache
+ if (cache == null) {
+ cache = LinkedHashMap(2)
+ }
+ cache[FirstBaseline] = paragraph.firstBaseline.roundToInt()
+ cache[LastBaseline] = paragraph.lastBaseline.roundToInt()
+ baselineCache = cache
}
// then allow children to measure _inside_ our final box, with the above placeholders
diff --git a/compose/integration-tests/demos/common/src/main/AndroidManifest.xml b/compose/integration-tests/demos/common/src/main/AndroidManifest.xml
deleted file mode 100644
index deac81d..0000000
--- a/compose/integration-tests/demos/common/src/main/AndroidManifest.xml
+++ /dev/null
@@ -1,17 +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.
- -->
-
-<manifest />
diff --git a/compose/integration-tests/docs-snippets/src/main/AndroidManifest.xml b/compose/integration-tests/docs-snippets/src/main/AndroidManifest.xml
deleted file mode 100644
index ae0be49..0000000
--- a/compose/integration-tests/docs-snippets/src/main/AndroidManifest.xml
+++ /dev/null
@@ -1,17 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
- ~ 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.
- -->
-<manifest />
diff --git a/compose/integration-tests/docs-snippets/src/main/java/androidx/compose/integration/docs/interoperability/Interoperability.kt b/compose/integration-tests/docs-snippets/src/main/java/androidx/compose/integration/docs/interoperability/Interoperability.kt
index 24e9aeb..6341378 100644
--- a/compose/integration-tests/docs-snippets/src/main/java/androidx/compose/integration/docs/interoperability/Interoperability.kt
+++ b/compose/integration-tests/docs-snippets/src/main/java/androidx/compose/integration/docs/interoperability/Interoperability.kt
@@ -48,7 +48,7 @@
import androidx.compose.runtime.DisposableEffect
import androidx.compose.runtime.State
import androidx.compose.runtime.getValue
-import androidx.compose.runtime.mutableStateOf
+import androidx.compose.runtime.mutableIntStateOf
import androidx.compose.runtime.remember
import androidx.compose.runtime.rememberUpdatedState
import androidx.compose.ui.Modifier
@@ -169,7 +169,7 @@
private object InteropSnippet5 {
@Composable
fun CustomView() {
- val selectedItem = remember { mutableStateOf(0) }
+ val selectedItem = remember { mutableIntStateOf(0) }
// Adds view to Compose
AndroidView(
diff --git a/compose/integration-tests/docs-snippets/src/main/java/androidx/compose/integration/docs/preview/LayoutPreview.kt b/compose/integration-tests/docs-snippets/src/main/java/androidx/compose/integration/docs/preview/LayoutPreview.kt
index 25c3edd..f75a353 100644
--- a/compose/integration-tests/docs-snippets/src/main/java/androidx/compose/integration/docs/preview/LayoutPreview.kt
+++ b/compose/integration-tests/docs-snippets/src/main/java/androidx/compose/integration/docs/preview/LayoutPreview.kt
@@ -24,7 +24,7 @@
import androidx.compose.material.ButtonDefaults.buttonColors
import androidx.compose.material.Text
import androidx.compose.runtime.Composable
-import androidx.compose.runtime.mutableStateOf
+import androidx.compose.runtime.mutableIntStateOf
import androidx.compose.runtime.remember
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.tooling.preview.Preview
@@ -88,12 +88,12 @@
@Preview
@Composable
fun PreviewCounter() {
- val counterState = remember { mutableStateOf(0) }
+ val counterState = remember { mutableIntStateOf(0) }
Counter(
- count = counterState.value,
+ count = counterState.intValue,
updateCount = { newCount ->
- counterState.value = newCount
+ counterState.intValue = newCount
}
)
}
diff --git a/compose/integration-tests/docs-snippets/src/main/java/androidx/compose/integration/docs/testing/Testing.kt b/compose/integration-tests/docs-snippets/src/main/java/androidx/compose/integration/docs/testing/Testing.kt
index 559f4b6..ab880fe 100644
--- a/compose/integration-tests/docs-snippets/src/main/java/androidx/compose/integration/docs/testing/Testing.kt
+++ b/compose/integration-tests/docs-snippets/src/main/java/androidx/compose/integration/docs/testing/Testing.kt
@@ -31,7 +31,9 @@
import androidx.compose.material.Text
import androidx.compose.runtime.Composable
import androidx.compose.runtime.collectAsState
-import androidx.compose.runtime.mutableStateOf
+import androidx.compose.runtime.getValue
+import androidx.compose.runtime.mutableIntStateOf
+import androidx.compose.runtime.setValue
import androidx.compose.ui.ExperimentalComposeUiApi
import androidx.compose.ui.Modifier
import androidx.compose.ui.input.key.KeyEvent
@@ -223,13 +225,13 @@
private object SyncSnippet {
@Test fun counterTest() {
- val myCounter = mutableStateOf(0) // State that can cause recompositions
+ var myCounter by mutableIntStateOf(0) // State that can cause recompositions
var lastSeenValue = 0 // Used to track recompositions
composeTestRule.setContent {
- Text(myCounter.value.toString())
- lastSeenValue = myCounter.value
+ Text(myCounter.toString())
+ lastSeenValue = myCounter
}
- myCounter.value = 1 // The state changes, but there is no recomposition
+ myCounter = 1 // The state changes, but there is no recomposition
// Fails because nothing triggered a recomposition
assertTrue(lastSeenValue == 1)
diff --git a/compose/integration-tests/macrobenchmark/src/androidTest/AndroidManifest.xml b/compose/integration-tests/macrobenchmark/src/androidTest/AndroidManifest.xml
deleted file mode 100644
index 5b41847..0000000
--- a/compose/integration-tests/macrobenchmark/src/androidTest/AndroidManifest.xml
+++ /dev/null
@@ -1,17 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
- ~ Copyright (C) 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.
- -->
-<manifest />
diff --git a/compose/integration-tests/macrobenchmark/src/main/AndroidManifest.xml b/compose/integration-tests/macrobenchmark/src/main/AndroidManifest.xml
deleted file mode 100644
index 5b41847..0000000
--- a/compose/integration-tests/macrobenchmark/src/main/AndroidManifest.xml
+++ /dev/null
@@ -1,17 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
- ~ Copyright (C) 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.
- -->
-<manifest />
diff --git a/compose/lint/common-test/src/main/java/androidx/compose/lint/test/Stubs.kt b/compose/lint/common-test/src/main/java/androidx/compose/lint/test/Stubs.kt
index 5c61695..47b7cad 100644
--- a/compose/lint/common-test/src/main/java/androidx/compose/lint/test/Stubs.kt
+++ b/compose/lint/common-test/src/main/java/androidx/compose/lint/test/Stubs.kt
@@ -516,14 +516,49 @@
"""
)
+ val StateFactoryMarker: TestFile = bytecodeStub(
+ filename = "StateFactoryMarker.kt",
+ filepath = "androidx/compose/runtime/snapshots",
+ checksum = 0x79ef0e9d,
+ source = """
+ package androidx.compose.runtime.snapshots
+
+ @MustBeDocumented
+ @Target(AnnotationTarget.FUNCTION)
+ @Retention(AnnotationRetention.BINARY)
+ annotation class StateFactoryMarker
+ """,
+ """
+ META-INF/main.kotlin_module:
+ H4sIAAAAAAAA/2NgYGBmYGBgBGIOBijgMueSSMxLKcrPTKnQS87PLcgvTtUr
+ Ks0rycxNFeIKSs1NzU1KLfIuEeIPzkssKM7ILwkuSSxJ9S7hUuOSwaVRLy0/
+ X4gtJLW4xLtEiUGLAQDM+x9weQAAAA==
+ """,
+ """
+ androidx/compose/runtime/snapshots/StateFactoryMarker.class:
+ H4sIAAAAAAAA/51STW/TQBB965AmBCgpUEhaSj8o6Q2XCsSBU9I2wlI+UJIi
+ oZy29qq4dryRdx2aW278Jw4o4siPQsw2IgnCAglZGr+ZefPxdvf7jy9fAbzE
+ AcMrHnmx9L0r25WDoVTCjpNI+wNhq4gP1Uepld3VXIs6d7WMx00eByLOgTEU
+ L/mI2yGPLuz2+aVwdQ4Zhu1FlEeRpFJfRnZ1DnPIMuw3AqlDP1qmNBOla+JE
+ uslARFp4bxg2Umg9Hl8ITclVHobyk/BmAZXedDF3Xpevn7WOe067xbCVUtER
+ msYTImp2xMNEMBz8tfNyxUrNaVU7Hxh2G6nn8Ju8nXTOcr/KPyjvZOi7Y7Pq
+ caPa7RpJqQVz9Xvp+dNQmLV646EwKpqnvbftE4a1X8KbQnOPa05JazDK0Oth
+ xuSNAQMLKH7lG++QkPeCoTyd5AtWySpYxc38t89WaTo5sg5ZbToxhCOG143/
+ enq0AQ1c/zPxPNAMha5MYlfU/ZCurdyZ9XvvK/88FIsbUxXaATeoz4rZn/Cz
+ a7uPCv0D5OgjcZS/2QcTKOAWbpN3R2AVd1Gk5NrMvYf7eGDgNW8dD/EIWZT6
+ yDgoO9hwsInHBLHl4Am2iaWwg90+LIU9hac/AcQycP6LAwAA
+ """
+ )
+
val SnapshotState: TestFile = bytecodeStub(
filename = "SnapshotState.kt",
filepath = "androidx/compose/runtime",
- checksum = 0x3a5656cc,
+ checksum = 0xa797b7e1,
source = """
package androidx.compose.runtime
import kotlin.reflect.KProperty
+ import androidx.compose.runtime.snapshots.StateFactoryMarker
interface State<out T> {
val value: T
@@ -535,6 +570,7 @@
private class DerivedStateImpl<T>(override var value: T) : DerivedState<T>
+ @StateFactoryMarker
fun <T> derivedStateOf(value: T): DerivedState<T> = DerivedStateImpl(value)
interface MutableState<T> : State<T> {
@@ -543,11 +579,17 @@
private class MutableStateImpl<T>(override var value: T) : MutableState<T>
- fun <T> mutableStateOf(value: T): MutableState<T> = MutableStateImpl(value)
+ @StateFactoryMarker
+ fun <T> mutableStateOf(
+ value: T,
+ policy: SnapshotMutationPolicy<T> = structuralEqualityPolicy()
+ ): MutableState<T> = MutableStateImpl(value)
+ @StateFactoryMarker
fun <T> mutableStateListOf() = SnapshotStateList<T>()
class SnapshotStateList<T>
+ @StateFactoryMarker
fun <K, V> mutableStateMapOf() = SnapshotStateMap<K, V>()
class SnapshotStateMap<K, V>
@@ -598,12 +640,44 @@
) {
this.value = value
}
+
+ interface SnapshotMutationPolicy<T> {
+ fun equivalent(a: T, b: T): Boolean
+ fun merge(previous: T, current: T, applied: T): T? = null
+ }
+
+ @Suppress("UNCHECKED_CAST")
+ fun <T> referentialEqualityPolicy(): SnapshotMutationPolicy<T> =
+ ReferentialEqualityPolicy as SnapshotMutationPolicy<T>
+
+ private object ReferentialEqualityPolicy : SnapshotMutationPolicy<Any?> {
+ override fun equivalent(a: Any?, b: Any?) = a === b
+ override fun toString() = "ReferentialEqualityPolicy"
+ }
+
+ @Suppress("UNCHECKED_CAST")
+ fun <T> structuralEqualityPolicy(): SnapshotMutationPolicy<T> =
+ StructuralEqualityPolicy as SnapshotMutationPolicy<T>
+
+ private object StructuralEqualityPolicy : SnapshotMutationPolicy<Any?> {
+ override fun equivalent(a: Any?, b: Any?) = a == b
+ override fun toString() = "StructuralEqualityPolicy"
+ }
+ @Suppress("UNCHECKED_CAST")
+ fun <T> neverEqualPolicy(): SnapshotMutationPolicy<T> =
+ NeverEqualPolicy as SnapshotMutationPolicy<T>
+
+ private object NeverEqualPolicy : SnapshotMutationPolicy<Any?> {
+ override fun equivalent(a: Any?, b: Any?) = false
+ override fun toString() = "NeverEqualPolicy"
+ }
""",
+
"""
META-INF/main.kotlin_module:
H4sIAAAAAAAA/2NgYGBmYGBgBGIOBijgMueSSMxLKcrPTKnQS87PLcgvTtUr
- Ks0rycxNFeIKSs1NzU1KLfIuEeIPzkssKM7ILwkuSSxJ9S7h4uNiKUktLhFi
- CwGS3iVKDFoMAJF5eAthAAAA
+ Ks0rycxNFeIKSs1NzU1KLfIuEeIPzkssKM7ILwkuSSxJ9S7hUuOSwaVRLy0/
+ X4gtJLW4xLtEiUGLAQDM+x9weQAAAA==
""",
"""
androidx/compose/runtime/DerivedState.class:
@@ -632,9 +706,9 @@
wrVWTTvpmrHCDolWGdbH20l85kogztVJqPvE1plmmKjI40DodkSTm8/DBrmp
sgz81+3WkR9VxVGzf5uwLpo1Eck4HpJOJWxHdX9fxsHSwUCxJpWkr0+DICQJ
GQYK23TABO2H/l9CdFHyWVoSxxIMwjbiE+eIKZLn5J38V0zmN75g+lM/L0/W
- okzQ6w2y84MsZDATr57Q71UdQrOYG9b04suQT+Q/Y/rjP8ulBgnDcoMi88Qt
+ okzQ2w2y84MsZDATr57Q71UdQrOYG9b04suQT+Q/Y/rjP8ulBgnDcoMi88Qt
XDW2O2zM+m9T1lVTFhb/aMoYIgMP+n4dm+T3KWOZtK8fwihhpYQbJdzELYK4
- XcIdrB6CKdzFvUNMKMworCncV0irOJxVmFNYUJj6BfKpA8lSBAAA
+ XcIdrB6CKdzFvUNMKMworCncV0irOJxVmFNYUJj6BY25tQRSBAAA
""",
"""
androidx/compose/runtime/MutableState.class:
@@ -651,20 +725,44 @@
""",
"""
androidx/compose/runtime/MutableStateImpl.class:
- H4sIAAAAAAAA/41S204TURRdZ2Y6HcbSDuWOeEORtgiDxAcDTY2aEJsUTWjT
- GHk6tBM40M6QnlPCY7/CD/ALNNGY+GAaHv0o4z7Thqg1sS97r71mn732ZX78
- /PYdwBNsMuR52OxEonnpN6L2eSQDv9MNlWgH/n5X8aNWUFVcBeX2eSsJxlAr
- 1nYqp/yC+y0eHvtvjk6DhtotjVKVseoWa7Xd0i6D9/f7JCyG1bFqJGEz2EUR
- ClVimM2N9pKvU0KOpDQwc/l6Cg5uuEggxZC44K1uwJAdfZdCGpkJGPAYLHUi
- JMP6eHPpfdFYznGg6oPyM7n8qACp5/LUF2XK68xkkfDGM5rFjD9NVc4i1RKh
- vx8o3uSKE2e0L0y6INPG0QYM7Iz4S6GjLULNxwzv+r20aywYbr8XO8OxHWOh
- 3ytYTr/nsW0na2WNV2zLeDGZtT1zyXja7119sA3POlgehm+v3qeJ8lzDc5Ys
- J+HZK5aT9CytsE2iNYa18Xaiz1wN+bk8iVRMbJ4phomqOA656nZocutl1CSX
- qYgweN1tHwWdmn6tbxM1eKvOO0LHQ9KtRt1OI9gTOlg8GCjWhRT09XkYRiQh
- olBiiw6YoP3Q/0uILko+R0sysAiTsAN94jwxJfIGebfwFZOF9S+Y+hTnFcja
- lAnMYT22cRaymNarJ/R7VZfQDGaHNX19GfKJwmdMffxnudQgYVhuUGSOuPnr
- xnaGjdn/bcq+bsrGwh9NmUNk4lHs17BBfo8ylkj75iHMMpbLuFXGbdwhiLtl
- 3MPKIZjEfTw4xITEtMSqxEOJtNThjMSsxLxE5hfups0nUgQAAA==
+ H4sIAAAAAAAA/41S224SURRdZ2YYpiOFKb3XeqvWArWd2vhgWoJRk0YSqkkh
+ xNinU5jQU2Cm4RyaPvIVfoBfoInGxAdD+uhHGfcB0jRiIi97rb1mn32dX79/
+ /ATwDNsMWR7WO5GoX/q1qH0eycDvdEMl2oF/2FX8pBWUFVdBsX3eioMxVPKV
+ vdIZv+B+i4cN/93JWVBT+4VxqTRR3nylsl/YZ/D+fh+HxbA+UY44bAY7L0Kh
+ CgzzmfFeslUKyFApTcxMtpqAg1suYkgwxC54qxswpMffJZBEagoGPAZLnQrJ
+ sDnZXHpfNJbTCFR1mH4ukx0vQNUzWeqLIuV1ZDxPfOsFzWIOPs2UmpFqidA/
+ DBSvc8VJM9oXJl2QaeNoAwbWJP1SaG+HWP0pw4d+L+kaS4bb7w3AcGzHWOr3
+ cpbT73ls10lbaeMN2zFeTadtz1wxnvd7V59sw7OOVkfu+6uPSZI81/CcFcuJ
+ efaa5cQ9S1fYpaIVho3JdqLPXA75uTyN1EDYbiqGqbJohFx1OzS59TqqE6RK
+ IgzedtsnQaeiX+vbRDXeqvKO0P5IdMtRt1MLDoR2lo+GFatCCvr6MgwjKiGi
+ UGKHDhij/dD/S4wuSpihJRlYhkncgT5xlpQCoUHo5r5jOrf5DTNfBnE5sjZF
+ AkvYJLswjEIas3r1xG5mdYnNYX6U09eXIYzlvmLm8z/TJYYBo3TDJAukLV43
+ tjdqzP5vU/Z1UzbpN5syR8zEkwFuYIvwgCJWqPbtY5hFrBZxp4i7uEcU94t4
+ gLVjMImHeHSMKYlZiXWJxxJJqd05iXmJRYnUH5JR7zxSBAAA
+ """,
+ """
+ androidx/compose/runtime/NeverEqualPolicy.class:
+ H4sIAAAAAAAA/5VU3W8bRRD/7Z0/zhcndZyQpmn4KA3UTpqeE8pnTNoSinqR
+ ayJcBUGe1vbibnK+c+/2rCJeIv4Unnmg4qEIJBTBW/8oxOydCcFJUSLLO7Mz
+ s7/5zc7svfjr198B3MZdhir3u2Egu0+dTtAfBJFwwthXsi+cphiK8P6TmHs7
+ gSc73+bBGL5s7PMhdzzu95zP2/uiozYaL0Vo+XwQPQ7Uw1hxJQM/xamfhtjc
+ YCiNW/PIMDgXBM8jx5CrS1+qTQazUt0twkLBRhY2Q0Y9lhHDysspjxdNxGzx
+ JJZD7glfMdyonHEBpyzVrxmWGkHYc/aFaodc+hEV4gcp08hpxp7H254gdMYZ
+ yqcRyNFmsFTQUqH0ewyzleqJqNRKUdf/L0ugdCJ9t+NlWbjMkO2LsCcYts9V
+ 0xlVnkW7fsGGLX0qvuGxp9z+wIvyuMrwXeWiE3UutufiX8QVvGpjEa/R5Q9C
+ MZRBTAOT78RhmPQ/zwcDT4ouuesdLxkzG4aeLcttth7da27dL+ItTBbI+DbD
+ dOMgUBTmPBSKd7nidENGf2jS62N6sfQCavYB2Z9KvauR1l1jEEeHi7Yxb6T/
+ 0tGhbVhamSBpkpyy/vzemD86XLfLuXJmntWMGvskbxl//JAzSub2YimzYNSy
+ 61Ypt5B4Scun2oO5batkkbfwYE4nW2dYu/CVM027eLJ5NGb/xLYoVNw6oPu6
+ +kUK4/pDGUka+Xv/Dii9x62gSwN4qSF90Yz7bRE+0s9Cv4igw71dHkq9HxmX
+ xrF2eMj7QonwP6BF1/dFuOXxKBK0LbRkz+cqDgnBbgVx2BGfSQ13ZQS3e4oY
+ atS9LNVHnzwaCGonyfepNzmScySz5KevCu0+oJ2jG6ity88x8YwUAx+OgoEQ
+ H9FaTANITib9nsIlitKH79JOt90wfxw7GSUn30i9o5Nam0Y58RuYIc3ABumT
+ BplKCXS6zuKVUYLVETuzPP/TWAZ1gps5ynCyTF38Ank0zA4y9KOJXV65ufoL
+ Xh/HSutcTmOO2VrEP2Vr4VrCVmtvkmYeZ9KEdQ0z5lgNpST4+vE9X06OAxO/
+ wfjqOZZ+xo1niSGDOq02hS1Sy94l1h8n7ExsJvI93CHpkr9CPajuwXSx7GLF
+ xU2skopbLjWxtgcWYQ3re7AjTEZ4J8LtCIUIU4kyHWEmwizpfwOnXXg5QAcA
+ AA==
""",
"""
androidx/compose/runtime/ProduceStateScope.class:
@@ -683,128 +781,195 @@
gzXIogtXa3ANrreAKLgBN1uQUpBTkFdQUGAoWFewoeDW3En9Ae+dQkpABAAA
""",
"""
+ androidx/compose/runtime/ReferentialEqualityPolicy.class:
+ H4sIAAAAAAAA/5VUW08bRxT+ZteX9WITYygBQq8hiblljUuvuDSUpoqRIShG
+ RC1PY3viDKx3nb1YifqC+lP60L70oVEfUrVShdq3/qiqZ3Zd6hqoQJbnnDnn
+ zHe+M+fM/vnXL78BWMUGQ5k7Lc+VredW0+10XV9YXugEsiOsR+KJ8ATp3L7/
+ LOS2DF7surZsvkiDMTyuHfIet2zutK2HjUPRDNZqF0LVHd71n7rBdhjwQLpO
+ jFM5C7G+xpAftqaRYLCuCJ5GiiFVkY4M1hn04vx+FgYyJpIwGRLBU+kzrF5M
+ +cLqiaEpnoWyx21yM9wpnnMTZyzzXzHM1VyvbR2KoOFx6fhUkePGlH1rJ7Rt
+ 3rAFoTPOUDiLQI4GgxG49cCTTpthojg/EBVbKerm/2VxA5WIoqYvrM/AdYZk
+ R3htwbB1qeLOKfc8/pUrtnDuc/GEh3ZQ7XRtP40bDF8Xrzpjl2J7Kf5ZTON1
+ E7N4g7rQ9URPuiGNULoZel40CGne7dpStMhdadrR4JnQ1LQZ1Z363sbO5v0s
+ biGXIeNthrHakRtQmLUtAt7iAacb0jo9nR4mU4uhFlDXj8j+XKpdibTWCoM4
+ OZ41tSkt/udPjk3NUMoISZ3kqPHHN9rUyXHZLKQKiSlW0krss7Sh/f5tSsvr
+ W7P5xIxWSpaNfGom8pKWjrUHk1tG3iBv5sGkSlZmWLnylTNFOzvYPHrU/8TW
+ KVTcPaL7uvEohqk6PelLmv2NfyeVXuim26IBvFaTjtgJOw3h7an3oZ6G2+T2
+ Pvek2veNOYJtHm3zbn8/N4y9yz3eEYHw/pMkW3Uc4W3a3PcFbTN12XZ4EHqE
+ YNbd0GuKL6SCm+7D7Z8hihJ1M0n10keRBoTaS/ID6lWK5CTJJPnpu0O7D2ln
+ qYYq68IrjLwkRcNH/WCA42Nas3EAyVzU/1Fcoyh1eI+kGoORxaXvkE58j4T+
+ A211rMV5MvfYAFojQnsrPtFHU9oYCpF/BOOkaaiQntPIlI/SxesEXusnXe4z
+ 1gtTPw7xbQ7w1fsZBktXFzJDHgWziwT9aKoXFpeWf8abw1hx7QtxzClbg/jH
+ bA28HbFV2juk6aeZFGFVw7g+VEM+Cr55evfXo+NU+K/QvnyFuZ9w52VkSOAT
+ Wk0Km6U2vkes1yN2Oj6N5Pu4R7JK/iJd8/wB9CoWqlisYgnLpOJulRpbOgDz
+ sYLyAUwfOR/v+lj1kfExGiljPsZ9TJD+NyU9ROd/BwAA
+ """,
+ """
+ androidx/compose/runtime/SnapshotMutationPolicy$DefaultImpls.class:
+ H4sIAAAAAAAA/5VSTW/TQBB96yR1GlL6wWcotEADohwwlTiRqBIqQjJKS0Wi
+ Hspp4yzpJvautV5HRfwpzhz4AfwoxKyTCmgQIpY9++bNm5n17H7/8fUbgBd4
+ zNDmamC0HJwHkU5SnYnA5MrKRARdxdPsTNvD3HIrtTrWsYw+NV+LjzyPbZik
+ ceaDMayN+IQHMVfD4F1/JCLro8RQSYQZCobPTzoLdmh1Lhf8L2Z3nmI4bfde
+ zvP7C++p3eu19ltkpu8ufQzNjjbDYCRs33CpsoArpadJWXCUxzHvx4JkO/+S
+ aeuUpKo07ZnMGPYWHhdDNTViInVO6Rt/m4If5cYIZQnxNI2lGDCsd8baxlIF
+ h8LyAbecdF4yKdG9YM5UnQEDGztAB+qdS4eeMwQL7tBHg6H++72hS3Mh7ZJS
+ PBvT3soHekAXZrUjlTjKk74wPTdB90864vEJN9L5M3K5K4eK29wQ3nw/7R+q
+ icwkhV/9GjEd0+XoMTc8EVaYP2T1UClhDmKeZYLcWlfnJhJvpGvWmJU4mSuP
+ PXgoYzqrZVSwRN498t6S73iPfXEWW2SXiANOsU326TSKGq4U2R7qWCniHq4S
+ 8gq0SqiE+wX28WBWo0rrQ/pWykXTi6eEHbI14jzcwSYaaBaJd/GI1i3i10iz
+ /gGlEBshroW4jhshbuJWiNs/Ac089AgUBAAA
+ """,
+ """
+ androidx/compose/runtime/SnapshotMutationPolicy.class:
+ H4sIAAAAAAAA/5VTzW7TQBD+1kltx2mLC6WkKeU3NCkHnFYcEK2QEAjhKgXU
+ RBzoaZNswybOOnjtqHDKs/AYHFDEkYdCjJ1WINIDlbzz/83szox//vr2HcBj
+ bDN4XHWjUHZPvU44HIVaeFGiYjkUXlPxkf4YxodJzGMZqndhIDufLTCG2n7r
+ aaPPx9wLuOp5b9t90Yn3ns2bGNx/bRbyDI74lMgxD4SKGaq1eeC8ZfsDQ6HW
+ au3Rl8oLQxH1BMPBf6EvyHfRbZfPCqQ16DBUGmHU8/oibkdcKk3dUuGsHdp7
+ kwQBbweCwlYagzAOpPIORcy7POZkM4bjHHWZpcROCRjYgOynMtXqJHV3GL5M
+ J6uOUTKc6cQxXCIZLzqGbdsnpenkYd6eTly2a9SNg003Vzbq+V3TXSgbT6YT
+ EsxMeL3146tpuNZB1bXL+RKb+QrnQc65UJxFr2XRi+kNdhl2GpfcAXoca7Hs
+ PZxOm8EeRWIsw0QzWJ0kirK5Wnw0CqToMuxfskDlpTjhSRD7w1GgLdxhWPzb
+ Qlt1jmsSTDwaULVCU/YUj5OIdmLjaJbeV2OpJY3o+Z+xUS5fKRG9CLjWglSn
+ GSZRR7ySASHXz5Dv53AmdQsL6Rhh0AaboD8BlVSDTXoBDkkzvYgHxE3yLxLP
+ Y4uoQ9pd8t3D+llUDtWM30eN+BH5lyj/8jFyPq74cH2s4CqJuOZjFdePwTTW
+ cOMYSxoljXWNsoaZ0Q2NmxqWRkFjU+OWxm0N5zfYvY915wMAAA==
+ """,
+ """
androidx/compose/runtime/SnapshotStateKt$produceState$1.class:
- H4sIAAAAAAAA/41T3U4TURD+znb7w1poqYCAiqhVtkVZqCZqCiSGSNJYNaGk
- MeFq6S7lQHuW7DltuOxT+AA+gSYaEy9Mw6UPZZyzbQwKAhc7f5n55pszsz9/
- ff8B4CmeMDxzhRcG3Dt2GkH7KJC+E3aE4m3fqQn3SO4HqqZc5b9W+aMw8DoN
- P3LzK0kwKq4euF3Xabmi6bzbPfAbqlz9P54uXN3eLq+XGbL/FiZhMsxdXJxE
- giGxygVX6wyT9tnuhTol2NRDGzG7UE8jhWsW4kgzxLtuq+Mz5M7WpTGGzAgM
- ZBlMtc8lw4sLJrnwZWi60bzmyN1WfdAx1fTV0JywC2fbEze7QKyJcyTHq4eB
- anHhvPGV67nKpZjR7sZoaUyLlBZgYIcUP+baWybLW2FY6/dGrX7PMqYNy0iZ
- Rdbvpazpfq+Uypk543m/t8y2prLGrDbfn3wwTz4mLMvIxmfNVCxrapASw/wl
- WyQ69lVfJ4kHDOnTT8Swd87qzokMH+Gg23b2OqKheCCkszm0SuXCZSzTWIBN
- t/YXo6VDxTBS403hqk5IZMyNwCOVqXLhv+20d/1w291tRXcSNPQKQ679YTBd
- EcIPN1qulD5dSeaVaLQCyUWTVrUfeAxWLeiEDX+T6+yZrQGhOpecyl8KERAH
- PQdW6NritEP6kZDT50d6kRZpYJo+2jH0PT4ia5O0jljFbxgtLn7F+Oco7zHJ
- MejlP4RJo46QXiJvapBNqNf1mZA1cQrdImsyytHYjr4i0vHiF4x/+gObiIIL
- EVx6kDCEG4DcIN+JoFnUDJjBMkmTKBSGOTEaUesiSqTXKHOGqmZ3EKvgZgW3
- KriNOTJxp4J53N0Bk7iH+ztISG3mJcYkJiWmJDK/AeLwkAKyBAAA
+ H4sIAAAAAAAA/41T0U4TURA9d7ttl7XQUgGhKqJW3RZloZqoKZAYIklj1YSS
+ xoSnZXcpF9q7ZPe24bFf4Qf4BZpoTHwwDY9+lHHutjEoCKbpzLmTmTPn3pn9
+ 8fPbdwBP8JjhqSO8MODese0GnaMg8u2wKyTv+HZDOEfRfiAb0pH+K1k8CgOv
+ 6/rxsbiSBqPi+oHTc+y2I1r2290D35XV+r/5VOHq9nZ1vcqQ+7swDZ1h/uLi
+ NFIMqVUuuFxnmLbOdi81KcGiHgokrFIzAwNXTCSRYUj2nHbXZ8ifrctgAtkx
+ aMgx6HKfRwzPL7jJhS9DtxsvKo3caTeHHY2WL0dwyiqdbU/arBKpJs2xnawf
+ BrLNhf3al47nSIdiWqeXoKExZQxlwMAOKX7M1WmZkLfCsDboj5uDvqnNaqZm
+ 6GU26Bvm7KBfMfJ6Xns26C+zrZmcVlDw3cl7/eRDyjS1XLKgG4mcrkgqDAuX
+ TJHkWP/7OmncY8icfiKGvXNGd05k9AgHvY691xWu5IGI7M0RqlRLl6nM4AEs
+ 2rU/FC0dSoaxBm8JR3ZDEqNvBB65bJ0L/023s+uH285uO96TwFUjDLk6j4KZ
+ mhB+uNF2osinLcm+FG47iLho0aj2A4/BbATd0PU3ucqe2xoKavKIU/kLIQLS
+ oO6BFdq2JM2QPiTk1fqRX6RBapilP80Yah8fEtokryJm+SvGy4tfMPkpzntE
+ dgJq+EvQYVP+Ev2AmWE2sV5Va0Jo6hS7SWg6zlHcttoi8snyZ0x+/E2bioN2
+ TJcZJozohiTX6GzH1CxuBsxhmayO+yiNchJ0ReXLqJBfo8w5qirsIFHD9Rpu
+ 1HAT8wRxq4YF3N4Bi3AHd3eQihQsRpiIMB1hJkL2F+yJDPSyBAAA
""",
"""
androidx/compose/runtime/SnapshotStateKt$produceState$2.class:
- H4sIAAAAAAAA/41T0U4TURA9d7ttl7XQUgEBFVGrbouyUEzUFEgMkaSxakKb
- xoSnZbuWC+1dsnu34bFf4Qf4BZpoTHwwDY9+lHHutjEoCjzs3DOTmTPn3pn9
- 8fPbdwCPscbwxBGtwOetY9v1u0d+6NlBJCTvenZdOEfhvi/r0pHeS1k4CvxW
- 5HqxWyinwai4duD0HLvjiLb9Zu/Ac2Wl9n8+VbjeaFQ2Kwy5vwvT0BkWzi9O
- I8WQWueCy02Gaets92KTEizqoUDCKjYzMHDFRBIZhmTP6UQeQ/5sXQYTyI5B
- Q45Bl/s8ZHh2zk3OfRm63XhBaeROpznsaLQ9OYJTVvFse9JmFUk1aY7tZO3Q
- lx0u7FeedFqOdCimdXsJGhpTxlAGDOyQ4sdceSuEWqsMG4P+uDnom9qsZmqG
- XmKDvmHODvplI6/ntaeD/grbmclp8wq+PXmvn3xImaaWS87rRiKnK5Iyw+IF
- UyQ51mVfJ417DJnTT8Rw/I/RXSoyepaDXtd+FwlXcl+E9vYIlSvFi3Rn8AAW
- bd8fGpcPJcNYnbeFI6OA5OlbfouObI0L73XU3fOChrPXiTfHd9VQA678UTBT
- FcILtjpOGHq0N9kXwu34IRdtGt6+32Iw634UuN42V9lzO0NBTR5yKn8uhE8a
- 1D2wSvuXpKnSr4W8Wkg6l2i0Gmbpo6lDbehDQtt0qohZ+orx0tIXTH6K8x6R
- nYBahzJ0rFF+GcvkzQyzifWqWhxCU6fYTULTcY7ittVe0Zksfcbkx9+0qTi4
- FtNlhgkjuiHJNfLtmJrFzYA5rJDVcR/FUU6CrqjOEskCNihzjqrmd5Go4noV
- N6q4iQWCuFXFIm7vgoW4g7u7SIUKFkJMhJgOMRMi+wttlNMGxAQAAA==
+ H4sIAAAAAAAA/41TUU8TQRD+9nptj7PQUgEBFVGrXotyUE1UCiSGQNJYNaGk
+ MeFpac+y0O6Ru23DY3+FP8BfoInGxAfT8OiPMs5eG4OiwMPNfDuZ+ebbnbkf
+ P799B/AEjxmectkIfNE4dut++8gPPTfoSCXanluV/Cjc91VVceW9VLmjwG90
+ 6l50zBWTYFRcOeBd7ra4bLpv9g68uipV/s+nC1d3dkrrJYbM34VJmAxz5xcn
+ kWBIrAop1DrDpHO2e75GCQ710CDm5GspWLhiI44UQ7zLWx2PIXu2LoUxpEdg
+ IMNgqn0RMjw/5ybnvgzdbjSnNQreqg06Wk1PDeGEkz/bnrQ5eVJNmiM7Xjn0
+ VUtI95WneIMrTjGj3Y3R0Jg2ljZgYIcUPxb6tESoscyw1u+N2v2ebUwbtmGZ
+ BdbvWfZ0v1e0smbWeNbvLbHtqYwxq+Hbk/fmyYeEbRuZ+KxpxTKmJikyzF8w
+ RZLjXPZ1krjHkDr9RAzH/xjdpSLDZznott13HVlXwpehuzVExVL+It0pPIBD
+ 2/eHxsVDxTBSFU3JVScgeeaG3yCXrgjpve6097xgh++1os3x63qogdDnYTBV
+ ltILNlo8DD3am/SmrLf8UMgmDW/fbzDYVb8T1L0tobNntgeCaiIUVP5CSp80
+ 6HtgmfYvTlOlXwtZvZDkF2i0Bqbpo6lDb+hDQlvkdcQufMVoYeELxj9FeY/I
+ jkGvwwpMlCh/BYt0mhpkE+tVvTiEJk6x24QmoxzN7eq9Ih8vfMb4x9+0iShY
+ iuhSg4Qh3YDkGp3diJpFzYAZLJE1cR/5YU6Mrqh9AUXya5Q5Q1Wzu4iVcb2M
+ G2XcxBxB3CpjHrd3wULcwd1dJEINcyHGQkyGmAqR/gVj7U/wxAQAAA==
""",
"""
androidx/compose/runtime/SnapshotStateKt$produceState$3.class:
- H4sIAAAAAAAA/41T3U4TURD+znbbLmuhpQJCVUStui3KQjFRU2hiiCSNVRNK
- GpNeLdu1HGjPkt3Thss+hQ/gE2iiMfHCNFz6UMY528agIHix85eZb74zM/vj
- 57fvAB5jneGJI1qBz1vHtut3j/zQs4OekLzr2XXhHIX7vqxLR3ovZf4o8Fs9
- 14vc/HoSjIprB07fsTuOaNtv9g48V5Zr/8ZThRu7u+VKmSHzd2ESOsPixcVJ
- JBgSG1xwWWGYtc52LzQowaIeyohZhUYKBq6YiCPFEO87nZ7HkD1bl8IU0hPQ
- kGHQ5T4PGZ5d8JILJ0Ovm8wrjtzpNEYdjbYnx+aMVTjbnrhZBWJNnCM5XTv0
- ZYcL+5UnnZYjHYpp3X6MlsaUMJQAAzuk+DFX3ipZrTWGzeFg0hwOTG1eMzVD
- L7LhwDDnh4OSkdWz2tPhYJXtzGW0nDLfnrzXTz4kTFPLxHO6EcvoCqTEsHTJ
- FomO9b/TSeIeQ+r0iBja56yuec4tjadw0O/a73rCldwXob09tkrlwmU0U3gA
- i47tD0orh5Jhos7bwpG9gNjoW36LVLrGhfe6193zgl1nrxMdiu+qHQZc+eNg
- qiqEF2x1nDD06EzSL4Tb8UMu2rSrfb/FYNb9XuB621xlL+yMCDV4yKn8uRA+
- cVDvwBqdW5yWSH8Ssur+SC/TJjXM00dLhjrIh2Rtk1YRs/gVk8XlL5j+FOU9
- IjkFtf1N6KhQ/iZWyJsbZRPqVXUnZM2cQjfJmo1yFLatzoh0vPgZ0x9/wyai
- YCWCS40SxnAjkGvk2xE0i5oBC1glqeM+CuOcGD1R6SJKEUWaBlXlmohVcb2K
- G1XcxCKZuFXFEm43wULcwd0mEqEy8yGmQsyGmAuR/gWU18KgswQAAA==
+ H4sIAAAAAAAA/41TXU8TURA9d7v9YF1oqYCAiqhVt0VZKCZqCiSG0KSxakJJ
+ Y9KnpV3Lhe1dsnvb8Nhf4Q/wF2iiMfHBNDz6o4xzt41BQeBhZ87czJw5987s
+ z1/ffwB4ijWGZ45oBT5vHdtNv3Pkh64ddIXkHdeuCeco3PdlTTrSfSVzR4Hf
+ 6jbdKMytJcGouHrg9Bzbc0Tbfrt34DZlqfp/PlW4vrtb2iwxZP4tTEJnWLi4
+ OIkEQ2KdCy43Gaats93zdUqwqIcCMStfN5HCNQNxmAzxnuN1XYbs2ToTE0iP
+ QUOGQZf7PGR4ccFNLnwZut14Tmnkjlcfdky1XTmCU1b+bHvSZuVJNWmO7GT1
+ 0JceF/ZrVzotRzp0pnV6MRoaUyalDBjYIZ0fcxWtEGqtMmwM+uPGoG9os5qh
+ pfQCG/RTxuygX0xl9az2fNBfYTszGW1ewXcnH/STjwnD0DLxeT0Vy+iKpMiw
+ eMkUSY511ddJ4gGDefqJGNrnjK5xzi6NXuGg17Hfd0VTcl+EdnmEiqX8ZTJN
+ PIJFy/aXpOVDyTBW423hyG5AavQtv0UuXeXCfdPt7LnBrrPnRYviN9UMA67i
+ 0aFZEcINtjwnDF1ak/S2aHp+yEWbZrXvtxiMmt8Nmm6Zq+y5naGgOg85lb8U
+ wicN6h5YpXWL0xDpT0JW7R/5JZqkhln6aMhQC/mYUJm8OjEK3zBeWPqKyc9R
+ 3hOyE1DT34ZOWWPklymaGWYT63W1J4SmTrEbhKajHMVtqzUiHy98weSnP7SJ
+ 6LAc0ZnDhBHdkOQGxXZEzaJmwBxWyOp4iPwoJ0ZXVL6AIvkNypyjqvkGYhXc
+ rOBWBbexQBB3KljE3QZYiHu430AiVDAXYiLEdIiZEOnfCWOj1bMEAAA=
""",
"""
androidx/compose/runtime/SnapshotStateKt.class:
- H4sIAAAAAAAA/91XbVMb1xV+riSkZS3DshgD6xgTW7ZBGISJa7dGpXVwiFXA
- L4HQONhNFmmBBWlX3bsiuG+haZt/0Q/tL0g/JalnOoz7rT+l/QudTs9d7UpC
- b0j2ZKZTzazu3XvPec5zXvbs3X/8569/A3ALf2CY0K2cY5u5w1TWLhRtbqSc
- kuWaBSO1ZulFvmu7a67uGstuDIxB2dMP9FRet3ZSj7b2jCythhn6coZjHhg5
- T/LRNsP8xEq94PzkSktL92vU5xneT6/fbdRfmFhf7xQkTaILhHRlxXZ2UnuG
- u+XopsVTumXZtG/aNH9ouw9L+TxJTXaEmSkU8zH0MkTTpmW6CwxDzbzciOMM
- 4jJknGW42hFyDP0MPQd6vmQwqI2YFOBCydW38sbrBni1Rv21A1wLEgS4dehq
- pcuhOy9juH1QanViGKVg1Pq9YnJX+D4z0YbkiaIVGkQy08LdbmACh5Odq8Qw
- xhCeKFfEuIxLeJthoNajVb0oHJrumAkpEIdP0stN/Nl4Ix8JOb2+PL++cUpa
- 65ViuCbjuvAsXnTsXClb9oxhu0mFNlnZt928aaX2Dgqp7ZKVLT+aS/5srl05
- BsX8z9bF3LW99HRre49r3FvL2kX/GZgOILO2Y5dc0zJ4atEmFavkNZp0ReBD
- 6hqkMNWE7Kl+BuV3tbXconcvaovkEu0aH3U9X0zyc+ZImGEYqwmOabmGY+n5
- VMZyHUIwszyGWep52V0ju+/3zse6oxcMEmS43j7dawJkx+uOc3hHxk3cYrjT
- 6asnUVtaiZsx3JZxR7SSsfZRi+EHVJeiW5t6fqPcXyP7xoubDOOnVR7DYWcV
- /F3U9L+7qun/uyp/zcKYi+HHMu6JwhBZnmPYaZLCze8kY/9qnbHuDf7PJ0iE
- l0tYeu1UvRPDAxkZkarBJvGhzrRjuP4T++nEaeFvHWDH2M7TfWqZwlY0HPcF
- udjEWrFF9k4Lx5QXjy7Mp5MUZFISp0h31+QLEh6V27C3LeEJw7mJJhzjWMHa
- GdzFOsPZhJnYTlQDxDJ0QkwIuJrF8dNrNiZUCJ9Bax0vYscroLttInLijNlN
- Rpodohk+6zoljefTLhMjjr/0gnqG+Blo+CQIdNV9P8jVhesdH7kHAsurhqvn
- dFentVDhIEyfYUz8SeIPlMt9MQnR5qEpZvTKDeVustCfjo8+ko+P5NBISA5J
- EW+s3Ib9MVQdFbEZLASXEqoqKAMVHLrXLpGCJqkRNfQgNMsuR6TjIyU0F1XC
- Gi28+nM0pEQ0VempiER9EW1MiWl93mKv9y/PSuWtXhqYIhPymYpWvBnwWW1H
- 6auI9FdFFCEyJykDWmSEzao0G/Rn08o5bVJiqqwGaueD+ezI7LAaVT252SFh
- QBp9EPv7N+z4yLOmac87s/YGNi5o++1snFfe0uKqRNhlhIuX39jimHZLuSTA
- fVvJinHyaNz3SFbe1qIqZXv28oNXX8qe4hUtrSQ0wq9XjDdXDDJXAbj66osQ
- lZE0Kgp1ru0jUfeZz6iV3ejuS26qq+8ktkwXtRKIr2r/8as94LUx3vCWna85
- MrZ4xZLIWCDy3qFr0KHZtgJ76y88DOUEzZl9l96li3aOWkn/CgE+LBW2DGdd
- NA7B2c6KY6tjint/sXfN3LF0t+TQ/MIHZbYZ68DkJm3fq57y6ROgfrdyWj8h
- Fs9YluEs5nXODbqV1+ySkzWWTGFs1IfYaICnA3wIEdGy0ItR9CCKMH5Fd7dp
- pIgj/hLy0+TX6DuG8pXoaPg1/Ue9PQW/ERJlOQxApfFzTyaGI19KonEUgzjX
- iDsscEeOodXjjrTEHarDvYC3fNxx2hU/6SUuPf0al7/yunAVU/MRLtYhXEGi
- EeE6IUzUI1z0Ea7WIUwiSREUCI8JSfR69Yaa+gbfe4k7wsPvH+PuSQ+juOZ5
- OF6WxrznoZil6WLebAY/JI2yxSnPokyzG4IfXb+lq99752Da+w+oLPhUPiZo
- kVZ12qdyT1B5twmVOY9KsizdlMoiXaEKqbBP6kdNSQ1FakidpHbfp7bhR2lk
- Sn2fqAWxygiCP2kgGCeT1ViNVAiOYAnLfrXUxuq9drGSagitYNVP/HP/ERhK
- qo89Qh/Qf3gh+S0+ZDjJpo+sBuHqoyrfwE89XkP4CE89XkMU+nLghvAEmxVe
- Dz0eg+EKi9rgPCMOZS4FEu2hcfgEl9uR5PS3+DSEv1TYCA/7yYXzhCwY3SK1
- foLTiZFwZhhbyHqMhiuMhn1GYiaeqiCVPwtS18gNJPSF9/iE6UsdHtt7/pjx
- x995IL/E72n8I+nliIqxiXAG2xnsZLALM4M97GeQR2ETjMOCvYlrHD0cRY6f
- cwxwRDkucDgcVzg4h8tR4hjkyHKc45jkeMoxz5HmOOBY5Jjh+IzjkOOFt/IL
- jgWOJMeSd3ufY4XjY44nHJscqxzPOJ7/F4J6TSkwFwAA
+ H4sIAAAAAAAA/91Ya1cb1xXdV4AkZAHjsTEgO0S2IWAwCLCT1IY6dokxCg9T
+ g6mJ6ziDGGCMmFHmjohpm8RNW/f9Th9pkz7Sd5u2br/EqdfqYrnf+lPav9DV
+ 9tyrkRBiRiC7WcurH6R758557LPPua/5+7//8lcAJ3GHoVMzF2zLWLiZSFmr
+ GYvrCTtrOsaqnpg2tQxftpxpR3P0MScExqDc0Na0RFozlxIX52/oKRqtYqhf
+ 0G1jTV+QkhcXGQY7x0sFB4+N+3p6tkh9kOHC0Mzp7fpnOmdmdmtkiETPkKWn
+ /cW5Gx1PSI0RLeVY9vqEZq/oNmkeHbfspcQN3Zm3NcPkCc00LZIzLOpPWs5k
+ Np0mqWO7QpNczaRDiDAEhwzTcM4wNHrxMxtFFHUR7EE9Q/uuLIegMNSsaems
+ zqBut0mpWc062nxaL6Qm7eHan6V8DUxkc8FPWWkjtV4uDRNF/sj/K/65rNRr
+ Lqm7dJ2vgGBG6obRxNC6Yjlpw0zcWFtNGKaj26aWTiRNx6YEGykeQgtlJrWs
+ p1bcDE9ptraqkyBDhxdtmyPTwsiSzOFBHIoghsfKVUcx0lx1PB5BvHzei3VC
+ OMLQX3HaGA5sLYe2BX1Ry6Ydhtf+F2WRrGjWl1RKM3fsbMrJ2lr6/EtZLW04
+ 6zmzDCc6y5jxwRJFBzojCOBYFPvRKHrdNEeK4x83uCOmRO9uzBc0CGrSp6gr
+ MZMv0K7dq4TQx1DVmVsoBiLoxwmGvcURTWgZEVDPrpGQAmG4PjTmEc/sQ8VI
+ lodmxgZnZmWU/lOhVCmED0VwSkQWzdjWQjaVi4xhsfwMzI8UzfHFrJnKrdgj
+ bm+gXD3mC/EfZZasSv0N9fj7myoKbzplZdw1qydvMmXZVtYxTJ0nhi1SMbOy
+ vocKApdpMyGFbg+wO8aZL792f7lh+Sxqi+Tayu2HtFS6YmE3Z3YYZ2n73e3Z
+ oq041W39IXwkgmGxHLaWjyKE81QnYlM1tPRsbhusXtHX+xniO1UCw83dVdQH
+ UWP/qqjG/u+q7gELYyCE8QgmRGGILA8wLHmk8OoHkrF/+mescoePfIIEvTyM
+ Sw+cqhMhzERwWaRqnwc/tFIs6Y47Y1/s3Il+f4JtfTFNz4kxoi2j2444m3p4
+ y/hkbyc6uiUfFbgf6iKSSUkc9p1lg58J42puWZSvw7jGsL/TA2MUV3B9D0bw
+ IkNdm9G22LZJEEvSQb5NmCsajO9csyGhQvYZYv58ETpeMLpchpEt57VKMuJ1
+ 12F4ueKUbD/fV5gYcYGkw9My6vbgKFbyRG+G75K8OdCx6+NrC3nUbd0UO1Hp
+ +XXywc+LXlcghgFfvUt+KEKgW0w4OTk9c25ymHbNk/6+fW1QkTrI1oJjjeFt
+ k7b9eEoeBOLzOvW4E3esuGmZPfKVs57R43knva6TXtdJr1+AcWtxZyV3yen1
+ 5Zym3U06GRRf5qL4RO5m9kmGRIW8h/AK3bfKzDfvm0sIr9Hlpdw89daTPH+6
+ FrfwOsNbjwDPflczovmzDIqpr+m2fJOveP/z/mSJbAifZ+j256hUXnLzxVp8
+ AV9ieOMR4KY0eOLkK3Qtyy9EE7qjLWiORrM2sLpWBYCJv7D4Ay3tK6IToJc3
+ DdGjG15goZ8F/rNx64XIxq1IoDkQCYSrZVt4rPJ6DITpp4hB0Wku+imBTUFl
+ L7XB/HPsMCnEwmq1GhgN9LEj1eGNW0pgIKhUxWhgNHT/nWBAqY7tV2oKQkFX
+ aDQUiyuhWL0crpX/kb5w7mUtNUyJkEi/sqegGS0xP1AfDih1hdf1rruGmKoo
+ m6OuUmxJ2VsYVDct7ZOWwsr+WHUz62uk3gG316M0xY6FmRpR82ot+X7fwb6Y
+ GlSlXF+z8Bo+NBr62122cUtCeCx2bXfeHsJHa2ylnI8DyuOxqBom2zkL8SMP
+ 7fEwEXtkO7GqcnT74EmlTcBwH7sKMCn2djf2iPJELKhSEfV1jN6/HZEuOmND
+ yrEYISlVjHorFiotb6Dr/usBKvZwi5gGA2X335KPxmyG4Xhln3HKrDoeH0nY
+ GP3o3ALxpdWd3MW3yTLOtx3pB4vupz7neRJpzYucv+noJqfBvL+ZdWlD2QKz
+ d8Whg/uwtUDnloZxMjiZXZ3X7RlxShGYrZS4I9uGeHYHa6eNJVOjhZ36By/l
+ 0CbNNYMb9Prc5hWf7v+lbwvfRreI1RGS1AoR5jqIJk1Tt4fTGuc6vY5MW1k7
+ pY8Y4l2La3J2mzv0I4BqsUCiDi2oQRBV+CU9PUUtZQDRe9gz1/UeGjaw945Y
+ P/Er+g/Kdyp+LSRycvS0j9rfSJkQfkut+BIYpraWfi3i0yB5ErZHyHZA6Her
+ zXfReg9x4eHwBo5u9RBEq/RwICftehC9JrTR+5yvA9t8/U60Abno06NSi3Y8
+ QX3h+pQbrnKo5tU3EbqLrvGu7rs4nnP8Lv1T2BGJoB5ilzhIKB4j6wcpgh70
+ uuzEJSLaW+6hf+49nLwjnW0yc9jFlvDg4UnJbYmVU2TldKmVdtfK0x5WBjHk
+ sjlF1gRS9bh6TrI5LNh8dgMjpWz2SjbjOWlcKLA5Sr1cPs8iSRo5rx8ueD1T
+ xGuD3FfxTJ5dCeU5F8rzZFqwq/a4UCYElEkPKKcllK6ctCeUi9QLFEBVuaDG
+ PEE1VheB2gptyoU267LU3K1OE7Q8V5cFwNltAKM4X8RVcwFgMy7hYxJg8xau
+ PlqOq9oiQFcw5yb/mluJjV3qxyWgF+i/6kzX+9AYtqKpx2SBrnqaW/NISVyN
+ WIAucTVi0SWukQwvFXA9L3HsqyqgKCZnGYaLZZVEa6ht2oLlqequnveRDuBP
+ BTQiwgZcpjk3KxGdJLUGqspVQiSCaYIJSyJqKiBqchGJnpjB+VTeyKduOzaB
+ LoNOF127DJYWqD/j5Tl1/S4+tYFXS+fKddfqSzITwUKQHV5mPjOnfs7bzLKP
+ mdteZr48p37V20zG00wVfk//MWqH3SAn3Pay2/5Bav0Cf6T2XdL6GvH79auo
+ SuIbSXwziW/h20m8ge8k8V187yoYx/fx5lV0c9Rw/IDjhxwqR5Cjh+Mtjic5
+ 3ub4EcePOfZzWBxNHG0cjRy3OQY5dI4LHKMcP+G4yHGW46cc73D8TI78nOM5
+ jiGOS/JxiiPD0cFxhWOR4xrHEsccxzKH8V81aexK6B4AAA==
""",
"""
androidx/compose/runtime/SnapshotStateList.class:
- H4sIAAAAAAAA/41Qy0ocQRQ9VT0v24n2+IijJpqlGcRWEQQVIQrCQJuAM8xm
- VjXThdY8qqSrRlz2t/gHWQVcSOMyHxW8Pbox2WRz7j2nDvfeU7//PD4BOMAX
- hobQcWJUfB/2zfjWWBkmE+3UWIYtLW7tjXEtJ5yMlHVlMIatk/ZRNBB3IhwJ
- fR3+6A1k3x2f/isxBH9rZRQYSidKK3fK4G197VRRQtlHERWGgrtRlmE7+v+L
- aEktGho3Ujq8lE7EwgnS+PjOo3wsh0oOYGBD0u9Vznapi/coSpZWfV7nfpb6
- PCDI0nqWNgqVLA3YPt/lZ8XnhxIPvNy/TyPaLJ8UvDtjZ+jo9HMTS4b5SGn5
- fTLuyaQteiNSFiLTF6OOSFTO38SZlrrWwk0S6v2WmSR9eaHyh9Wr16AdZRU5
- v2ltaIUy2mIPnH7pLUr+aYRrxMIpB4qNX5j5SQ3HOmFpKq7jE2H11QAfs1Q9
- fJ66PGxM6yo2qR6Sp0qeD114Tcw1Md9EgBq1WGhiEUtdMItlfOyiYDFrsWJR
- tyi/AEh/yvNKAgAA
+ H4sIAAAAAAAA/41QTUsjQRSs7smXY3YdXT/irruKJzcsOyqCoCKoIARmd8GE
+ XHLqZBptk3TLdEc8zm/xH3gSPMjg0R8lvoleVi9e6r2qLt571Y9Pd/cAtrDC
+ UBc6ToyKr8KeGV4YK8NkpJ0ayrCpxYU9M67phJORsq4MxrC219qJzsWlCAdC
+ n4b/uuey53b330sMwVutjAJDaU9p5fYZvLWf7SpKKPsoosJQcGfKMvyKPn4R
+ LZmO+sYNlA7/SCdi4QRpfHjpUT6WQyUHMLA+6VcqZ+vUxRsUJUurPq9xP0t9
+ HhBkaS1L64VKlgZsk6/zw+LDdYkHXu7fpBEtlk8K/jvjd9/R6UcmlgxTkdLy
+ 72jYlUlLdAekzESmJwZtkaicv4oTTXWqhRsl1PtNM0p68ljlD4snL0Hbyipy
+ HmhtaIUy2mIDnH7pNUr+aYRfiYVjDhTrt5i4oYbjG2FpLK5iibD6YoCPSaoe
+ vo9dHn6M6yKWqW6Tp0qeTx14DXxuYKqBANPUYqaBL5jtgFnMYb6DgsWkxYJF
+ zaL8DHqS9VZKAgAA
""",
"""
androidx/compose/runtime/SnapshotStateMap.class:
- H4sIAAAAAAAA/42Qy04bMRSGf3tyY0hhoFxCb7S7QqUOoK4gQqKVKkUMrdRU
- s8nKyVhgktjR2EEs51n6Bl0hdYFGLHkoxHFg08uiC//nnM+/j318e/frGsAH
- vGHYEjrLjcou44EZT4yVcT7VTo1l3NViYs+M6zrh5ImY1MEY2u3j/eRcXIh4
- JPRp/LV/LgfuIP0HO/wbMUR/sjoqDLW20sodMgRvt9ImaqiHqKLBUHFnyjK8
- S/77kXTHUjI0bqR0fCKdyIQTxPj4IqCJmZeGFzCwIfFL5asdyrJdhrgsFkLe
- 4iFv0IrKIiyLVllsVxplETEKLOJ7fCf4WL35UeNRxR/bo07HtFLmm0a/Pej9
- 0NEQn0wmGRYTpeWX6bgv8++iPyKynJiBGKUiV75+hHNddaqFm+aUh10zzQfy
- s/IbG98eRk6VVeQ80trQFcpoi11w+q/Hqfz3kT6nKp7VQHX7CnM/KeF4QVqb
- wVd4Sdp8MCDEPMWAqHcF2JzFZ3hNcZ88TfI86SHoYKGDxQ4iLFGK5Q6eYqUH
- ZrGKtR6qFvMW6xYtiw2L+j3Q7/VyagIAAA==
+ H4sIAAAAAAAA/41QyU4bQRB91eONwYGBbCZ7LlEgUgZQTsRCSiJFshgSKY7m
+ 4lPb04LGdrc13UYc51vyB5yQOKBRjvmoKDWGS5ZDDvWq6vXr2n78vLwC8AbP
+ CZvSZLnV2Vk8stOZdSrO58brqYr7Rs7csfV9L706lLMmiNDtHuwlJ/JUxhNp
+ juLPwxM18m/Tf3D7f1OE6E+uiRqh0dVG+31C8HIzbaOBZog6WoSaP9aO8Cr5
+ 7yG5x1oytn6iTXyovMykl8yJ6WnAG1MFrQpAoDHzZ7rKtjnKdghxWayEoiNC
+ 0WKLyiIsi05ZbNVaZRERO4rErtgO3te/f2uIqFZ92+VKB2wpVUWj3wZ6Pfa8
+ xAebKcJqoo36NJ8OVf5VDifMrCd2JCepzHWV35BLfX1kpJ/nHId9O89H6qOu
+ Hja+XK+caqdZ+c4Yyy20NQ47EHyvm62q8zE+5Cxe5EB96wJL5xwIPGJsLMgX
+ eMzYvhYgxDL7AE8WqgBPF/4BnrHfY02bNbcGCHpY6WG1hwhrHGK9h9u4MwA5
+ 3MW9AeoOyw73HToOGw7NXygOZ4ZqAgAA
""",
"""
androidx/compose/runtime/State.class:
@@ -817,6 +982,31 @@
a2AJMy3V18KOR1wOWsl41JWnKmaydvE+61IZdR3LP1on3KQSbTz+H0VMd+N7
eeC7Y42ZAx/u/8xFbYpVrDMe84sZ7gk6cBuYbWCugXkscIrFBkKUOyCDCn50
4BksGSwbrBismpyW3gBNs/uhAwIAAA==
+ """,
+ """
+ androidx/compose/runtime/StructuralEqualityPolicy.class:
+ H4sIAAAAAAAA/5VVW08bRxT+ZteX9WLAcVJqCE2ThjbmljWkdygtIVQxciiq
+ I6qWp7E9dcasd53dWStRX1B/Sp/70KgPiVqpQu1bflTVM7suIQYikOU5Z845
+ c+Y7t9mX//7xF4APscmwxL1W4MvWE6fpd3t+KJwg8pTsCqeugqipooC7m48j
+ 7kr1dMd3ZfNpFozhu1qH97njcq/tfNPoiKZaqZ3tyeO98JGvHkSKK+l7iZ/V
+ ky7WVhgKw9IsUgzOBZ1nkWHIrEpPqjUGszy7m4eFnI00bIaUeiRDhjtvgHxG
+ 8ATQFo8j2eeu8BTDrfIpiTghmf2BYabmB22nI1Qj4NILKSDPTxCHznbkurzh
+ CvJ+bd9XrvScTr/rSE+JwOOuU/VUQGdkM8ziEoPFAxHDyuMyxm0UcYWBcYbi
+ yatJ0aATyq9rF22GK+XZY1aJlKxuvgmerzRCsiqdlRcL0wzprgjagmHrXEk5
+ JU2nwV+9YOVn7okfeeSqarfnUrquM/xUvmhrngvtufDncQ3v2biBm1SEXiD6
+ 0o+o87LNKAjiBsryXs+VokXq1aYb96sNQzepVd2uP1zf3tjMYw6jORLOM1yq
+ DfrjgVC8xRWnDBndvknjzPRi6QVU9H2SP5F6VyGutcQgDg+mbaNkJP/C4YFt
+ WJoZIWoSHbP++dkoHR4s28VMMVViFaPC7mYt4+9fMkbB3JoupKaMSnrZKmSm
+ Yi1x2YS7P7FlFSzS5u5P6MuW6Vm5cMqZhp0/Xjx6C/63rZOpuL1P+br6beKm
+ 6vVlKGlm1l81Kg32ht+iBhyvSU9sR92GCB7qudKT4Te5u8sDqfcD4cywrx0e
+ 8K6goXvNab7qeSLYcHkYCtrm6rLtcZoB8mDX/Shoiq+ldjc5cLd7AhgqVL00
+ xUdvJyZ1OYmuUm0yRK8STZOenifafUE7RxdQS+eeY+QZMQbWBsZAB1/Smk8M
+ iI7G9R7DOFnpw/eI6rJn5hde4K1fh07vx6evJxaD05qbwNuxPoMScQa+In7U
+ IFEhdp+sk5gaXLI4QGgW3/lt6Ab3GD5zcMPxUOmJw7uk0W52kKIfde3c/MLi
+ C8wM+0pinUtsjtBaeH+A1sIHMVrN3SLOPLpJA9YxXDaHYijExuWjXCfHgZE/
+ YXz/HLO/Y+FZLEhhnVabzG5Q2T6n4O/G6ExsxHSFMg1USb9Idbi9B7MKp4pK
+ FUtYJhZ3qvSF/WgPLMTH+GQPdojREJ+G+CxELsRYzEyEKIWYJP4//rdNjpUH
+ AAA=
"""
)
diff --git a/compose/lint/common/src/main/java/androidx/compose/lint/KotlinUtils.kt b/compose/lint/common/src/main/java/androidx/compose/lint/KotlinUtils.kt
index 9ec00a4..5a39288 100644
--- a/compose/lint/common/src/main/java/androidx/compose/lint/KotlinUtils.kt
+++ b/compose/lint/common/src/main/java/androidx/compose/lint/KotlinUtils.kt
@@ -16,12 +16,17 @@
package androidx.compose.lint
+import org.jetbrains.kotlin.psi.KtElement
import org.jetbrains.kotlin.psi.KtLambdaExpression
import org.jetbrains.kotlin.psi.KtParameter
import org.jetbrains.kotlin.psi.KtSimpleNameExpression
import org.jetbrains.kotlin.psi.psiUtil.collectDescendantsOfType
import org.jetbrains.kotlin.psi.psiUtil.isAncestor
+import org.jetbrains.kotlin.resolve.calls.callUtil.getResolvedCall
import org.jetbrains.uast.ULambdaExpression
+import org.jetbrains.uast.kotlin.KotlinUFunctionCallExpression
+import org.jetbrains.uast.kotlin.KotlinUastResolveProviderService
+import org.jetbrains.uast.sourcePsiElement
import org.jetbrains.uast.toUElement
/**
@@ -143,3 +148,10 @@
else -> true
}
}
+
+fun KotlinUFunctionCallExpression.resolveCall() =
+ (sourcePsiElement as KtElement).getResolvedCall(
+ context = sourcePsi.project
+ .getService(KotlinUastResolveProviderService::class.java)
+ .getBindingContext(sourcePsi)
+ )
diff --git a/compose/lint/common/src/main/java/androidx/compose/lint/Names.kt b/compose/lint/common/src/main/java/androidx/compose/lint/Names.kt
index 71b1990..f51de29 100644
--- a/compose/lint/common/src/main/java/androidx/compose/lint/Names.kt
+++ b/compose/lint/common/src/main/java/androidx/compose/lint/Names.kt
@@ -41,6 +41,10 @@
val State = Name(PackageName, "State")
val MutableState = Name(PackageName, "MutableState")
val MutableStateOf = Name(PackageName, "mutableStateOf")
+ val MutableIntStateOf = Name(PackageName, "mutableIntStateOf")
+ val MutableLongStateOf = Name(PackageName, "mutableLongStateOf")
+ val MutableFloatStateOf = Name(PackageName, "mutableFloatStateOf")
+ val MutableDoubleStateOf = Name(PackageName, "mutableDoubleStateOf")
val MutableStateListOf = Name(PackageName, "mutableStateListOf")
val MutableStateMapOf = Name(PackageName, "mutableStateMapOf")
val ProduceState = Name(PackageName, "produceState")
@@ -50,6 +54,7 @@
val LaunchedEffect = Name(PackageName, "LaunchedEffect")
val ReusableContent = Name(PackageName, "ReusableContent")
val Key = Name(PackageName, "key")
+ val StructuralEqualityPolicy = Name(PackageName, "structuralEqualityPolicy")
}
object Ui {
val PackageName = Package("androidx.compose.ui")
diff --git a/compose/material/material-icons-core/samples/src/main/AndroidManifest.xml b/compose/material/material-icons-core/samples/src/main/AndroidManifest.xml
deleted file mode 100644
index 820b02a..0000000
--- a/compose/material/material-icons-core/samples/src/main/AndroidManifest.xml
+++ /dev/null
@@ -1,16 +0,0 @@
-<!--
- ~ Copyright (C) 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
- -->
-<manifest />
diff --git a/compose/material/material-icons-core/src/androidMain/AndroidManifest.xml b/compose/material/material-icons-core/src/androidMain/AndroidManifest.xml
deleted file mode 100644
index 9cd4123..0000000
--- a/compose/material/material-icons-core/src/androidMain/AndroidManifest.xml
+++ /dev/null
@@ -1,17 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
- 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.
- -->
-<manifest />
diff --git a/compose/material/material-icons-extended-filled/src/androidMain/AndroidManifest.xml b/compose/material/material-icons-extended-filled/src/androidMain/AndroidManifest.xml
deleted file mode 100644
index 9cd4123..0000000
--- a/compose/material/material-icons-extended-filled/src/androidMain/AndroidManifest.xml
+++ /dev/null
@@ -1,17 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
- 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.
- -->
-<manifest />
diff --git a/compose/material/material-icons-extended-outlined/src/androidMain/AndroidManifest.xml b/compose/material/material-icons-extended-outlined/src/androidMain/AndroidManifest.xml
deleted file mode 100644
index 9cd4123..0000000
--- a/compose/material/material-icons-extended-outlined/src/androidMain/AndroidManifest.xml
+++ /dev/null
@@ -1,17 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
- 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.
- -->
-<manifest />
diff --git a/compose/material/material-icons-extended-rounded/src/androidMain/AndroidManifest.xml b/compose/material/material-icons-extended-rounded/src/androidMain/AndroidManifest.xml
deleted file mode 100644
index 9cd4123..0000000
--- a/compose/material/material-icons-extended-rounded/src/androidMain/AndroidManifest.xml
+++ /dev/null
@@ -1,17 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
- 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.
- -->
-<manifest />
diff --git a/compose/material/material-icons-extended-sharp/src/androidMain/AndroidManifest.xml b/compose/material/material-icons-extended-sharp/src/androidMain/AndroidManifest.xml
deleted file mode 100644
index 9cd4123..0000000
--- a/compose/material/material-icons-extended-sharp/src/androidMain/AndroidManifest.xml
+++ /dev/null
@@ -1,17 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
- 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.
- -->
-<manifest />
diff --git a/compose/material/material-icons-extended-twotone/src/androidMain/AndroidManifest.xml b/compose/material/material-icons-extended-twotone/src/androidMain/AndroidManifest.xml
deleted file mode 100644
index 9cd4123..0000000
--- a/compose/material/material-icons-extended-twotone/src/androidMain/AndroidManifest.xml
+++ /dev/null
@@ -1,17 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
- 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.
- -->
-<manifest />
diff --git a/compose/material/material-icons-extended/src/androidAndroidTest/AndroidManifest.xml b/compose/material/material-icons-extended/src/androidAndroidTest/AndroidManifest.xml
deleted file mode 100644
index 9cd4123..0000000
--- a/compose/material/material-icons-extended/src/androidAndroidTest/AndroidManifest.xml
+++ /dev/null
@@ -1,17 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
- 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.
- -->
-<manifest />
diff --git a/compose/material/material-icons-extended/src/androidMain/AndroidManifest.xml b/compose/material/material-icons-extended/src/androidMain/AndroidManifest.xml
deleted file mode 100644
index 9cd4123..0000000
--- a/compose/material/material-icons-extended/src/androidMain/AndroidManifest.xml
+++ /dev/null
@@ -1,17 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
- 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.
- -->
-<manifest />
diff --git a/compose/material/material-ripple/src/androidAndroidTest/AndroidManifest.xml b/compose/material/material-ripple/src/androidAndroidTest/AndroidManifest.xml
deleted file mode 100644
index e865f27..0000000
--- a/compose/material/material-ripple/src/androidAndroidTest/AndroidManifest.xml
+++ /dev/null
@@ -1,17 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
- ~ Copyright 2021 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.
- -->
-<manifest />
diff --git a/compose/material/material-ripple/src/androidMain/AndroidManifest.xml b/compose/material/material-ripple/src/androidMain/AndroidManifest.xml
deleted file mode 100644
index 7535bfb..0000000
--- a/compose/material/material-ripple/src/androidMain/AndroidManifest.xml
+++ /dev/null
@@ -1,17 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
- ~ Copyright 2018 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.
- -->
-<manifest />
diff --git a/compose/material/material/api/public_plus_experimental_current.txt b/compose/material/material/api/public_plus_experimental_current.txt
index a45a971..7fd3fdd 100644
--- a/compose/material/material/api/public_plus_experimental_current.txt
+++ b/compose/material/material/api/public_plus_experimental_current.txt
@@ -81,7 +81,7 @@
method public suspend Object? close(kotlin.coroutines.Continuation<? super kotlin.Unit>);
method public suspend Object? expand(kotlin.coroutines.Continuation<? super kotlin.Unit>);
method public androidx.compose.material.BottomDrawerValue getCurrentValue();
- method public Float? getOffset();
+ method public float getOffset();
method public androidx.compose.material.BottomDrawerValue getTargetValue();
method public boolean isClosed();
method public boolean isExpanded();
@@ -91,7 +91,7 @@
property public final boolean isClosed;
property public final boolean isExpanded;
property public final boolean isOpen;
- property public final Float? offset;
+ property public final float offset;
property public final androidx.compose.material.BottomDrawerValue targetValue;
field public static final androidx.compose.material.BottomDrawerState.Companion Companion;
}
@@ -385,7 +385,7 @@
method @Deprecated @androidx.compose.material.ExperimentalMaterialApi public suspend Object? animateTo(androidx.compose.material.DrawerValue targetValue, androidx.compose.animation.core.AnimationSpec<java.lang.Float> anim, kotlin.coroutines.Continuation<? super kotlin.Unit>);
method public suspend Object? close(kotlin.coroutines.Continuation<? super kotlin.Unit>);
method public androidx.compose.material.DrawerValue getCurrentValue();
- method @androidx.compose.material.ExperimentalMaterialApi public Float? getOffset();
+ method @androidx.compose.material.ExperimentalMaterialApi public float getOffset();
method @androidx.compose.material.ExperimentalMaterialApi public androidx.compose.material.DrawerValue getTargetValue();
method public boolean isAnimationRunning();
method public boolean isClosed();
@@ -396,7 +396,7 @@
property public final boolean isAnimationRunning;
property public final boolean isClosed;
property public final boolean isOpen;
- property @androidx.compose.material.ExperimentalMaterialApi public final Float? offset;
+ property @androidx.compose.material.ExperimentalMaterialApi public final float offset;
property @androidx.compose.material.ExperimentalMaterialApi public final androidx.compose.material.DrawerValue targetValue;
field public static final androidx.compose.material.DrawerState.Companion Companion;
}
diff --git a/compose/material/material/integration-tests/material-catalog/src/main/AndroidManifest.xml b/compose/material/material/integration-tests/material-catalog/src/main/AndroidManifest.xml
deleted file mode 100644
index ccc91d4..0000000
--- a/compose/material/material/integration-tests/material-catalog/src/main/AndroidManifest.xml
+++ /dev/null
@@ -1,18 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
- ~ Copyright (C) 2021 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
- -->
-
-<manifest />
diff --git a/compose/material/material/integration-tests/material-demos/src/main/java/androidx/compose/material/demos/BadgeDemo.kt b/compose/material/material/integration-tests/material-demos/src/main/java/androidx/compose/material/demos/BadgeDemo.kt
index 0330c3c5..e03a6c9 100644
--- a/compose/material/material/integration-tests/material-demos/src/main/java/androidx/compose/material/demos/BadgeDemo.kt
+++ b/compose/material/material/integration-tests/material-demos/src/main/java/androidx/compose/material/demos/BadgeDemo.kt
@@ -41,6 +41,7 @@
import androidx.compose.material.icons.filled.Menu
import androidx.compose.runtime.Composable
import androidx.compose.runtime.getValue
+import androidx.compose.runtime.mutableIntStateOf
import androidx.compose.runtime.mutableStateListOf
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
@@ -56,7 +57,7 @@
@Composable
fun BadgeDemo() {
Column(Modifier.verticalScroll(rememberScrollState())) {
- var badgeCount by remember { mutableStateOf(8) }
+ var badgeCount by remember { mutableIntStateOf(8) }
Spacer(Modifier.requiredHeight(24.dp))
TopAppBarWithBadge(
{ badgeCount = 0 },
@@ -146,7 +147,7 @@
onArtistsBadgeClick: () -> Unit,
artistsBadgeCount: Int
) {
- var selectedItem by remember { mutableStateOf(initialSelectedIndex) }
+ var selectedItem by remember { mutableIntStateOf(initialSelectedIndex) }
val items = listOf("Songs", "Artists", "Playlists", "Something else")
var showSongsBadge by remember { mutableStateOf(true) }
@@ -222,7 +223,7 @@
onTab1BadgeClick: () -> Unit,
tab1BadgeCount: Int
) {
- var state by remember { mutableStateOf(initialSelectedIndex) }
+ var state by remember { mutableIntStateOf(initialSelectedIndex) }
val titles = listOf("TAB 1", "TAB 2", "TAB 3 WITH LOTS OF TEXT")
val showTabBadgeList = remember { mutableStateListOf(true, true) }
@@ -277,7 +278,7 @@
onTab1BadgeClick: () -> Unit,
tab1BadgeCount: Int,
) {
- var state by remember { mutableStateOf(0) }
+ var state by remember { mutableIntStateOf(0) }
val titlesAndIcons = listOf(
"TAB" to Icons.Filled.Favorite,
"TAB & ICON" to Icons.Filled.Favorite,
diff --git a/compose/material/material/integration-tests/material-demos/src/main/java/androidx/compose/material/demos/DynamicThemeActivity.kt b/compose/material/material/integration-tests/material-demos/src/main/java/androidx/compose/material/demos/DynamicThemeActivity.kt
index 9cd8b82..9489001 100644
--- a/compose/material/material/integration-tests/material-demos/src/main/java/androidx/compose/material/demos/DynamicThemeActivity.kt
+++ b/compose/material/material/integration-tests/material-demos/src/main/java/androidx/compose/material/demos/DynamicThemeActivity.kt
@@ -42,7 +42,7 @@
import androidx.compose.runtime.Composable
import androidx.compose.runtime.LaunchedEffect
import androidx.compose.runtime.MutableState
-import androidx.compose.runtime.mutableStateOf
+import androidx.compose.runtime.mutableFloatStateOf
import androidx.compose.runtime.snapshotFlow
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
@@ -57,12 +57,12 @@
* as the user scrolls. This has the effect of going from a 'light' theme to a 'dark' theme.
*/
class DynamicThemeActivity : ComponentActivity() {
- private val scrollFraction = mutableStateOf(0f)
+ private val scrollFraction = mutableFloatStateOf(0f)
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContent {
- val palette = interpolateTheme(scrollFraction.value)
+ val palette = interpolateTheme(scrollFraction.floatValue)
val darkenedPrimary = palette.darkenedPrimary
window.statusBarColor = darkenedPrimary
window.navigationBarColor = darkenedPrimary
diff --git a/compose/material/material/integration-tests/material-demos/src/main/java/androidx/compose/material/demos/ProgressIndicatorDemo.kt b/compose/material/material/integration-tests/material-demos/src/main/java/androidx/compose/material/demos/ProgressIndicatorDemo.kt
index f1f3651..b3aaf5c 100644
--- a/compose/material/material/integration-tests/material-demos/src/main/java/androidx/compose/material/demos/ProgressIndicatorDemo.kt
+++ b/compose/material/material/integration-tests/material-demos/src/main/java/androidx/compose/material/demos/ProgressIndicatorDemo.kt
@@ -36,7 +36,7 @@
import androidx.compose.runtime.Composable
import androidx.compose.runtime.DisposableEffect
import androidx.compose.runtime.getValue
-import androidx.compose.runtime.mutableStateOf
+import androidx.compose.runtime.mutableFloatStateOf
import androidx.compose.runtime.remember
import androidx.compose.runtime.setValue
import androidx.compose.ui.Alignment
@@ -92,7 +92,7 @@
}
private class ProgressState {
- var progress by mutableStateOf(0f)
+ var progress by mutableFloatStateOf(0f)
fun start() {
handler.postDelayed(updateProgress, 500)
diff --git a/compose/material/material/samples/src/main/AndroidManifest.xml b/compose/material/material/samples/src/main/AndroidManifest.xml
deleted file mode 100644
index dc2f180..0000000
--- a/compose/material/material/samples/src/main/AndroidManifest.xml
+++ /dev/null
@@ -1,17 +0,0 @@
-<!--
- ~ Copyright (C) 2019 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
- -->
-
-<manifest />
diff --git a/compose/material/material/src/androidAndroidTest/AndroidManifest.xml b/compose/material/material/src/androidAndroidTest/AndroidManifest.xml
deleted file mode 100644
index 7535bfb..0000000
--- a/compose/material/material/src/androidAndroidTest/AndroidManifest.xml
+++ /dev/null
@@ -1,17 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
- ~ Copyright 2018 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.
- -->
-<manifest />
diff --git a/compose/material/material/src/androidAndroidTest/kotlin/androidx/compose/material/BottomNavigationTest.kt b/compose/material/material/src/androidAndroidTest/kotlin/androidx/compose/material/BottomNavigationTest.kt
index 7af8d54..64a43ff 100644
--- a/compose/material/material/src/androidAndroidTest/kotlin/androidx/compose/material/BottomNavigationTest.kt
+++ b/compose/material/material/src/androidAndroidTest/kotlin/androidx/compose/material/BottomNavigationTest.kt
@@ -199,24 +199,24 @@
.getUnclippedBoundsInRoot()
val textBounds = rule.onNodeWithText("ItemText").getUnclippedBoundsInRoot()
- // Distance from the bottom to the text baseline and from the text baseline to the
- // bottom of the icon
+ val topPadding = 8.dp
+ // Distance from the text baseline to the bottom of the icon
val textBaseline = 12.dp
// Relative position of the baseline to the top of text
- val relativeTextBaseline = rule.onNodeWithText("ItemText").getLastBaselinePosition()
+ val relativeTextBaseline = rule.onNodeWithText("ItemText").getFirstBaselinePosition()
// Absolute y position of the text baseline
val absoluteTextBaseline = textBounds.top + relativeTextBaseline
- val itemBottom = itemBounds.height + itemBounds.top
- // Text baseline should be 12.dp from the bottom of the item
- absoluteTextBaseline.assertIsEqualTo(itemBottom - textBaseline)
+ val iconBottom = iconBounds.height + iconBounds.top
+ // Text baseline should be 12.dp from the bottom of the icon
+ absoluteTextBaseline.assertIsEqualTo(iconBottom + textBaseline)
rule.onNodeWithTag("icon", useUnmergedTree = true)
- // The icon should be centered in the item
+ // The icon should be horizontally centered in the item
.assertLeftPositionInRootIsEqualTo((itemBounds.width - iconBounds.width) / 2)
- // The bottom of the icon is 12.dp above the text baseline
- .assertTopPositionInRootIsEqualTo(absoluteTextBaseline - 12.dp - iconBounds.height)
+ // The icon is 8.dp from the top
+ .assertTopPositionInRootIsEqualTo(topPadding)
}
@Test
diff --git a/compose/material/material/src/androidAndroidTest/kotlin/androidx/compose/material/ModalBottomSheetTest.kt b/compose/material/material/src/androidAndroidTest/kotlin/androidx/compose/material/ModalBottomSheetTest.kt
index cb2f6d2..d5d6e55 100644
--- a/compose/material/material/src/androidAndroidTest/kotlin/androidx/compose/material/ModalBottomSheetTest.kt
+++ b/compose/material/material/src/androidAndroidTest/kotlin/androidx/compose/material/ModalBottomSheetTest.kt
@@ -1320,7 +1320,7 @@
ModalBottomSheetState(ModalBottomSheetValue.HalfExpanded, density = rule.density)
assertThat(sheetState.anchoredDraggableState.anchors).isEmpty()
- assertThat(sheetState.anchoredDraggableState.offset).isNull()
+ assertThat(sheetState.anchoredDraggableState.offset).isNaN()
stateRestorationTester.emulateSavedInstanceStateRestore()
rule.waitForIdle()
diff --git a/compose/material/material/src/androidMain/AndroidManifest.xml b/compose/material/material/src/androidMain/AndroidManifest.xml
deleted file mode 100644
index 7535bfb..0000000
--- a/compose/material/material/src/androidMain/AndroidManifest.xml
+++ /dev/null
@@ -1,17 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
- ~ Copyright 2018 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.
- -->
-<manifest />
diff --git a/compose/material/material/src/androidMain/kotlin/androidx/compose/material/ExposedDropdownMenu.kt b/compose/material/material/src/androidMain/kotlin/androidx/compose/material/ExposedDropdownMenu.kt
index 660f1c2..7cba51b 100644
--- a/compose/material/material/src/androidMain/kotlin/androidx/compose/material/ExposedDropdownMenu.kt
+++ b/compose/material/material/src/androidMain/kotlin/androidx/compose/material/ExposedDropdownMenu.kt
@@ -41,6 +41,7 @@
import androidx.compose.runtime.SideEffect
import androidx.compose.runtime.State
import androidx.compose.runtime.getValue
+import androidx.compose.runtime.mutableIntStateOf
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
import androidx.compose.runtime.rememberUpdatedState
@@ -95,8 +96,8 @@
) {
val density = LocalDensity.current
val view = LocalView.current
- var width by remember { mutableStateOf(0) }
- var menuHeight by remember { mutableStateOf(0) }
+ var width by remember { mutableIntStateOf(0) }
+ var menuHeight by remember { mutableIntStateOf(0) }
val verticalMarginInPx = with(density) { MenuVerticalMargin.roundToPx() }
val coordinates = remember { Ref<LayoutCoordinates>() }
diff --git a/compose/material/material/src/commonMain/kotlin/androidx/compose/material/AnchoredDraggable.kt b/compose/material/material/src/commonMain/kotlin/androidx/compose/material/AnchoredDraggable.kt
index 6e204b8..c93036a 100644
--- a/compose/material/material/src/commonMain/kotlin/androidx/compose/material/AnchoredDraggable.kt
+++ b/compose/material/material/src/commonMain/kotlin/androidx/compose/material/AnchoredDraggable.kt
@@ -31,6 +31,7 @@
import androidx.compose.runtime.Stable
import androidx.compose.runtime.derivedStateOf
import androidx.compose.runtime.getValue
+import androidx.compose.runtime.mutableFloatStateOf
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.saveable.Saver
import androidx.compose.runtime.saveable.rememberSaveable
@@ -168,37 +169,38 @@
val targetValue: T by derivedStateOf {
animationTarget ?: run {
val currentOffset = offset
- if (currentOffset != null) {
+ if (!currentOffset.isNaN()) {
computeTarget(currentOffset, currentValue, velocity = 0f)
} else currentValue
}
}
/**
- * The current offset, or null if it has not been initialized yet.
+ * The current offset, or [Float.NaN] if it has not been initialized yet.
*
- * The offset will be initialized during the first measurement phase of the node that the
- * [anchoredDraggable] modifier is attached to. These are the phases:
- * Composition { -> Effects } -> Layout { Measurement -> Placement } -> Drawing
- * During the first composition, the offset will be null. In subsequent compositions, the offset
- * will be derived from the anchors of the previous pass.
- * Always prefer accessing the offset from a LaunchedEffect as it will be scheduled to be
- * executed the next frame, after layout.
+ * The offset will be initialized when the anchors are first set through [updateAnchors].
*
- * To guarantee stricter semantics, consider using [requireOffset].
+ * Strongly consider using [requireOffset] which will throw if the offset is read before it is
+ * initialized. This helps catch issues early in your workflow.
*/
- @get:Suppress("AutoBoxing")
- var offset: Float? by mutableStateOf(null)
+ // Todo: Use primitive state when b/281205384 is fixed
+ @Suppress("AutoboxingStateCreation")
+ var offset: Float by mutableStateOf(Float.NaN)
private set
/**
* Require the current offset.
*
+ * @see offset
+ *
* @throws IllegalStateException If the offset has not been initialized yet
*/
- fun requireOffset(): Float = checkNotNull(offset) {
- "The offset was read before being initialized. Did you access the offset in a phase " +
- "before layout, like effects or composition?"
+ fun requireOffset(): Float {
+ check(!offset.isNaN()) {
+ "The offset was read before being initialized. Did you access the offset in a phase " +
+ "before layout, like effects or composition?"
+ }
+ return offset
}
/**
@@ -228,7 +230,7 @@
* You can use this value to provide smooth reconciliation behavior when re-targeting an
* animation.
*/
- var lastVelocity: Float by mutableStateOf(0f)
+ var lastVelocity: Float by mutableFloatStateOf(0f)
private set
/**
@@ -412,12 +414,12 @@
}
} finally {
if (targetValue != null) animationTarget = null
- val endState = offset?.let { endOffset ->
+ val endState =
anchors
.entries
- .firstOrNull { (_, anchorOffset) -> abs(anchorOffset - endOffset) < 0.5f }
+ .firstOrNull { (_, anchorOffset) -> abs(anchorOffset - offset) < 0.5f }
?.key
- }
+
if (endState != null && confirmValueChange.invoke(endState)) {
currentValue = endState
}
@@ -428,7 +430,7 @@
}
internal fun newOffsetForDelta(delta: Float) =
- ((offset ?: 0f) + delta).coerceIn(minOffset, maxOffset)
+ ((if (offset.isNaN()) 0f else offset) + delta).coerceIn(minOffset, maxOffset)
/**
* Drag by the [delta], coerce it in the bounds and dispatch it to the [AnchoredDraggableState].
@@ -437,7 +439,7 @@
*/
fun dispatchRawDelta(delta: Float): Float {
val newOffset = newOffsetForDelta(delta)
- val oldOffset = offset ?: 0f
+ val oldOffset = if (offset.isNaN()) 0f else offset
offset = newOffset
return newOffset - oldOffset
}
@@ -550,7 +552,7 @@
anchoredDrag(targetValue = targetValue) { anchors ->
val targetOffset = anchors[targetValue]
if (targetOffset != null) {
- var prev = offset ?: 0f
+ var prev = if (offset.isNaN()) 0f else offset
animate(prev, targetOffset, velocity, animationSpec) { value, velocity ->
// Our onDrag coerces the value within the bounds, but an animation may
// overshoot, for example a spring animation or an overshooting interpolator
diff --git a/compose/material/material/src/commonMain/kotlin/androidx/compose/material/BottomNavigation.kt b/compose/material/material/src/commonMain/kotlin/androidx/compose/material/BottomNavigation.kt
index 60b56ac..cad60b6 100644
--- a/compose/material/material/src/commonMain/kotlin/androidx/compose/material/BottomNavigation.kt
+++ b/compose/material/material/src/commonMain/kotlin/androidx/compose/material/BottomNavigation.kt
@@ -27,8 +27,8 @@
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.RowScope
import androidx.compose.foundation.layout.fillMaxWidth
-import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.height
+import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.selection.selectable
import androidx.compose.foundation.selection.selectableGroup
import androidx.compose.material.ripple.rememberRipple
@@ -41,7 +41,7 @@
import androidx.compose.ui.draw.alpha
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.graphics.lerp
-import androidx.compose.ui.layout.LastBaseline
+import androidx.compose.ui.layout.FirstBaseline
import androidx.compose.ui.layout.Layout
import androidx.compose.ui.layout.MeasureResult
import androidx.compose.ui.layout.MeasureScope
@@ -337,20 +337,19 @@
): MeasureResult {
val height = constraints.maxHeight
- // TODO: consider multiple lines of text here, not really supported by spec but we should
- // have a better strategy than overlapping the icon and label
- val baseline = labelPlaceable[LastBaseline]
-
+ val firstBaseline = labelPlaceable[FirstBaseline]
val baselineOffset = CombinedItemTextBaseline.roundToPx()
+ val netBaselineAdjustment = baselineOffset - firstBaseline
- // Label should be [baselineOffset] from the bottom
- val labelY = height - baseline - baselineOffset
+ val contentHeight = iconPlaceable.height + labelPlaceable.height + netBaselineAdjustment
+ val contentVerticalPadding = ((height - contentHeight) / 2).coerceAtLeast(0)
val unselectedIconY = (height - iconPlaceable.height) / 2
+ // Icon should be [contentVerticalPadding] from the top
+ val selectedIconY = contentVerticalPadding
- // Icon should be [baselineOffset] from the text baseline, which is itself
- // [baselineOffset] from the bottom
- val selectedIconY = height - (baselineOffset * 2) - iconPlaceable.height
+ // Label's first baseline should be [baselineOffset] below the icon
+ val labelY = selectedIconY + iconPlaceable.height + netBaselineAdjustment
val containerWidth = max(labelPlaceable.width, iconPlaceable.width)
diff --git a/compose/material/material/src/commonMain/kotlin/androidx/compose/material/Drawer.kt b/compose/material/material/src/commonMain/kotlin/androidx/compose/material/Drawer.kt
index c791f90..f42d552 100644
--- a/compose/material/material/src/commonMain/kotlin/androidx/compose/material/Drawer.kt
+++ b/compose/material/material/src/commonMain/kotlin/androidx/compose/material/Drawer.kt
@@ -221,15 +221,14 @@
get() = anchoredDraggableState.targetValue
/**
- * The current position (in pixels) of the drawer sheet, or null before the offset is
+ * The current position (in pixels) of the drawer sheet, or [Float.NaN] before the offset is
* initialized.
* @see [AnchoredDraggableState.offset] for more information.
*/
@Suppress("OPT_IN_MARKER_ON_WRONG_TARGET")
- @get:Suppress("AutoBoxing")
@ExperimentalMaterialApi
@get:ExperimentalMaterialApi
- val offset: Float?
+ val offset: Float
get() = anchoredDraggableState.offset
internal fun requireOffset(): Float = anchoredDraggableState.requireOffset()
@@ -313,11 +312,10 @@
get() = anchoredDraggableState.targetValue
/**
- * The current offset, or null if it has not been initialized yet.
+ * The current offset, or [Float.NaN] if it has not been initialized yet.
**/
@Suppress("OPT_IN_MARKER_ON_WRONG_TARGET")
- @get:Suppress("AutoBoxing")
- val offset: Float?
+ val offset: Float
get() = anchoredDraggableState.offset
internal fun requireOffset(): Float = anchoredDraggableState.requireOffset()
diff --git a/compose/material/material/src/commonMain/kotlin/androidx/compose/material/Swipeable.kt b/compose/material/material/src/commonMain/kotlin/androidx/compose/material/Swipeable.kt
index b30abb2..b3361e0 100644
--- a/compose/material/material/src/commonMain/kotlin/androidx/compose/material/Swipeable.kt
+++ b/compose/material/material/src/commonMain/kotlin/androidx/compose/material/Swipeable.kt
@@ -194,7 +194,7 @@
internal var thresholds: (Float, Float) -> Float by mutableStateOf({ _, _ -> 0f })
- internal var velocityThreshold by mutableStateOf(0f)
+ internal var velocityThreshold by mutableFloatStateOf(0f)
internal var resistance: ResistanceConfig? by mutableStateOf(null)
diff --git a/compose/material/material/src/commonMain/kotlin/androidx/compose/material/pullrefresh/PullRefreshState.kt b/compose/material/material/src/commonMain/kotlin/androidx/compose/material/pullrefresh/PullRefreshState.kt
index 96983f1..746c057 100644
--- a/compose/material/material/src/commonMain/kotlin/androidx/compose/material/pullrefresh/PullRefreshState.kt
+++ b/compose/material/material/src/commonMain/kotlin/androidx/compose/material/pullrefresh/PullRefreshState.kt
@@ -24,6 +24,7 @@
import androidx.compose.runtime.State
import androidx.compose.runtime.derivedStateOf
import androidx.compose.runtime.getValue
+import androidx.compose.runtime.mutableFloatStateOf
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
import androidx.compose.runtime.rememberCoroutineScope
@@ -121,10 +122,10 @@
private val adjustedDistancePulled by derivedStateOf { distancePulled * DragMultiplier }
private var _refreshing by mutableStateOf(false)
- private var _position by mutableStateOf(0f)
- private var distancePulled by mutableStateOf(0f)
- private var _threshold by mutableStateOf(threshold)
- private var _refreshingOffset by mutableStateOf(refreshingOffset)
+ private var _position by mutableFloatStateOf(0f)
+ private var distancePulled by mutableFloatStateOf(0f)
+ private var _threshold by mutableFloatStateOf(threshold)
+ private var _refreshingOffset by mutableFloatStateOf(refreshingOffset)
internal fun onPull(pullDelta: Float): Float {
if (_refreshing) return 0f // Already refreshing, do nothing.
diff --git a/compose/material3/material3-window-size-class/samples/src/main/AndroidManifest.xml b/compose/material3/material3-window-size-class/samples/src/main/AndroidManifest.xml
deleted file mode 100644
index a7cd314..0000000
--- a/compose/material3/material3-window-size-class/samples/src/main/AndroidManifest.xml
+++ /dev/null
@@ -1,17 +0,0 @@
-<!--
- ~ Copyright (C) 2022 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
- -->
-
-<manifest />
diff --git a/compose/material3/material3-window-size-class/src/androidAndroidTest/AndroidManifest.xml b/compose/material3/material3-window-size-class/src/androidAndroidTest/AndroidManifest.xml
deleted file mode 100644
index a9ad70f..0000000
--- a/compose/material3/material3-window-size-class/src/androidAndroidTest/AndroidManifest.xml
+++ /dev/null
@@ -1,18 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
- Copyright 2022 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.
- -->
-
-<manifest />
\ No newline at end of file
diff --git a/compose/material3/material3-window-size-class/src/androidMain/AndroidManifest.xml b/compose/material3/material3-window-size-class/src/androidMain/AndroidManifest.xml
deleted file mode 100644
index a9ad70f..0000000
--- a/compose/material3/material3-window-size-class/src/androidMain/AndroidManifest.xml
+++ /dev/null
@@ -1,18 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
- Copyright 2022 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.
- -->
-
-<manifest />
\ No newline at end of file
diff --git a/compose/material3/material3/integration-tests/material3-catalog/src/main/AndroidManifest.xml b/compose/material3/material3/integration-tests/material3-catalog/src/main/AndroidManifest.xml
deleted file mode 100644
index ccc91d4..0000000
--- a/compose/material3/material3/integration-tests/material3-catalog/src/main/AndroidManifest.xml
+++ /dev/null
@@ -1,18 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
- ~ Copyright (C) 2021 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
- -->
-
-<manifest />
diff --git a/compose/material3/material3/integration-tests/material3-catalog/src/main/java/androidx/compose/material3/catalog/library/ui/theme/ThemePicker.kt b/compose/material3/material3/integration-tests/material3-catalog/src/main/java/androidx/compose/material3/catalog/library/ui/theme/ThemePicker.kt
index 8aef861..ca9d5d4 100644
--- a/compose/material3/material3/integration-tests/material3-catalog/src/main/java/androidx/compose/material3/catalog/library/ui/theme/ThemePicker.kt
+++ b/compose/material3/material3/integration-tests/material3-catalog/src/main/java/androidx/compose/material3/catalog/library/ui/theme/ThemePicker.kt
@@ -46,7 +46,7 @@
import androidx.compose.material3.catalog.library.model.ThemeMode
import androidx.compose.runtime.Composable
import androidx.compose.runtime.getValue
-import androidx.compose.runtime.mutableStateOf
+import androidx.compose.runtime.mutableFloatStateOf
import androidx.compose.runtime.remember
import androidx.compose.runtime.setValue
import androidx.compose.ui.Alignment
@@ -242,7 +242,7 @@
)
}
- var fontScale by remember { mutableStateOf(theme.fontScale) }
+ var fontScale by remember { mutableFloatStateOf(theme.fontScale) }
FontScaleItem(
modifier = Modifier
.fillMaxWidth()
diff --git a/compose/material3/material3/integration-tests/material3-demos/src/main/AndroidManifest.xml b/compose/material3/material3/integration-tests/material3-demos/src/main/AndroidManifest.xml
deleted file mode 100644
index a7cd314..0000000
--- a/compose/material3/material3/integration-tests/material3-demos/src/main/AndroidManifest.xml
+++ /dev/null
@@ -1,17 +0,0 @@
-<!--
- ~ Copyright (C) 2022 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
- -->
-
-<manifest />
diff --git a/compose/material3/material3/samples/src/main/AndroidManifest.xml b/compose/material3/material3/samples/src/main/AndroidManifest.xml
deleted file mode 100644
index dc2f180..0000000
--- a/compose/material3/material3/samples/src/main/AndroidManifest.xml
+++ /dev/null
@@ -1,17 +0,0 @@
-<!--
- ~ Copyright (C) 2019 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
- -->
-
-<manifest />
diff --git a/compose/material3/material3/src/androidAndroidTest/kotlin/androidx/compose/material3/DividerScreenshotTest.kt b/compose/material3/material3/src/androidAndroidTest/kotlin/androidx/compose/material3/DividerScreenshotTest.kt
index 1f62b814..9cce0ba 100644
--- a/compose/material3/material3/src/androidAndroidTest/kotlin/androidx/compose/material3/DividerScreenshotTest.kt
+++ b/compose/material3/material3/src/androidAndroidTest/kotlin/androidx/compose/material3/DividerScreenshotTest.kt
@@ -32,6 +32,7 @@
import androidx.test.filters.SdkSuppress
import androidx.test.screenshot.AndroidXScreenshotTestRule
import org.junit.Assume.assumeFalse
+import org.junit.Ignore
import org.junit.Rule
import org.junit.Test
import org.junit.runner.RunWith
@@ -64,6 +65,7 @@
}
@Test
+ @Ignore("b/272301182")
fun darkTheme() {
assumeFalse("See b/272301182", Build.VERSION.SDK_INT == 33)
diff --git a/compose/material3/material3/src/androidAndroidTest/kotlin/androidx/compose/material3/ExposedDropdownMenuTest.kt b/compose/material3/material3/src/androidAndroidTest/kotlin/androidx/compose/material3/ExposedDropdownMenuTest.kt
index 24bde2e..95357cf 100644
--- a/compose/material3/material3/src/androidAndroidTest/kotlin/androidx/compose/material3/ExposedDropdownMenuTest.kt
+++ b/compose/material3/material3/src/androidAndroidTest/kotlin/androidx/compose/material3/ExposedDropdownMenuTest.kt
@@ -54,8 +54,11 @@
import androidx.test.ext.junit.runners.AndroidJUnit4
import androidx.test.filters.MediumTest
import androidx.test.platform.app.InstrumentationRegistry
+import androidx.test.uiautomator.By
import androidx.test.uiautomator.UiDevice
import com.google.common.truth.Truth.assertThat
+import org.junit.Assume.assumeNotNull
+import org.junit.Ignore
import org.junit.Rule
import org.junit.Test
import org.junit.runner.RunWith
@@ -75,7 +78,7 @@
private val OptionName = "Option 1"
@Test
- fun expandedBehaviour_expandsOnClickAndCollapsesOnOutside() {
+ fun edm_expandsOnClick_andCollapsesOnClickOutside() {
var textFieldBounds = Rect.Zero
rule.setMaterialContent(lightColorScheme()) {
var expanded by remember { mutableStateOf(false) }
@@ -106,7 +109,7 @@
}
@Test
- fun expandedBehaviour_collapseOnTextFieldClick() {
+ fun edm_collapsesOnTextFieldClick() {
rule.setMaterialContent(lightColorScheme()) {
var expanded by remember { mutableStateOf(true) }
ExposedDropdownMenuForTest(
@@ -126,7 +129,39 @@
}
@Test
- fun expandedBehaviour_expandsAndFocusesTextFieldOnTrailingIconClick() {
+ fun edm_doesNotCollapse_whenTypingOnSoftKeyboard() {
+ rule.setMaterialContent(lightColorScheme()) {
+ var expanded by remember { mutableStateOf(false) }
+ ExposedDropdownMenuForTest(
+ expanded = expanded,
+ onExpandChange = { expanded = it }
+ )
+ }
+
+ rule.onNodeWithTag(TFTag).performClick()
+
+ rule.onNodeWithTag(TFTag).assertIsDisplayed()
+ rule.onNodeWithTag(TFTag).assertIsFocused()
+ rule.onNodeWithTag(EDMTag).assertIsDisplayed()
+ rule.onNodeWithTag(MenuItemTag).assertIsDisplayed()
+
+ val device = UiDevice.getInstance(InstrumentationRegistry.getInstrumentation())
+ val zKey = device.findObject(By.desc("z")) ?: device.findObject(By.text("z"))
+ // Only run the test if we can find a key to type, which might fail for any number of
+ // reasons (keyboard doesn't appear, unexpected locale, etc.)
+ assumeNotNull(zKey)
+
+ repeat(3) {
+ zKey.click()
+ rule.waitForIdle()
+ }
+
+ rule.onNodeWithTag(TFTag).assertTextContains("zzz")
+ rule.onNodeWithTag(MenuItemTag).assertIsDisplayed()
+ }
+
+ @Test
+ fun edm_expandsAndFocusesTextField_whenTrailingIconClicked() {
rule.setMaterialContent(lightColorScheme()) {
var expanded by remember { mutableStateOf(false) }
ExposedDropdownMenuForTest(
@@ -146,7 +181,7 @@
}
@Test
- fun expandedBehaviour_doesNotExpandIfTouchEndsOutsideBounds() {
+ fun edm_doesNotExpand_ifTouchEndsOutsideBounds() {
var textFieldBounds = Rect.Zero
rule.setMaterialContent(lightColorScheme()) {
var expanded by remember { mutableStateOf(false) }
@@ -184,7 +219,7 @@
}
@Test
- fun expandedBehaviour_doesNotExpandIfTouchIsPartOfScroll() {
+ fun edm_doesNotExpand_ifTouchIsPartOfScroll() {
val testIndex = 2
var textFieldSize = IntSize.Zero
rule.setMaterialContent(lightColorScheme()) {
@@ -268,7 +303,7 @@
}
@Test
- fun uiProperties_menuMatchesTextWidth() {
+ fun edm_widthMatchesTextFieldWidth() {
var textFieldBounds by mutableStateOf(Rect.Zero)
var menuBounds by mutableStateOf(Rect.Zero)
rule.setMaterialContent(lightColorScheme()) {
@@ -294,7 +329,7 @@
}
@Test
- fun EDMBehaviour_rightOptionIsChosen() {
+ fun edm_collapsesWithSelection_whenMenuItemClicked() {
rule.setMaterialContent(lightColorScheme()) {
var expanded by remember { mutableStateOf(true) }
ExposedDropdownMenuForTest(
@@ -314,8 +349,9 @@
rule.onNodeWithTag(TFTag).assertTextContains(OptionName)
}
+ @Ignore("b/266109857")
@Test
- fun doesNotCrashWhenAnchorDetachedFirst() {
+ fun edm_doesNotCrash_whenAnchorDetachedFirst() {
var parent: FrameLayout? = null
rule.setContent {
AndroidView(
@@ -323,12 +359,20 @@
FrameLayout(context).apply {
addView(ComposeView(context).apply {
setContent {
- Box {
- ExposedDropdownMenuBox(expanded = true, onExpandedChange = {}) {
- Box(
- Modifier
- .menuAnchor()
- .size(20.dp))
+ ExposedDropdownMenuBox(expanded = true, onExpandedChange = {}) {
+ TextField(
+ value = "Text",
+ onValueChange = {},
+ modifier = Modifier.menuAnchor().size(20.dp),
+ )
+ ExposedDropdownMenu(
+ expanded = true,
+ onDismissRequest = {},
+ ) {
+ DropdownMenuItem(
+ text = { Text(OptionName) },
+ onClick = {},
+ )
}
}
}
@@ -349,7 +393,7 @@
@OptIn(ExperimentalMaterial3Api::class)
@Test
- fun withScrolledContent() {
+ fun edm_withScrolledContent() {
rule.setMaterialContent(lightColorScheme()) {
Box(Modifier.fillMaxSize()) {
ExposedDropdownMenuBox(
diff --git a/compose/material3/material3/src/androidAndroidTest/kotlin/androidx/compose/material3/NavigationBarScreenshotTest.kt b/compose/material3/material3/src/androidAndroidTest/kotlin/androidx/compose/material3/NavigationBarScreenshotTest.kt
index 3c05d96..3b58b83 100644
--- a/compose/material3/material3/src/androidAndroidTest/kotlin/androidx/compose/material3/NavigationBarScreenshotTest.kt
+++ b/compose/material3/material3/src/androidAndroidTest/kotlin/androidx/compose/material3/NavigationBarScreenshotTest.kt
@@ -265,4 +265,4 @@
}
}
-private const val Tag = "NavigationBar"
\ No newline at end of file
+private const val Tag = "NavigationBar"
diff --git a/compose/material3/material3/src/androidMain/kotlin/androidx/compose/material3/ExposedDropdownMenu.kt b/compose/material3/material3/src/androidMain/kotlin/androidx/compose/material3/ExposedDropdownMenu.kt
index b863609..cd1d852 100644
--- a/compose/material3/material3/src/androidMain/kotlin/androidx/compose/material3/ExposedDropdownMenu.kt
+++ b/compose/material3/material3/src/androidMain/kotlin/androidx/compose/material3/ExposedDropdownMenu.kt
@@ -41,6 +41,7 @@
import androidx.compose.runtime.DisposableEffect
import androidx.compose.runtime.SideEffect
import androidx.compose.runtime.getValue
+import androidx.compose.runtime.mutableIntStateOf
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
import androidx.compose.runtime.setValue
@@ -108,8 +109,8 @@
) {
val density = LocalDensity.current
val view = LocalView.current
- var width by remember { mutableStateOf(0) }
- var menuHeight by remember { mutableStateOf(0) }
+ var width by remember { mutableIntStateOf(0) }
+ var menuHeight by remember { mutableIntStateOf(0) }
val verticalMarginInPx = with(density) { MenuVerticalMargin.roundToPx() }
val coordinates = remember { Ref<LayoutCoordinates>() }
@@ -122,12 +123,8 @@
onGloballyPositioned {
width = it.size.width
coordinates.value = it
- updateHeight(
- view.rootView,
- coordinates.value,
- verticalMarginInPx
- ) { newHeight ->
- menuHeight = newHeight
+ updateHeight(view.rootView, coordinates.value, verticalMarginInPx) {
+ newHeight -> menuHeight = newHeight
}
}.expandable(
expanded = expanded,
@@ -1044,18 +1041,18 @@
private fun updateHeight(
view: View,
- coordinates: LayoutCoordinates?,
+ anchorCoordinates: LayoutCoordinates?,
verticalMarginInPx: Int,
onHeightUpdate: (Int) -> Unit
) {
- coordinates ?: return
+ anchorCoordinates ?: return
val visibleWindowBounds = Rect().let {
view.getWindowVisibleDisplayFrame(it)
it
}
- val heightAbove = coordinates.boundsInWindow().top - visibleWindowBounds.top
- val heightBelow =
- visibleWindowBounds.bottom - visibleWindowBounds.top - coordinates.boundsInWindow().bottom
+ val heightAbove = anchorCoordinates.boundsInWindow().top - visibleWindowBounds.top
+ val heightBelow = visibleWindowBounds.bottom - visibleWindowBounds.top -
+ anchorCoordinates.boundsInWindow().bottom
onHeightUpdate(max(heightAbove, heightBelow).toInt() - verticalMarginInPx)
}
diff --git a/compose/material3/material3/src/androidMain/kotlin/androidx/compose/material3/internal/ExposedDropdownMenuPopup.kt b/compose/material3/material3/src/androidMain/kotlin/androidx/compose/material3/internal/ExposedDropdownMenuPopup.kt
index d18f90d..6900df5 100644
--- a/compose/material3/material3/src/androidMain/kotlin/androidx/compose/material3/internal/ExposedDropdownMenuPopup.kt
+++ b/compose/material3/material3/src/androidMain/kotlin/androidx/compose/material3/internal/ExposedDropdownMenuPopup.kt
@@ -32,7 +32,6 @@
import androidx.compose.runtime.CompositionContext
import androidx.compose.runtime.DisposableEffect
import androidx.compose.runtime.SideEffect
-import androidx.compose.runtime.compositionLocalOf
import androidx.compose.runtime.derivedStateOf
import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableStateOf
@@ -85,7 +84,6 @@
) {
val view = LocalView.current
val density = LocalDensity.current
- val testTag = LocalPopupTestTag.current
val layoutDirection = LocalLayoutDirection.current
val parentComposition = rememberCompositionContext()
val currentContent by rememberUpdatedState(content)
@@ -93,10 +91,9 @@
val popupLayout = remember {
PopupLayout(
onDismissRequest = onDismissRequest,
- testTag = testTag,
composeView = view,
+ positionProvider = popupPositionProvider,
density = density,
- initialPositionProvider = popupPositionProvider,
popupId = popupId
).apply {
setContent(parentComposition) {
@@ -121,7 +118,6 @@
popupLayout.show()
popupLayout.updateParameters(
onDismissRequest = onDismissRequest,
- testTag = testTag,
layoutDirection = layoutDirection
)
onDispose {
@@ -134,17 +130,10 @@
SideEffect {
popupLayout.updateParameters(
onDismissRequest = onDismissRequest,
- testTag = testTag,
layoutDirection = layoutDirection
)
}
- DisposableEffect(popupPositionProvider) {
- popupLayout.positionProvider = popupPositionProvider
- popupLayout.updatePosition()
- onDispose {}
- }
-
// TODO(soboleva): Look at module arrangement so that Box can be
// used instead of this custom Layout
// Get the parent's position, size and layout direction
@@ -167,11 +156,6 @@
}
}
-// TODO(b/139861182): This is a hack to work around Popups not using Semantics for test tags
-// We should either remove it, or come up with an abstracted general solution that isn't specific
-// to Popup
-internal val LocalPopupTestTag = compositionLocalOf { "DEFAULT_TEST_TAG" }
-
// TODO(soboleva): Look at module dependencies so that we can get code reuse between
// Popup's SimpleStack and Box.
@Suppress("NOTHING_TO_INLINE")
@@ -214,21 +198,18 @@
@SuppressLint("ViewConstructor")
private class PopupLayout(
private var onDismissRequest: (() -> Unit)?,
- var testTag: String,
private val composeView: View,
+ private val positionProvider: PopupPositionProvider,
density: Density,
- initialPositionProvider: PopupPositionProvider,
popupId: UUID
) : AbstractComposeView(composeView.context),
ViewRootForInspector,
ViewTreeObserver.OnGlobalLayoutListener {
+
private val windowManager =
composeView.context.getSystemService(Context.WINDOW_SERVICE) as WindowManager
private val params = createLayoutParams()
- /** The logic of positioning the popup relative to its parent. */
- var positionProvider = initialPositionProvider
-
// Position params
var parentLayoutDirection: LayoutDirection = LayoutDirection.Ltr
var parentBounds: IntRect? by mutableStateOf(null)
@@ -247,15 +228,6 @@
override val subCompositionView: AbstractComposeView get() = this
- // Specific to exposed dropdown menus.
- private val dismissOnOutsideClick = { offset: Offset?, bounds: IntRect ->
- if (offset == null) false
- else {
- offset.x < bounds.left || offset.x > bounds.right ||
- offset.y < bounds.top || offset.y > bounds.bottom
- }
- }
-
init {
id = android.R.id.content
setViewTreeLifecycleOwner(composeView.findViewTreeLifecycleOwner())
@@ -304,9 +276,7 @@
content()
}
- /**
- * Taken from PopupWindow
- */
+ // Taken from PopupWindow. Calls [onDismissRequest] when back button is pressed.
override fun dispatchKeyEvent(event: KeyEvent): Boolean {
if (event.keyCode == KeyEvent.KEYCODE_BACK) {
if (keyDispatcherState == null) {
@@ -329,11 +299,9 @@
fun updateParameters(
onDismissRequest: (() -> Unit)?,
- testTag: String,
layoutDirection: LayoutDirection
) {
this.onDismissRequest = onDismissRequest
- this.testTag = testTag
superSetLayoutDirection(layoutDirection)
}
@@ -383,28 +351,18 @@
// matter whether we return true or false as some upper layer decides on whether the
// event is propagated to other windows or not. So for focusable the event is consumed but
// for not focusable it is propagated to other windows.
- if (
- (
- (event.action == MotionEvent.ACTION_DOWN) &&
- (
- (event.x < 0) ||
- (event.x >= width) ||
- (event.y < 0) ||
- (event.y >= height)
- )
- ) ||
- event.action == MotionEvent.ACTION_OUTSIDE
+ if (event.action == MotionEvent.ACTION_OUTSIDE ||
+ (event.action == MotionEvent.ACTION_DOWN &&
+ (event.x < 0 || event.x >= width || event.y < 0 || event.y >= height))
) {
val parentBounds = parentBounds
val shouldDismiss = parentBounds == null || dismissOnOutsideClick(
- if (event.x != 0f || event.y != 0f) {
- Offset(
- params.x + event.x,
- params.y + event.y
- )
- } else null,
+ // Keep menu open if ACTION_OUTSIDE event is reported as raw coordinates of (0, 0).
+ // This means it belongs to another owner, e.g., the soft keyboard or other window.
+ if (event.rawX != 0f && event.rawY != 0f) Offset(event.rawX, event.rawY) else null,
parentBounds
)
+
if (shouldDismiss) {
onDismissRequest?.invoke()
return true
@@ -427,6 +385,15 @@
super.setLayoutDirection(direction)
}
+ // Specific to exposed dropdown menus.
+ private fun dismissOnOutsideClick(offset: Offset?, bounds: IntRect): Boolean =
+ if (offset == null) {
+ false
+ } else {
+ offset.x < bounds.left || offset.x > bounds.right ||
+ offset.y < bounds.top || offset.y > bounds.bottom
+ }
+
/**
* Initialize the LayoutParams specific to [android.widget.PopupWindow].
*/
diff --git a/compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/AppBar.kt b/compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/AppBar.kt
index 36bd57b..d85d841 100644
--- a/compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/AppBar.kt
+++ b/compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/AppBar.kt
@@ -56,7 +56,7 @@
import androidx.compose.runtime.SideEffect
import androidx.compose.runtime.Stable
import androidx.compose.runtime.getValue
-import androidx.compose.runtime.mutableStateOf
+import androidx.compose.runtime.mutableFloatStateOf
import androidx.compose.runtime.rememberUpdatedState
import androidx.compose.runtime.saveable.Saver
import androidx.compose.runtime.saveable.listSaver
@@ -830,7 +830,7 @@
*
* Use this limit to coerce the [heightOffset] value when it's updated.
*/
- var heightOffsetLimit by mutableStateOf(initialHeightOffsetLimit)
+ var heightOffsetLimit by mutableFloatStateOf(initialHeightOffsetLimit)
/**
* The top app bar's current height offset in pixels. This height offset is applied to the fixed
@@ -857,7 +857,7 @@
* consumes scroll events. A common implementation would update the value to be the sum of all
* [NestedScrollConnection.onPostScroll] `consumed.y` values.
*/
- var contentOffset by mutableStateOf(initialContentOffset)
+ var contentOffset by mutableFloatStateOf(initialContentOffset)
/**
* A value that represents the collapsed height percentage of the app bar.
@@ -905,7 +905,7 @@
)
}
- private var _heightOffset = mutableStateOf(initialHeightOffset)
+ private var _heightOffset = mutableFloatStateOf(initialHeightOffset)
}
/**
diff --git a/compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/Menu.kt b/compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/Menu.kt
index 4b558c6..6356636 100644
--- a/compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/Menu.kt
+++ b/compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/Menu.kt
@@ -304,7 +304,7 @@
internal data class DropdownMenuPositionProvider(
val contentOffset: DpOffset,
val density: Density,
- val onPositionCalculated: (IntRect, IntRect) -> Unit = { _, _ -> }
+ val onPositionCalculated: (anchorBounds: IntRect, menuBounds: IntRect) -> Unit = { _, _ -> }
) : PopupPositionProvider {
override fun calculatePosition(
anchorBounds: IntRect,
@@ -318,40 +318,45 @@
val contentOffsetX = with(density) { contentOffset.x.roundToPx() }
val contentOffsetY = with(density) { contentOffset.y.roundToPx() }
- // Compute horizontal position.
- val toRight = anchorBounds.left + contentOffsetX
- val toLeft = anchorBounds.right - contentOffsetX - popupContentSize.width
- val toDisplayRight = windowSize.width - popupContentSize.width
- val toDisplayLeft = 0
+ // Compute menu horizontal position.
+ val leftToAnchorLeft = anchorBounds.left + contentOffsetX
+ val rightToAnchorRight = anchorBounds.right - contentOffsetX - popupContentSize.width
+ val leftToWindowLeft = 0
+ val rightToWindowRight = windowSize.width - popupContentSize.width
val x = if (layoutDirection == LayoutDirection.Ltr) {
sequenceOf(
- toRight,
- toLeft,
+ leftToAnchorLeft,
+ rightToAnchorRight,
// If the anchor gets outside of the window on the left, we want to position
- // toDisplayLeft for proximity to the anchor. Otherwise, toDisplayRight.
- if (anchorBounds.left >= 0) toDisplayRight else toDisplayLeft
+ // `leftToWindowLeft` for proximity to the anchor. Otherwise, `rightToWindowRight`.
+ if (anchorBounds.left < 0) leftToWindowLeft else rightToWindowRight
)
} else {
sequenceOf(
- toLeft,
- toRight,
+ rightToAnchorRight,
+ leftToAnchorLeft,
// If the anchor gets outside of the window on the right, we want to position
- // toDisplayRight for proximity to the anchor. Otherwise, toDisplayLeft.
- if (anchorBounds.right <= windowSize.width) toDisplayLeft else toDisplayRight
+ // `rightToWindowRight` for proximity to the anchor. Otherwise, `leftToWindowLeft`.
+ if (anchorBounds.right > windowSize.width) rightToWindowRight else leftToWindowLeft
)
}.firstOrNull {
it >= 0 && it + popupContentSize.width <= windowSize.width
- } ?: toLeft
+ } ?: rightToAnchorRight
- // Compute vertical position.
- val toBottom = maxOf(anchorBounds.bottom + contentOffsetY, verticalMargin)
- val toTop = anchorBounds.top - contentOffsetY - popupContentSize.height
- val toCenter = anchorBounds.top - popupContentSize.height / 2
- val toDisplayBottom = windowSize.height - popupContentSize.height - verticalMargin
- val y = sequenceOf(toBottom, toTop, toCenter, toDisplayBottom).firstOrNull {
+ // Compute menu vertical position.
+ val topToAnchorBottom = maxOf(anchorBounds.bottom + contentOffsetY, verticalMargin)
+ val bottomToAnchorTop = anchorBounds.top - contentOffsetY - popupContentSize.height
+ val centerToAnchorTop = anchorBounds.top - popupContentSize.height / 2
+ val bottomToWindowBottom = windowSize.height - popupContentSize.height - verticalMargin
+ val y = sequenceOf(
+ topToAnchorBottom,
+ bottomToAnchorTop,
+ centerToAnchorTop,
+ bottomToWindowBottom
+ ).firstOrNull {
it >= verticalMargin &&
it + popupContentSize.height <= windowSize.height - verticalMargin
- } ?: toTop
+ } ?: bottomToAnchorTop
onPositionCalculated(
anchorBounds,
diff --git a/compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/NavigationBar.kt b/compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/NavigationBar.kt
index 5f1bf66..989ceba 100644
--- a/compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/NavigationBar.kt
+++ b/compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/NavigationBar.kt
@@ -43,7 +43,7 @@
import androidx.compose.runtime.Stable
import androidx.compose.runtime.State
import androidx.compose.runtime.getValue
-import androidx.compose.runtime.mutableStateOf
+import androidx.compose.runtime.mutableIntStateOf
import androidx.compose.runtime.remember
import androidx.compose.runtime.setValue
import androidx.compose.ui.Alignment
@@ -187,7 +187,7 @@
}
}
- var itemWidth by remember { mutableStateOf(0) }
+ var itemWidth by remember { mutableIntStateOf(0) }
Box(
modifier
diff --git a/compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/Slider.kt b/compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/Slider.kt
index 69c0d59..da8bcc1 100644
--- a/compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/Slider.kt
+++ b/compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/Slider.kt
@@ -55,6 +55,8 @@
import androidx.compose.runtime.Stable
import androidx.compose.runtime.State
import androidx.compose.runtime.getValue
+import androidx.compose.runtime.mutableFloatStateOf
+import androidx.compose.runtime.mutableIntStateOf
import androidx.compose.runtime.mutableStateListOf
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
@@ -680,9 +682,9 @@
stepsToTickFractions(steps)
}
- var startThumbWidth by remember { mutableStateOf(ThumbWidth.value) }
- var endThumbWidth by remember { mutableStateOf(ThumbWidth.value) }
- var totalWidth by remember { mutableStateOf(0) }
+ var startThumbWidth by remember { mutableFloatStateOf(ThumbWidth.value) }
+ var endThumbWidth by remember { mutableFloatStateOf(ThumbWidth.value) }
+ var totalWidth by remember { mutableIntStateOf(0) }
val isRtl = LocalLayoutDirection.current == LayoutDirection.Rtl
@@ -695,8 +697,8 @@
scale(valueRange.start, valueRange.endInclusive, userValue, minPx, maxPx)
var obtainedMeasurements = remember { mutableStateOf(false) }
- val rawOffsetStart = remember { mutableStateOf(0f) }
- val rawOffsetEnd = remember { mutableStateOf(0f) }
+ val rawOffsetStart = remember { mutableFloatStateOf(0f) }
+ val rawOffsetEnd = remember { mutableFloatStateOf(0f) }
val gestureEndAction = rememberUpdatedState<(Boolean) -> Unit> {
onValueChangeFinished?.invoke()
@@ -706,17 +708,17 @@
val maxPx = max(totalWidth - endThumbWidth / 2, 0f)
val minPx = min(startThumbWidth / 2, maxPx)
val offsetRange = if (isStart) {
- rawOffsetStart.value = (rawOffsetStart.value + offset)
- rawOffsetEnd.value = scaleToOffset(minPx, maxPx, value.endInclusive)
- val offsetEnd = rawOffsetEnd.value
- var offsetStart = rawOffsetStart.value.coerceIn(minPx, offsetEnd)
+ rawOffsetStart.floatValue = (rawOffsetStart.floatValue + offset)
+ rawOffsetEnd.floatValue = scaleToOffset(minPx, maxPx, value.endInclusive)
+ val offsetEnd = rawOffsetEnd.floatValue
+ var offsetStart = rawOffsetStart.floatValue.coerceIn(minPx, offsetEnd)
offsetStart = snapValueToTick(offsetStart, tickFractions, minPx, maxPx)
offsetStart..offsetEnd
} else {
- rawOffsetEnd.value = (rawOffsetEnd.value + offset)
- rawOffsetStart.value = scaleToOffset(minPx, maxPx, value.start)
- val offsetStart = rawOffsetStart.value
- var offsetEnd = rawOffsetEnd.value.coerceIn(offsetStart, maxPx)
+ rawOffsetEnd.floatValue = (rawOffsetEnd.floatValue + offset)
+ rawOffsetStart.floatValue = scaleToOffset(minPx, maxPx, value.start)
+ val offsetStart = rawOffsetStart.floatValue
+ var offsetEnd = rawOffsetEnd.floatValue.coerceIn(offsetStart, maxPx)
offsetEnd = snapValueToTick(offsetEnd, tickFractions, minPx, maxPx)
offsetStart..offsetEnd
}
@@ -847,12 +849,12 @@
if (!obtainedMeasurements.value) {
val finalizedMaxPx = max(totalWidth - endThumbWidth / 2, 0f)
val finalizedMinPx = min(startThumbWidth / 2, finalizedMaxPx)
- rawOffsetStart.value = scaleToOffset(
+ rawOffsetStart.floatValue = scaleToOffset(
finalizedMinPx,
finalizedMaxPx,
value.start
)
- rawOffsetEnd.value = scaleToOffset(
+ rawOffsetEnd.floatValue = scaleToOffset(
finalizedMinPx,
finalizedMaxPx,
value.endInclusive
@@ -1679,7 +1681,7 @@
val valueRange: ClosedFloatingPointRange<Float> = 0f..1f,
var onValueChangeFinished: (() -> Unit)? = null
) {
- private var valueState by mutableStateOf(initialValue)
+ private var valueState by mutableFloatStateOf(initialValue)
/**
* [Float] that indicates the current value that the thumb
@@ -1709,11 +1711,11 @@
internal val tickFractions = stepsToTickFractions(steps)
- private var thumbWidth by mutableStateOf(ThumbWidth.value)
- internal var totalWidth by mutableStateOf(0)
+ private var thumbWidth by mutableFloatStateOf(ThumbWidth.value)
+ internal var totalWidth by mutableIntStateOf(0)
- internal var rawOffset by mutableStateOf(scaleToOffset(0f, 0f, value))
- internal var pressOffset by mutableStateOf(0f)
+ internal var rawOffset by mutableFloatStateOf(scaleToOffset(0f, 0f, value))
+ internal var pressOffset by mutableFloatStateOf(0f)
internal var isRtl = false
diff --git a/compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/Swipeable.kt b/compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/Swipeable.kt
index 1090fd0..8ebe654 100644
--- a/compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/Swipeable.kt
+++ b/compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/Swipeable.kt
@@ -29,11 +29,12 @@
import androidx.compose.material3.SwipeableDefaults.resistanceConfig
import androidx.compose.runtime.Composable
import androidx.compose.runtime.DisposableEffect
+import androidx.compose.runtime.FloatState
import androidx.compose.runtime.Immutable
import androidx.compose.runtime.LaunchedEffect
import androidx.compose.runtime.Stable
-import androidx.compose.runtime.State
import androidx.compose.runtime.getValue
+import androidx.compose.runtime.mutableFloatStateOf
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
import androidx.compose.runtime.saveable.Saver
@@ -103,20 +104,20 @@
* You should use this state to offset your content accordingly. The recommended way is to
* use `Modifier.offsetPx`. This includes the resistance by default, if resistance is enabled.
*/
- val offset: State<Float> get() = offsetState
+ val offset: FloatState get() = offsetState
/**
* The amount by which the [swipeable] has been swiped past its bounds.
*/
- val overflow: State<Float> get() = overflowState
+ val overflow: FloatState get() = overflowState
// Use `Float.NaN` as a placeholder while the state is uninitialised.
- private val offsetState = mutableStateOf(0f)
- private val overflowState = mutableStateOf(0f)
+ private val offsetState = mutableFloatStateOf(0f)
+ private val overflowState = mutableFloatStateOf(0f)
// the source of truth for the "real"(non ui) position
// basically position in bounds + overflow
- private val absoluteOffset = mutableStateOf(0f)
+ private val absoluteOffset = mutableFloatStateOf(0f)
// current animation target, if animating, otherwise null
private val animationTarget = mutableStateOf<Float?>(null)
@@ -138,8 +139,8 @@
requireNotNull(initialOffset) {
"The initial value must have an associated anchor."
}
- offsetState.value = initialOffset
- absoluteOffset.value = initialOffset
+ offsetState.floatValue = initialOffset
+ absoluteOffset.floatValue = initialOffset
}
}
@@ -174,10 +175,10 @@
newState ?: newAnchors.keys.minByOrNull { abs(it - animationTargetValue) }!!
} else {
// we're not animating, proceed by finding the new anchors for an old value
- val actualOldValue = oldAnchors[offset.value]
+ val actualOldValue = oldAnchors[offset.floatValue]
val value = if (actualOldValue == currentValue) currentValue else actualOldValue
newAnchors.getOffset(value) ?: newAnchors
- .keys.minByOrNull { abs(it - offset.value) }!!
+ .keys.minByOrNull { abs(it - offset.floatValue) }!!
}
try {
animateInternalToOffset(targetOffset, animationSpec)
@@ -194,18 +195,18 @@
internal var thresholds: (Float, Float) -> Float by mutableStateOf({ _, _ -> 0f })
- internal var velocityThreshold by mutableStateOf(0f)
+ internal var velocityThreshold by mutableFloatStateOf(0f)
internal var resistance: ResistanceConfig? by mutableStateOf(null)
internal val draggableState = DraggableState {
- val newAbsolute = absoluteOffset.value + it
+ val newAbsolute = absoluteOffset.floatValue + it
val clamped = newAbsolute.coerceIn(minBound, maxBound)
val overflow = newAbsolute - clamped
val resistanceDelta = resistance?.computeResistance(overflow) ?: 0f
- offsetState.value = clamped + resistanceDelta
- overflowState.value = overflow
- absoluteOffset.value = newAbsolute
+ offsetState.floatValue = clamped + resistanceDelta
+ overflowState.floatValue = overflow
+ absoluteOffset.floatValue = newAbsolute
}
private suspend fun snapInternalToOffset(target: Float) {
@@ -216,7 +217,7 @@
private suspend fun animateInternalToOffset(target: Float, spec: AnimationSpec<Float>) {
draggableState.drag {
- var prevValue = absoluteOffset.value
+ var prevValue = absoluteOffset.floatValue
animationTarget.value = target
isAnimationRunning = true
try {
@@ -261,7 +262,7 @@
@ExperimentalMaterial3Api
internal val progress: SwipeProgress<T>
get() {
- val bounds = findBounds(offset.value, anchors.keys)
+ val bounds = findBounds(offset.floatValue, anchors.keys)
val from: T
val to: T
val fraction: Float
@@ -285,7 +286,7 @@
}
from = anchors.getValue(a)
to = anchors.getValue(b)
- fraction = (offset.value - a) / (b - a)
+ fraction = (offset.floatValue - a) / (b - a)
}
}
return SwipeProgress(from, to, fraction)
@@ -299,7 +300,7 @@
*/
@ExperimentalMaterial3Api
internal val direction: Float
- get() = anchors.getOffset(currentValue)?.let { sign(offset.value - it) } ?: 0f
+ get() = anchors.getOffset(currentValue)?.let { sign(offset.floatValue - it) } ?: 0f
/**
* Set the state without any animation and suspend until it's set
@@ -334,7 +335,7 @@
}
animateInternalToOffset(targetOffset, anim)
} finally {
- val endOffset = absoluteOffset.value
+ val endOffset = absoluteOffset.floatValue
val endValue = anchors
// fighting rounding error once again, anchor should be as close as 0.5 pixels
.filterKeys { anchorOffset -> abs(anchorOffset - endOffset) < 0.5f }
@@ -392,9 +393,9 @@
* @return the amount of [delta] consumed
*/
internal fun performDrag(delta: Float): Float {
- val potentiallyConsumed = absoluteOffset.value + delta
+ val potentiallyConsumed = absoluteOffset.floatValue + delta
val clamped = potentiallyConsumed.coerceIn(minBound, maxBound)
- val deltaToConsume = clamped - absoluteOffset.value
+ val deltaToConsume = clamped - absoluteOffset.floatValue
if (abs(deltaToConsume) > 0) {
draggableState.dispatchRawDelta(deltaToConsume)
}
@@ -865,7 +866,7 @@
override suspend fun onPreFling(available: Velocity): Velocity {
val toFling = Offset(available.x, available.y).toFloat()
- return if (toFling < 0 && offset.value > minBound) {
+ return if (toFling < 0 && offset.floatValue > minBound) {
performFling(velocity = toFling)
// since we go to the anchor with tween settling, consume all for the best UX
available
diff --git a/compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/SwipeableV2.kt b/compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/SwipeableV2.kt
index 77bdf92..8db36b9 100644
--- a/compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/SwipeableV2.kt
+++ b/compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/SwipeableV2.kt
@@ -32,6 +32,7 @@
import androidx.compose.runtime.Stable
import androidx.compose.runtime.derivedStateOf
import androidx.compose.runtime.getValue
+import androidx.compose.runtime.mutableFloatStateOf
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.saveable.Saver
import androidx.compose.runtime.saveable.rememberSaveable
@@ -267,7 +268,7 @@
* You can use this value to provide smooth reconciliation behavior when re-targeting an
* animation.
*/
- var lastVelocity: Float by mutableStateOf(0f)
+ var lastVelocity: Float by mutableFloatStateOf(0f)
private set
/**
diff --git a/compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/TimePicker.kt b/compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/TimePicker.kt
index 6dae869..3764c75 100644
--- a/compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/TimePicker.kt
+++ b/compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/TimePicker.kt
@@ -91,6 +91,7 @@
import androidx.compose.runtime.Stable
import androidx.compose.runtime.derivedStateOf
import androidx.compose.runtime.getValue
+import androidx.compose.runtime.mutableFloatStateOf
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
import androidx.compose.runtime.rememberCoroutineScope
@@ -527,8 +528,12 @@
internal var isAfternoonToggle by mutableStateOf(initialHour > 12 && !is24Hour)
internal var isInnerCircle by mutableStateOf(initialHour >= 12)
- internal var hourAngle by mutableStateOf(RadiansPerHour * initialHour % 12 - FullCircle / 4)
- internal var minuteAngle by mutableStateOf(RadiansPerMinute * initialMinute - FullCircle / 4)
+ internal var hourAngle by mutableFloatStateOf(
+ RadiansPerHour * initialHour % 12 - FullCircle / 4
+ )
+ internal var minuteAngle by mutableFloatStateOf(
+ RadiansPerMinute * initialMinute - FullCircle / 4
+ )
private val mutex = MutatorMutex()
private val isAfternoon by derivedStateOf { is24hour && isInnerCircle || isAfternoonToggle }
@@ -1245,8 +1250,8 @@
name = "clockDial"
properties["state"] = state
}) {
- var offsetX by remember { mutableStateOf(0f) }
- var offsetY by remember { mutableStateOf(0f) }
+ var offsetX by remember { mutableFloatStateOf(0f) }
+ var offsetY by remember { mutableFloatStateOf(0f) }
val center by remember { mutableStateOf(IntOffset.Zero) }
val scope = rememberCoroutineScope()
val maxDist = with(LocalDensity.current) { MaxDistance.toPx() }
diff --git a/compose/runtime/runtime-lint/src/main/java/androidx/compose/runtime/lint/AutoboxingStateCreationDetector.kt b/compose/runtime/runtime-lint/src/main/java/androidx/compose/runtime/lint/AutoboxingStateCreationDetector.kt
new file mode 100644
index 0000000..b013276
--- /dev/null
+++ b/compose/runtime/runtime-lint/src/main/java/androidx/compose/runtime/lint/AutoboxingStateCreationDetector.kt
@@ -0,0 +1,182 @@
+/*
+ * Copyright 2023 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.
+ */
+
+@file:Suppress("UnstableApiUsage")
+
+package androidx.compose.runtime.lint
+
+import androidx.compose.lint.Name
+import androidx.compose.lint.Names
+import androidx.compose.lint.isInPackageName
+import androidx.compose.lint.resolveCall
+import com.android.tools.lint.detector.api.Category
+import com.android.tools.lint.detector.api.Detector
+import com.android.tools.lint.detector.api.Implementation
+import com.android.tools.lint.detector.api.Issue
+import com.android.tools.lint.detector.api.JavaContext
+import com.android.tools.lint.detector.api.LintFix
+import com.android.tools.lint.detector.api.Location
+import com.android.tools.lint.detector.api.Scope
+import com.android.tools.lint.detector.api.Severity
+import com.android.tools.lint.detector.api.SourceCodeScanner
+import com.intellij.psi.PsiMethod
+import java.util.EnumSet
+import org.jetbrains.kotlin.js.descriptorUtils.getJetTypeFqName
+import org.jetbrains.kotlin.psi.KtTypeArgumentList
+import org.jetbrains.kotlin.psi.KtValueArgumentList
+import org.jetbrains.kotlin.utils.addToStdlib.firstIsInstanceOrNull
+import org.jetbrains.uast.UCallExpression
+import org.jetbrains.uast.kotlin.KotlinUFunctionCallExpression
+import org.jetbrains.uast.skipParenthesizedExprDown
+
+/**
+ * Suggests alternative functions to mutableStateOf<T>() if all of the following are true:
+ * - a snapshot mutation policy argument is not specified (or it is structural equivalent policy)
+ * - `T` is in the [replacements] map
+ * - `T` is a non-nullable type
+ */
+class AutoboxingStateCreationDetector : Detector(), SourceCodeScanner {
+
+ /**
+ * Map of canonical PSI types to the fully-qualified function that should be used to
+ * create MutableState instances of said type.
+ */
+ private val replacements = mapOf(
+ "kotlin.Int" to Names.Runtime.MutableIntStateOf,
+ "kotlin.Long" to Names.Runtime.MutableLongStateOf,
+ "kotlin.Float" to Names.Runtime.MutableFloatStateOf,
+ "kotlin.Double" to Names.Runtime.MutableDoubleStateOf,
+ )
+
+ override fun getApplicableMethodNames() = listOf(Names.Runtime.MutableStateOf.shortName)
+
+ override fun visitMethodCall(context: JavaContext, node: UCallExpression, method: PsiMethod) {
+ if (!method.isInPackageName(Names.Runtime.PackageName)) return
+
+ val replacement = getSuggestedReplacementName(node as KotlinUFunctionCallExpression)
+ ?: return
+
+ context.report(
+ issue = AutoboxingStateCreation,
+ scope = node,
+ location = context.getNameLocation(node),
+ message = "Prefer `${replacement.shortName}` instead of `${method.name}`",
+ quickfixData = createLintFix(context, node, replacement)
+ )
+ }
+
+ private fun createLintFix(
+ context: JavaContext,
+ node: UCallExpression,
+ replacementFunction: Name
+ ): LintFix {
+ val fixes = listOfNotNull(
+ // Replace the function name
+ LintFix.create()
+ .replace()
+ .range(context.getNameLocation(node))
+ .with(replacementFunction.javaFqn)
+ .shortenNames(true)
+ .build(),
+
+ // Remove the type arguments list (if present)
+ context.getLocationOfTypeArguments(node)
+ ?.let { LintFix.create().replace().range(it).with("").build() },
+
+ // Remove the SnapshotMutationPolicy argument (if present)
+ context.getLocationOfArgumentsList(node)
+ ?.takeIf { node.getArgumentForParameter(MUTATION_POLICY_PARAM_IDX) != null }
+ ?.let { argsListLocation ->
+ node.getArgumentForParameter(VALUE_PARAM_IDX)?.sourcePsi?.text
+ ?.let { valueArg ->
+ LintFix.create()
+ .replace()
+ .range(argsListLocation)
+ .with("($valueArg)")
+ .build()
+ }
+ }
+ )
+
+ return LintFix.create()
+ .name("Replace with ${replacementFunction.shortName}")
+ .composite(*fixes.toTypedArray())
+ }
+
+ private fun JavaContext.getLocationOfTypeArguments(node: UCallExpression): Location? {
+ val typeArgsList = node.sourcePsi?.children?.firstIsInstanceOrNull<KtTypeArgumentList>()
+ ?: return null
+ return getLocation(typeArgsList)
+ }
+
+ private fun JavaContext.getLocationOfArgumentsList(node: UCallExpression): Location? {
+ val argsList = node.sourcePsi?.children?.firstIsInstanceOrNull<KtValueArgumentList>()
+ ?: return null
+ return getLocation(argsList)
+ }
+
+ private fun getSuggestedReplacementName(
+ invocation: KotlinUFunctionCallExpression
+ ): Name? {
+ if (!usesStructuralEqualityPolicy(invocation)) return null
+
+ val resolvedCall = invocation.resolveCall() ?: return null
+ val stateType = resolvedCall.typeArguments.asIterable().single().value
+ return when {
+ stateType.isMarkedNullable -> null
+ else -> replacements[stateType.getJetTypeFqName(true)]
+ }
+ }
+
+ private fun usesStructuralEqualityPolicy(
+ invocation: KotlinUFunctionCallExpression
+ ): Boolean {
+ val policyExpr = invocation.valueArguments.getOrNull(MUTATION_POLICY_PARAM_IDX)
+ ?.skipParenthesizedExprDown()
+ ?: return true // No argument passed; we're using the default policy
+
+ val policyMethod = (policyExpr as? KotlinUFunctionCallExpression)?.resolve()
+ ?: return false // Argument isn't a direct function call. Assume it's a more complex
+ // policy, or isn't always the structural equality policy.
+
+ return policyMethod.isInPackageName(Names.Runtime.PackageName) &&
+ policyMethod.name == Names.Runtime.StructuralEqualityPolicy.shortName
+ }
+
+ companion object {
+ private const val VALUE_PARAM_IDX = 0
+ private const val MUTATION_POLICY_PARAM_IDX = 1
+
+ val AutoboxingStateCreation = Issue.create(
+ id = "AutoboxingStateCreation",
+ briefDescription = "`State<T>` will autobox values assigned to this state. " +
+ "Use a specialized state type instead.",
+ explanation = "Calling `mutableStateOf<T>()` when `T` is either backed by a " +
+ "primitive type on the JVM or is a value class results in a state implementation " +
+ "that requires all state values to be boxed. This usually causes an additional " +
+ "allocation for each state write, and adds some additional work to auto-unbox " +
+ "values when reading the value of the state. Instead, prefer to use a " +
+ "specialized primitive state implementation for `Int`, `Long`, `Float`, and " +
+ "`Double` when the state does not need to track null values and does not " +
+ "override the default `SnapshotMutationPolicy`.",
+ category = Category.PERFORMANCE, priority = 3, severity = Severity.WARNING,
+ implementation = Implementation(
+ AutoboxingStateCreationDetector::class.java,
+ EnumSet.of(Scope.JAVA_FILE)
+ )
+ )
+ }
+}
\ No newline at end of file
diff --git a/compose/runtime/runtime-lint/src/main/java/androidx/compose/runtime/lint/RuntimeIssueRegistry.kt b/compose/runtime/runtime-lint/src/main/java/androidx/compose/runtime/lint/RuntimeIssueRegistry.kt
index 8a2444e..1ead6c8 100644
--- a/compose/runtime/runtime-lint/src/main/java/androidx/compose/runtime/lint/RuntimeIssueRegistry.kt
+++ b/compose/runtime/runtime-lint/src/main/java/androidx/compose/runtime/lint/RuntimeIssueRegistry.kt
@@ -31,6 +31,7 @@
override val minApi = CURRENT_API
override val issues get() = listOf(
AutoboxingStateValuePropertyDetector.AutoboxingStateValueProperty,
+ AutoboxingStateCreationDetector.AutoboxingStateCreation,
ComposableCoroutineCreationDetector.CoroutineCreationDuringComposition,
ComposableFlowOperatorDetector.FlowOperatorInvokedInComposition,
ComposableLambdaParameterDetector.ComposableLambdaParameterNaming,
diff --git a/compose/runtime/runtime-lint/src/main/java/androidx/compose/runtime/lint/UnrememberedStateDetector.kt b/compose/runtime/runtime-lint/src/main/java/androidx/compose/runtime/lint/UnrememberedStateDetector.kt
index 4eaa5a9..70ff3eb 100644
--- a/compose/runtime/runtime-lint/src/main/java/androidx/compose/runtime/lint/UnrememberedStateDetector.kt
+++ b/compose/runtime/runtime-lint/src/main/java/androidx/compose/runtime/lint/UnrememberedStateDetector.kt
@@ -18,9 +18,8 @@
package androidx.compose.runtime.lint
-import androidx.compose.lint.Names
-import androidx.compose.lint.isInPackageName
import androidx.compose.lint.isNotRemembered
+import com.android.tools.lint.client.api.UElementHandler
import com.android.tools.lint.detector.api.Category
import com.android.tools.lint.detector.api.Detector
import com.android.tools.lint.detector.api.Implementation
@@ -29,9 +28,9 @@
import com.android.tools.lint.detector.api.Scope
import com.android.tools.lint.detector.api.Severity
import com.android.tools.lint.detector.api.SourceCodeScanner
-import com.intellij.psi.PsiMethod
-import org.jetbrains.uast.UCallExpression
import java.util.EnumSet
+import org.jetbrains.uast.UCallExpression
+import org.jetbrains.uast.UElement
/**
* [Detector] that checks `derivedStateOf`, `mutableStateOf`, `mutableStateListOf`,
@@ -39,27 +38,32 @@
* they are `remember`ed.
*/
class UnrememberedStateDetector : Detector(), SourceCodeScanner {
- override fun getApplicableMethodNames(): List<String> = listOf(
- Names.Runtime.DerivedStateOf.shortName,
- Names.Runtime.MutableStateOf.shortName,
- Names.Runtime.MutableStateListOf.shortName,
- Names.Runtime.MutableStateMapOf.shortName
- )
+ override fun getApplicableUastTypes(): List<Class<out UElement>> {
+ return listOf(UCallExpression::class.java)
+ }
- override fun visitMethodCall(context: JavaContext, node: UCallExpression, method: PsiMethod) {
- if (!method.isInPackageName(Names.Runtime.PackageName)) return
-
- if (node.isNotRemembered()) {
- context.report(
- UnrememberedState,
- node,
- context.getNameLocation(node),
- "Creating a state object during composition without using `remember`"
- )
+ override fun createUastHandler(context: JavaContext): UElementHandler {
+ return object : UElementHandler() {
+ override fun visitCallExpression(node: UCallExpression) {
+ if (node.isStateFactoryInvocation() && node.isNotRemembered()) {
+ context.report(
+ UnrememberedState,
+ node,
+ context.getNameLocation(node),
+ "Creating a state object during composition without using `remember`"
+ )
+ }
+ }
}
}
+ private fun UCallExpression.isStateFactoryInvocation(): Boolean =
+ resolve()?.annotations?.any { it.hasQualifiedName(FqStateFactoryAnnotationName) } ?: false
+
companion object {
+ private const val FqStateFactoryAnnotationName =
+ "androidx.compose.runtime.snapshots.StateFactoryMarker"
+
val UnrememberedState = Issue.create(
"UnrememberedMutableState", // Left as previous id for backwards compatibility
"Creating a state object during composition without using `remember`",
diff --git a/compose/runtime/runtime-lint/src/test/java/androidx/compose/runtime/lint/AutoboxingStateCreationDetectorTest.kt b/compose/runtime/runtime-lint/src/test/java/androidx/compose/runtime/lint/AutoboxingStateCreationDetectorTest.kt
new file mode 100644
index 0000000..06eb0d1
--- /dev/null
+++ b/compose/runtime/runtime-lint/src/test/java/androidx/compose/runtime/lint/AutoboxingStateCreationDetectorTest.kt
@@ -0,0 +1,505 @@
+/*
+ * Copyright 2023 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 androidx.compose.runtime.lint
+
+import androidx.compose.lint.test.Stubs
+import com.android.tools.lint.checks.infrastructure.LintDetectorTest
+import com.android.tools.lint.detector.api.Detector
+import com.android.tools.lint.detector.api.Issue
+import org.jetbrains.kotlin.util.capitalizeDecapitalize.toLowerCaseAsciiOnly
+import org.junit.Test
+import org.junit.runner.RunWith
+import org.junit.runners.Parameterized
+
+/* ktlint-disable max-line-length */
+@RunWith(Parameterized::class)
+class AutoboxingStateCreationDetectorTest(
+ typeUnderTest: TypeUnderTest
+) : LintDetectorTest() {
+
+ private val fqType = typeUnderTest.fqName
+ private val type = typeUnderTest.typeName
+ private val stateValue = typeUnderTest.sampleValue
+
+ private val primitiveStateStub = kotlin(
+ """
+ package androidx.compose.runtime
+
+ import kotlin.reflect.KProperty
+ import $fqType
+
+ fun mutable${type}StateOf(value: $type): Mutable${type}State {
+ TODO("Not implemented in lint stubs.")
+ }
+
+ interface Mutable${type}State : State<$type> {
+ override var value: $type
+ var ${type.toLowerCaseAsciiOnly()}Value: $type
+ }
+
+ @Suppress("NOTHING_TO_INLINE")
+ inline operator fun Mutable${type}State.getValue(
+ thisObj: Any?,
+ property: KProperty<*>
+ ): $type = ${type.toLowerCaseAsciiOnly()}Value
+
+ @Suppress("NOTHING_TO_INLINE")
+ inline operator fun Mutable${type}State.setValue(
+ thisObj: Any?,
+ property: KProperty<*>,
+ value: $type
+ ) {
+ ${type.toLowerCaseAsciiOnly()}Value = value
+ }
+ """
+ )
+
+ override fun getDetector(): Detector = AutoboxingStateCreationDetector()
+
+ override fun getIssues(): MutableList<Issue> =
+ mutableListOf(AutoboxingStateCreationDetector.AutoboxingStateCreation)
+
+ @Test
+ fun testTrivialMutableStateOf_thatCouldBeMutablePrimitiveStateOf() {
+ lint().files(
+ primitiveStateStub,
+ Stubs.Composable,
+ Stubs.SnapshotState,
+ kotlin(
+ """
+ package androidx.compose.runtime.lint.test
+
+ import androidx.compose.runtime.*
+ import $fqType
+
+ fun valueAssignment() {
+ val state = mutableStateOf<$type>($stateValue)
+ state.value = $stateValue
+ }
+ """
+ )
+ ).run().expect(
+ """
+src/androidx/compose/runtime/lint/test/test.kt:8: Warning: Prefer mutable${type}StateOf instead of mutableStateOf [AutoboxingStateCreation]
+ val state = mutableStateOf<$type>($stateValue)
+ ~~~~~~~~~~~~~~
+0 errors, 1 warnings
+ """
+ ).expectFixDiffs(
+ """
+Fix for src/androidx/compose/runtime/lint/test/test.kt line 8: Replace with mutable${type}StateOf:
+@@ -8 +8
+- val state = mutableStateOf<$type>($stateValue)
++ val state = mutable${type}StateOf($stateValue)
+ """
+ )
+ }
+
+ @Test
+ fun testInferredMutableStateOf_thatCouldBeMutablePrimitiveStateOf() {
+ lint().files(
+ primitiveStateStub,
+ Stubs.Composable,
+ Stubs.SnapshotState,
+ kotlin(
+ """
+ package androidx.compose.runtime.lint.test
+
+ import androidx.compose.runtime.*
+ import $fqType
+
+ fun valueAssignment() {
+ val state = mutableStateOf($stateValue)
+ state.value = $stateValue
+ }
+ """
+ )
+ ).run().expect(
+ """
+src/androidx/compose/runtime/lint/test/test.kt:8: Warning: Prefer mutable${type}StateOf instead of mutableStateOf [AutoboxingStateCreation]
+ val state = mutableStateOf($stateValue)
+ ~~~~~~~~~~~~~~
+0 errors, 1 warnings
+ """
+ ).expectFixDiffs(
+ """
+Fix for src/androidx/compose/runtime/lint/test/test.kt line 8: Replace with mutable${type}StateOf:
+@@ -8 +8
+- val state = mutableStateOf($stateValue)
++ val state = mutable${type}StateOf($stateValue)
+ """
+ )
+ }
+
+ @Test
+ fun testFqMutableStateOf_thatCouldBeMutablePrimitiveStateOf() {
+ lint().files(
+ primitiveStateStub,
+ Stubs.Composable,
+ Stubs.SnapshotState,
+ kotlin(
+ """
+ package androidx.compose.runtime.lint.test
+
+ import androidx.compose.runtime.*
+ import $fqType
+
+ fun valueAssignment() {
+ val state = mutableStateOf<$fqType>($stateValue)
+ state.value = $stateValue
+ }
+ """
+ )
+ ).run().expect(
+ """
+src/androidx/compose/runtime/lint/test/test.kt:8: Warning: Prefer mutable${type}StateOf instead of mutableStateOf [AutoboxingStateCreation]
+ val state = mutableStateOf<$fqType>($stateValue)
+ ~~~~~~~~~~~~~~
+0 errors, 1 warnings
+ """
+ ).expectFixDiffs(
+ """
+Fix for src/androidx/compose/runtime/lint/test/test.kt line 8: Replace with mutable${type}StateOf:
+@@ -8 +8
+- val state = mutableStateOf<$fqType>($stateValue)
++ val state = mutable${type}StateOf($stateValue)
+ """
+ )
+ }
+
+ @Test
+ fun testStateDelegate_withExplicitType_thatCouldBeMutablePrimitiveStateOf() {
+ lint().files(
+ primitiveStateStub,
+ Stubs.Composable,
+ Stubs.SnapshotState,
+ kotlin(
+ """
+ package androidx.compose.runtime.lint.test
+
+ import androidx.compose.runtime.*
+ import $fqType
+
+ fun propertyDelegation() {
+ var state by mutableStateOf<$type>($stateValue)
+ state = $stateValue
+ }
+ """
+ )
+ ).run().expect(
+ """
+src/androidx/compose/runtime/lint/test/test.kt:8: Warning: Prefer mutable${type}StateOf instead of mutableStateOf [AutoboxingStateCreation]
+ var state by mutableStateOf<$type>($stateValue)
+ ~~~~~~~~~~~~~~
+0 errors, 1 warnings
+ """
+ ).expectFixDiffs(
+ """
+Fix for src/androidx/compose/runtime/lint/test/test.kt line 8: Replace with mutable${type}StateOf:
+@@ -8 +8
+- var state by mutableStateOf<$type>($stateValue)
++ var state by mutable${type}StateOf($stateValue)
+ """
+ )
+ }
+
+ @Test
+ fun testStateDelegate_withInferredType_thatCouldBeMutablePrimitiveStateOf() {
+ lint().files(
+ primitiveStateStub,
+ Stubs.Composable,
+ Stubs.SnapshotState,
+ kotlin(
+ """
+ package androidx.compose.runtime.lint.test
+
+ import androidx.compose.runtime.*
+ import $fqType
+
+ fun propertyDelegation() {
+ var state by mutableStateOf($stateValue)
+ state = $stateValue
+ }
+ """
+ )
+ ).run().expect(
+ """
+src/androidx/compose/runtime/lint/test/test.kt:8: Warning: Prefer mutable${type}StateOf instead of mutableStateOf [AutoboxingStateCreation]
+ var state by mutableStateOf($stateValue)
+ ~~~~~~~~~~~~~~
+0 errors, 1 warnings
+ """
+ ).expectFixDiffs(
+ """
+Fix for src/androidx/compose/runtime/lint/test/test.kt line 8: Replace with mutable${type}StateOf:
+@@ -8 +8
+- var state by mutableStateOf($stateValue)
++ var state by mutable${type}StateOf($stateValue)
+ """
+ )
+ }
+
+ @Test
+ fun testStateDelegate_withInferredType_andInternalSetter_thatCouldBeMutablePrimitiveStateOf() {
+ lint().files(
+ primitiveStateStub,
+ Stubs.Composable,
+ Stubs.SnapshotState,
+ kotlin(
+ """
+ package androidx.compose.runtime.lint.test
+
+ import androidx.compose.runtime.*
+ import $fqType
+
+ class Test(initialValue: $type = $stateValue) {
+ var state by mutableStateOf(initialValue)
+ private set
+ }
+ """
+ )
+ ).run().expect(
+ """
+src/androidx/compose/runtime/lint/test/Test.kt:8: Warning: Prefer mutable${type}StateOf instead of mutableStateOf [AutoboxingStateCreation]
+ var state by mutableStateOf(initialValue)
+ ~~~~~~~~~~~~~~
+0 errors, 1 warnings
+ """
+ ).expectFixDiffs(
+ """
+Fix for src/androidx/compose/runtime/lint/test/Test.kt line 7: Replace with mutable${type}StateOf:
+@@ -8 +8
+- var state by mutableStateOf(initialValue)
++ var state by mutable${type}StateOf(initialValue)
+ """
+ )
+ }
+
+ @Test
+ fun testStateDelegate_withTypeInferredFromProperty_thatCouldBeMutablePrimitiveStateOf() {
+ lint().files(
+ primitiveStateStub,
+ Stubs.Composable,
+ Stubs.SnapshotState,
+ kotlin(
+ """
+ package androidx.compose.runtime.lint.test
+
+ import androidx.compose.runtime.*
+ import $fqType
+
+ fun propertyDelegation() {
+ var state: $type by mutableStateOf($stateValue)
+ state = $stateValue
+ }
+ """
+ )
+ ).run().expect(
+ """
+src/androidx/compose/runtime/lint/test/test.kt:8: Warning: Prefer mutable${type}StateOf instead of mutableStateOf [AutoboxingStateCreation]
+ var state: $type by mutableStateOf($stateValue)
+ ${" ".repeat(type.length)} ~~~~~~~~~~~~~~
+0 errors, 1 warnings
+ """
+ ).expectFixDiffs(
+ """
+Fix for src/androidx/compose/runtime/lint/test/test.kt line 8: Replace with mutable${type}StateOf:
+@@ -8 +8
+- var state: $type by mutableStateOf($stateValue)
++ var state: $type by mutable${type}StateOf($stateValue)
+ """
+ )
+ }
+
+ @Test
+ fun testStateDelegate_withNullableInferredType_cannotBeReplacedWithMutablePrimitiveStateOf() {
+ lint().files(
+ primitiveStateStub,
+ Stubs.Composable,
+ Stubs.SnapshotState,
+ kotlin(
+ """
+ package androidx.compose.runtime.lint.test
+
+ import androidx.compose.runtime.*
+ import $fqType
+
+ fun propertyDelegation() {
+ var state: $type? by mutableStateOf($stateValue)
+ state = $stateValue
+ }
+ """
+ )
+ ).run().expectClean()
+ }
+
+ @Test
+ fun testInferredMutableStateOf_withExplicitEqualityPolicy_thatCouldBeMutablePrimitiveStateOf() {
+ lint().files(
+ primitiveStateStub,
+ Stubs.Composable,
+ Stubs.SnapshotState,
+ kotlin(
+ """
+ package androidx.compose.runtime.lint.test
+
+ import androidx.compose.runtime.*
+ import $fqType
+
+ fun valueAssignment() {
+ val state = mutableStateOf($stateValue, structuralEqualityPolicy())
+ state.value = $stateValue
+ }
+ """
+ )
+ ).run().expect(
+ """
+src/androidx/compose/runtime/lint/test/test.kt:8: Warning: Prefer mutable${type}StateOf instead of mutableStateOf [AutoboxingStateCreation]
+ val state = mutableStateOf($stateValue, structuralEqualityPolicy())
+ ~~~~~~~~~~~~~~
+0 errors, 1 warnings
+ """
+ ).expectFixDiffs(
+ """
+Fix for src/androidx/compose/runtime/lint/test/test.kt line 8: Replace with mutable${type}StateOf:
+@@ -8 +8
+- val state = mutableStateOf($stateValue, structuralEqualityPolicy())
++ val state = mutable${type}StateOf($stateValue)
+ """
+ )
+ }
+
+ @Test
+ fun testNonStructuralEqualityPolicy_cannotBeReplacedWithMutablePrimitiveStateOf() {
+ lint().files(
+ primitiveStateStub,
+ Stubs.Composable,
+ Stubs.SnapshotState,
+ kotlin(
+ """
+ package androidx.compose.runtime.lint.test
+
+ import androidx.compose.runtime.*
+ import $fqType
+
+ fun valueAssignment() {
+ val state = mutableStateOf($stateValue, neverEqualPolicy())
+ state.value = $stateValue
+ }
+ """
+ )
+ ).run().expectClean()
+ }
+
+ @Test
+ fun testNullableMutableStateOf_cannotBeReplacedWithMutablePrimitiveStateOf() {
+ lint().files(
+ primitiveStateStub,
+ Stubs.Composable,
+ Stubs.SnapshotState,
+ kotlin(
+ """
+ package androidx.compose.runtime.lint.test
+
+ import androidx.compose.runtime.*
+ import $fqType
+
+ fun valueAssignment() {
+ val state = mutableStateOf<$type?>($stateValue)
+ state.value = $stateValue
+ }
+ """
+ )
+ ).run().expectClean()
+ }
+
+ @Test
+ fun testInferredNullableMutableStateOf_cannotBeReplacedWithMutablePrimitiveStateOf() {
+ lint().files(
+ primitiveStateStub,
+ Stubs.Composable,
+ Stubs.SnapshotState,
+ kotlin(
+ """
+ package androidx.compose.runtime.lint.test
+
+ import androidx.compose.runtime.*
+ import $fqType
+
+ fun valueAssignment() {
+ val state: MutableState<$type?> = mutableStateOf($stateValue)
+ state.value = $stateValue
+ }
+ """
+ )
+ ).run().expectClean()
+ }
+
+ @Test
+ fun testInferredByCastNullableMutableStateOf_cannotBeReplacedWithMutablePrimitiveStateOf() {
+ lint().files(
+ primitiveStateStub,
+ Stubs.Composable,
+ Stubs.SnapshotState,
+ kotlin(
+ """
+ package androidx.compose.runtime.lint.test
+
+ import androidx.compose.runtime.*
+ import $fqType
+
+ fun valueAssignment() {
+ val state = mutableStateOf($stateValue as $type?)
+ state.value = $stateValue
+ }
+ """
+ )
+ ).run().expectClean()
+ }
+
+ companion object {
+ @JvmStatic
+ @Parameterized.Parameters(name = "{0}")
+ fun initParameters() = listOf(
+ testCase("kotlin.Int", "42"),
+ testCase("kotlin.Long", "0xABCDEF1234"),
+ testCase("kotlin.Float", "1.5f"),
+ testCase("kotlin.Double", "1.024")
+ )
+
+ private fun testCase(fqName: String, value: String): TypeUnderTest {
+ val parts = fqName.split('.')
+ return TypeUnderTest(
+ fqName = fqName,
+ typeName = parts.last(),
+ packageName = parts.dropLast(1).joinToString(separator = "."),
+ sampleValue = value
+ )
+ }
+ }
+
+ data class TypeUnderTest(
+ val fqName: String,
+ val typeName: String,
+ val packageName: String,
+ val sampleValue: String,
+ ) {
+ // Formatting for test parameter list.
+ override fun toString() = "type = $fqName"
+ }
+}
+/* ktlint-enable max-line-length */
\ No newline at end of file
diff --git a/compose/runtime/runtime-lint/src/test/java/androidx/compose/runtime/lint/UnrememberedStateDetectorTest.kt b/compose/runtime/runtime-lint/src/test/java/androidx/compose/runtime/lint/UnrememberedStateDetectorTest.kt
index 77863fd..a10571f 100644
--- a/compose/runtime/runtime-lint/src/test/java/androidx/compose/runtime/lint/UnrememberedStateDetectorTest.kt
+++ b/compose/runtime/runtime-lint/src/test/java/androidx/compose/runtime/lint/UnrememberedStateDetectorTest.kt
@@ -118,6 +118,7 @@
),
Stubs.Composable,
Stubs.SnapshotState,
+ Stubs.StateFactoryMarker,
Stubs.Remember
)
.skipTestModes(TestMode.TYPE_ALIAS)
@@ -315,6 +316,7 @@
),
Stubs.Composable,
Stubs.SnapshotState,
+ Stubs.StateFactoryMarker,
Stubs.Remember
)
.run()
@@ -418,5 +420,107 @@
.run()
.expectClean()
}
+
+ @Test
+ fun arbitraryStateFactoryAnnotated() {
+ lint().files(
+ kotlin(
+ """
+ package androidx.compose.runtime.foo
+
+ import androidx.compose.runtime.*
+ import androidx.compose.runtime.snapshots.StateFactoryMarker
+
+ @StateFactoryMarker
+ fun makeMyState(): State<Nothing> = TODO()
+
+ @Composable
+ fun Test() {
+ val foo = makeMyState()
+ val bar = remember { makeMyState() }
+ }
+
+ val lambda = @Composable {
+ val foo = makeMyState()
+ val bar = remember { makeMyState() }
+ }
+
+ val lambda2: @Composable () -> Unit = {
+ val foo = makeMyState()
+ val bar = remember { makeMyState() }
+ }
+
+ @Composable
+ fun LambdaParameter(content: @Composable () -> Unit) {}
+
+ @Composable
+ fun Test2() {
+ LambdaParameter(content = {
+ val foo = makeMyState()
+ val bar = remember { makeMyState() }
+ })
+ LambdaParameter {
+ val foo = makeMyState()
+ val bar = remember { makeMyState() }
+ }
+ }
+
+ fun test3() {
+ val localLambda1 = @Composable {
+ val foo = makeMyState()
+ val bar = remember { makeMyState() }
+ }
+
+ val localLambda2: @Composable () -> Unit = {
+ val foo = makeMyState()
+ val bar = remember { makeMyState() }
+ }
+ }
+
+ @Composable
+ fun Test4() {
+ val localObject = object {
+ val foo = makeMyState()
+ val bar = remember { makeMyState() }
+ }
+ }
+ """
+ ),
+ Stubs.Composable,
+ Stubs.SnapshotState,
+ Stubs.StateFactoryMarker,
+ Stubs.Remember
+ )
+ .skipTestModes(TestMode.TYPE_ALIAS)
+ .run()
+ .expect("""
+src/androidx/compose/runtime/foo/{.kt:12: Error: Creating a state object during composition without using remember [UnrememberedMutableState]
+ val foo = makeMyState()
+ ~~~~~~~~~~~
+src/androidx/compose/runtime/foo/{.kt:17: Error: Creating a state object during composition without using remember [UnrememberedMutableState]
+ val foo = makeMyState()
+ ~~~~~~~~~~~
+src/androidx/compose/runtime/foo/{.kt:22: Error: Creating a state object during composition without using remember [UnrememberedMutableState]
+ val foo = makeMyState()
+ ~~~~~~~~~~~
+src/androidx/compose/runtime/foo/{.kt:32: Error: Creating a state object during composition without using remember [UnrememberedMutableState]
+ val foo = makeMyState()
+ ~~~~~~~~~~~
+src/androidx/compose/runtime/foo/{.kt:36: Error: Creating a state object during composition without using remember [UnrememberedMutableState]
+ val foo = makeMyState()
+ ~~~~~~~~~~~
+src/androidx/compose/runtime/foo/{.kt:43: Error: Creating a state object during composition without using remember [UnrememberedMutableState]
+ val foo = makeMyState()
+ ~~~~~~~~~~~
+src/androidx/compose/runtime/foo/{.kt:48: Error: Creating a state object during composition without using remember [UnrememberedMutableState]
+ val foo = makeMyState()
+ ~~~~~~~~~~~
+src/androidx/compose/runtime/foo/{.kt:56: Error: Creating a state object during composition without using remember [UnrememberedMutableState]
+ val foo = makeMyState()
+ ~~~~~~~~~~~
+8 errors, 0 warnings
+ """
+ )
+ }
}
/* ktlint-enable max-line-length */
diff --git a/compose/runtime/runtime-livedata/samples/src/main/AndroidManifest.xml b/compose/runtime/runtime-livedata/samples/src/main/AndroidManifest.xml
deleted file mode 100644
index deac81d..0000000
--- a/compose/runtime/runtime-livedata/samples/src/main/AndroidManifest.xml
+++ /dev/null
@@ -1,17 +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.
- -->
-
-<manifest />
diff --git a/compose/runtime/runtime-livedata/src/androidTest/AndroidManifest.xml b/compose/runtime/runtime-livedata/src/androidTest/AndroidManifest.xml
deleted file mode 100644
index 9cd4123..0000000
--- a/compose/runtime/runtime-livedata/src/androidTest/AndroidManifest.xml
+++ /dev/null
@@ -1,17 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
- 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.
- -->
-<manifest />
diff --git a/compose/runtime/runtime-livedata/src/main/AndroidManifest.xml b/compose/runtime/runtime-livedata/src/main/AndroidManifest.xml
deleted file mode 100644
index 9cd4123..0000000
--- a/compose/runtime/runtime-livedata/src/main/AndroidManifest.xml
+++ /dev/null
@@ -1,17 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
- 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.
- -->
-<manifest />
diff --git a/compose/runtime/runtime-rxjava2/samples/src/main/AndroidManifest.xml b/compose/runtime/runtime-rxjava2/samples/src/main/AndroidManifest.xml
deleted file mode 100644
index deac81d..0000000
--- a/compose/runtime/runtime-rxjava2/samples/src/main/AndroidManifest.xml
+++ /dev/null
@@ -1,17 +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.
- -->
-
-<manifest />
diff --git a/compose/runtime/runtime-rxjava2/src/androidTest/AndroidManifest.xml b/compose/runtime/runtime-rxjava2/src/androidTest/AndroidManifest.xml
deleted file mode 100644
index 9cd4123..0000000
--- a/compose/runtime/runtime-rxjava2/src/androidTest/AndroidManifest.xml
+++ /dev/null
@@ -1,17 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
- 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.
- -->
-<manifest />
diff --git a/compose/runtime/runtime-rxjava2/src/main/AndroidManifest.xml b/compose/runtime/runtime-rxjava2/src/main/AndroidManifest.xml
deleted file mode 100644
index 9cd4123..0000000
--- a/compose/runtime/runtime-rxjava2/src/main/AndroidManifest.xml
+++ /dev/null
@@ -1,17 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
- 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.
- -->
-<manifest />
diff --git a/compose/runtime/runtime-rxjava3/samples/src/main/AndroidManifest.xml b/compose/runtime/runtime-rxjava3/samples/src/main/AndroidManifest.xml
deleted file mode 100644
index deac81d..0000000
--- a/compose/runtime/runtime-rxjava3/samples/src/main/AndroidManifest.xml
+++ /dev/null
@@ -1,17 +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.
- -->
-
-<manifest />
diff --git a/compose/runtime/runtime-rxjava3/src/androidTest/AndroidManifest.xml b/compose/runtime/runtime-rxjava3/src/androidTest/AndroidManifest.xml
deleted file mode 100644
index 9cd4123..0000000
--- a/compose/runtime/runtime-rxjava3/src/androidTest/AndroidManifest.xml
+++ /dev/null
@@ -1,17 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
- 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.
- -->
-<manifest />
diff --git a/compose/runtime/runtime-rxjava3/src/main/AndroidManifest.xml b/compose/runtime/runtime-rxjava3/src/main/AndroidManifest.xml
deleted file mode 100644
index 9cd4123..0000000
--- a/compose/runtime/runtime-rxjava3/src/main/AndroidManifest.xml
+++ /dev/null
@@ -1,17 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
- 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.
- -->
-<manifest />
diff --git a/compose/runtime/runtime-saveable/samples/src/main/AndroidManifest.xml b/compose/runtime/runtime-saveable/samples/src/main/AndroidManifest.xml
deleted file mode 100644
index deac81d..0000000
--- a/compose/runtime/runtime-saveable/samples/src/main/AndroidManifest.xml
+++ /dev/null
@@ -1,17 +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.
- -->
-
-<manifest />
diff --git a/compose/runtime/runtime-saveable/src/androidMain/AndroidManifest.xml b/compose/runtime/runtime-saveable/src/androidMain/AndroidManifest.xml
deleted file mode 100644
index 9cd4123..0000000
--- a/compose/runtime/runtime-saveable/src/androidMain/AndroidManifest.xml
+++ /dev/null
@@ -1,17 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
- 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.
- -->
-<manifest />
diff --git a/compose/runtime/runtime/api/current.txt b/compose/runtime/runtime/api/current.txt
index 35456b2..2ba2092 100644
--- a/compose/runtime/runtime/api/current.txt
+++ b/compose/runtime/runtime/api/current.txt
@@ -385,7 +385,7 @@
public final class PrimitiveSnapshotStateKt {
method public static inline operator float getValue(androidx.compose.runtime.FloatState, Object? thisObj, kotlin.reflect.KProperty<?> property);
- method public static androidx.compose.runtime.MutableFloatState mutableFloatStateOf(float value);
+ method @androidx.compose.runtime.snapshots.StateFactoryMarker public static androidx.compose.runtime.MutableFloatState mutableFloatStateOf(float value);
method public static inline operator void setValue(androidx.compose.runtime.MutableFloatState, Object? thisObj, kotlin.reflect.KProperty<?> property, float value);
}
@@ -483,19 +483,19 @@
public final class SnapshotDoubleStateKt {
method public static inline operator double getValue(androidx.compose.runtime.DoubleState, Object? thisObj, kotlin.reflect.KProperty<?> property);
- method public static androidx.compose.runtime.MutableDoubleState mutableDoubleStateOf(double value);
+ method @androidx.compose.runtime.snapshots.StateFactoryMarker public static androidx.compose.runtime.MutableDoubleState mutableDoubleStateOf(double value);
method public static inline operator void setValue(androidx.compose.runtime.MutableDoubleState, Object? thisObj, kotlin.reflect.KProperty<?> property, double value);
}
public final class SnapshotIntStateKt {
method public static inline operator int getValue(androidx.compose.runtime.IntState, Object? thisObj, kotlin.reflect.KProperty<?> property);
- method public static androidx.compose.runtime.MutableIntState mutableIntStateOf(int value);
+ method @androidx.compose.runtime.snapshots.StateFactoryMarker public static androidx.compose.runtime.MutableIntState mutableIntStateOf(int value);
method public static inline operator void setValue(androidx.compose.runtime.MutableIntState, Object? thisObj, kotlin.reflect.KProperty<?> property, int value);
}
public final class SnapshotLongStateKt {
method public static inline operator long getValue(androidx.compose.runtime.LongState, Object? thisObj, kotlin.reflect.KProperty<?> property);
- method public static androidx.compose.runtime.MutableLongState mutableLongStateOf(long value);
+ method @androidx.compose.runtime.snapshots.StateFactoryMarker public static androidx.compose.runtime.MutableLongState mutableLongStateOf(long value);
method public static inline operator void setValue(androidx.compose.runtime.MutableLongState, Object? thisObj, kotlin.reflect.KProperty<?> property, long value);
}
@@ -514,14 +514,14 @@
public final class SnapshotStateKt {
method @androidx.compose.runtime.Composable public static <T> androidx.compose.runtime.State<T> collectAsState(kotlinx.coroutines.flow.StateFlow<? extends T>, optional kotlin.coroutines.CoroutineContext context);
method @androidx.compose.runtime.Composable public static <T extends R, R> androidx.compose.runtime.State<R> collectAsState(kotlinx.coroutines.flow.Flow<? extends T>, R initial, optional kotlin.coroutines.CoroutineContext context);
- method public static <T> androidx.compose.runtime.State<T> derivedStateOf(kotlin.jvm.functions.Function0<? extends T> calculation);
- method public static <T> androidx.compose.runtime.State<T> derivedStateOf(androidx.compose.runtime.SnapshotMutationPolicy<T> policy, kotlin.jvm.functions.Function0<? extends T> calculation);
+ method @androidx.compose.runtime.snapshots.StateFactoryMarker public static <T> androidx.compose.runtime.State<T> derivedStateOf(kotlin.jvm.functions.Function0<? extends T> calculation);
+ method @androidx.compose.runtime.snapshots.StateFactoryMarker public static <T> androidx.compose.runtime.State<T> derivedStateOf(androidx.compose.runtime.SnapshotMutationPolicy<T> policy, kotlin.jvm.functions.Function0<? extends T> calculation);
method public static inline operator <T> T getValue(androidx.compose.runtime.State<? extends T>, Object? thisObj, kotlin.reflect.KProperty<?> property);
- method public static <T> androidx.compose.runtime.snapshots.SnapshotStateList<T> mutableStateListOf();
- method public static <T> androidx.compose.runtime.snapshots.SnapshotStateList<T> mutableStateListOf(T?... elements);
- method public static <K, V> androidx.compose.runtime.snapshots.SnapshotStateMap<K,V> mutableStateMapOf();
- method public static <K, V> androidx.compose.runtime.snapshots.SnapshotStateMap<K,V> mutableStateMapOf(kotlin.Pair<? extends K,? extends V>... pairs);
- method public static <T> androidx.compose.runtime.MutableState<T> mutableStateOf(T value, optional androidx.compose.runtime.SnapshotMutationPolicy<T> policy);
+ method @androidx.compose.runtime.snapshots.StateFactoryMarker public static <T> androidx.compose.runtime.snapshots.SnapshotStateList<T> mutableStateListOf();
+ method @androidx.compose.runtime.snapshots.StateFactoryMarker public static <T> androidx.compose.runtime.snapshots.SnapshotStateList<T> mutableStateListOf(T?... elements);
+ method @androidx.compose.runtime.snapshots.StateFactoryMarker public static <K, V> androidx.compose.runtime.snapshots.SnapshotStateMap<K,V> mutableStateMapOf();
+ method @androidx.compose.runtime.snapshots.StateFactoryMarker public static <K, V> androidx.compose.runtime.snapshots.SnapshotStateMap<K,V> mutableStateMapOf(kotlin.Pair<? extends K,? extends V>... pairs);
+ method @androidx.compose.runtime.snapshots.StateFactoryMarker public static <T> androidx.compose.runtime.MutableState<T> mutableStateOf(T value, optional androidx.compose.runtime.SnapshotMutationPolicy<T> policy);
method public static <T> androidx.compose.runtime.SnapshotMutationPolicy<T> neverEqualPolicy();
method @androidx.compose.runtime.Composable public static <T> androidx.compose.runtime.State<T> produceState(T initialValue, kotlin.jvm.functions.Function2<? super androidx.compose.runtime.ProduceStateScope<T>,? super kotlin.coroutines.Continuation<? super kotlin.Unit>,?> producer);
method @androidx.compose.runtime.Composable public static <T> androidx.compose.runtime.State<T> produceState(T initialValue, Object? key1, kotlin.jvm.functions.Function2<? super androidx.compose.runtime.ProduceStateScope<T>,? super kotlin.coroutines.Continuation<? super kotlin.Unit>,?> producer);
@@ -887,6 +887,9 @@
method @Deprecated public void withNoObservations(kotlin.jvm.functions.Function0<kotlin.Unit> block);
}
+ @kotlin.annotation.MustBeDocumented @kotlin.annotation.Retention(kotlin.annotation.AnnotationRetention.BINARY) @kotlin.annotation.Target(allowedTargets=kotlin.annotation.AnnotationTarget.FUNCTION) public @interface StateFactoryMarker {
+ }
+
@kotlin.jvm.JvmDefaultWithCompatibility public interface StateObject {
method public androidx.compose.runtime.snapshots.StateRecord getFirstStateRecord();
method public default androidx.compose.runtime.snapshots.StateRecord? mergeRecords(androidx.compose.runtime.snapshots.StateRecord previous, androidx.compose.runtime.snapshots.StateRecord current, androidx.compose.runtime.snapshots.StateRecord applied);
diff --git a/compose/runtime/runtime/api/public_plus_experimental_current.txt b/compose/runtime/runtime/api/public_plus_experimental_current.txt
index 5c926bd..6edfaf4 100644
--- a/compose/runtime/runtime/api/public_plus_experimental_current.txt
+++ b/compose/runtime/runtime/api/public_plus_experimental_current.txt
@@ -433,7 +433,7 @@
public final class PrimitiveSnapshotStateKt {
method public static inline operator float getValue(androidx.compose.runtime.FloatState, Object? thisObj, kotlin.reflect.KProperty<?> property);
- method public static androidx.compose.runtime.MutableFloatState mutableFloatStateOf(float value);
+ method @androidx.compose.runtime.snapshots.StateFactoryMarker public static androidx.compose.runtime.MutableFloatState mutableFloatStateOf(float value);
method public static inline operator void setValue(androidx.compose.runtime.MutableFloatState, Object? thisObj, kotlin.reflect.KProperty<?> property, float value);
}
@@ -532,19 +532,19 @@
public final class SnapshotDoubleStateKt {
method public static inline operator double getValue(androidx.compose.runtime.DoubleState, Object? thisObj, kotlin.reflect.KProperty<?> property);
- method public static androidx.compose.runtime.MutableDoubleState mutableDoubleStateOf(double value);
+ method @androidx.compose.runtime.snapshots.StateFactoryMarker public static androidx.compose.runtime.MutableDoubleState mutableDoubleStateOf(double value);
method public static inline operator void setValue(androidx.compose.runtime.MutableDoubleState, Object? thisObj, kotlin.reflect.KProperty<?> property, double value);
}
public final class SnapshotIntStateKt {
method public static inline operator int getValue(androidx.compose.runtime.IntState, Object? thisObj, kotlin.reflect.KProperty<?> property);
- method public static androidx.compose.runtime.MutableIntState mutableIntStateOf(int value);
+ method @androidx.compose.runtime.snapshots.StateFactoryMarker public static androidx.compose.runtime.MutableIntState mutableIntStateOf(int value);
method public static inline operator void setValue(androidx.compose.runtime.MutableIntState, Object? thisObj, kotlin.reflect.KProperty<?> property, int value);
}
public final class SnapshotLongStateKt {
method public static inline operator long getValue(androidx.compose.runtime.LongState, Object? thisObj, kotlin.reflect.KProperty<?> property);
- method public static androidx.compose.runtime.MutableLongState mutableLongStateOf(long value);
+ method @androidx.compose.runtime.snapshots.StateFactoryMarker public static androidx.compose.runtime.MutableLongState mutableLongStateOf(long value);
method public static inline operator void setValue(androidx.compose.runtime.MutableLongState, Object? thisObj, kotlin.reflect.KProperty<?> property, long value);
}
@@ -563,14 +563,14 @@
public final class SnapshotStateKt {
method @androidx.compose.runtime.Composable public static <T> androidx.compose.runtime.State<T> collectAsState(kotlinx.coroutines.flow.StateFlow<? extends T>, optional kotlin.coroutines.CoroutineContext context);
method @androidx.compose.runtime.Composable public static <T extends R, R> androidx.compose.runtime.State<R> collectAsState(kotlinx.coroutines.flow.Flow<? extends T>, R initial, optional kotlin.coroutines.CoroutineContext context);
- method public static <T> androidx.compose.runtime.State<T> derivedStateOf(kotlin.jvm.functions.Function0<? extends T> calculation);
- method public static <T> androidx.compose.runtime.State<T> derivedStateOf(androidx.compose.runtime.SnapshotMutationPolicy<T> policy, kotlin.jvm.functions.Function0<? extends T> calculation);
+ method @androidx.compose.runtime.snapshots.StateFactoryMarker public static <T> androidx.compose.runtime.State<T> derivedStateOf(kotlin.jvm.functions.Function0<? extends T> calculation);
+ method @androidx.compose.runtime.snapshots.StateFactoryMarker public static <T> androidx.compose.runtime.State<T> derivedStateOf(androidx.compose.runtime.SnapshotMutationPolicy<T> policy, kotlin.jvm.functions.Function0<? extends T> calculation);
method public static inline operator <T> T getValue(androidx.compose.runtime.State<? extends T>, Object? thisObj, kotlin.reflect.KProperty<?> property);
- method public static <T> androidx.compose.runtime.snapshots.SnapshotStateList<T> mutableStateListOf();
- method public static <T> androidx.compose.runtime.snapshots.SnapshotStateList<T> mutableStateListOf(T?... elements);
- method public static <K, V> androidx.compose.runtime.snapshots.SnapshotStateMap<K,V> mutableStateMapOf();
- method public static <K, V> androidx.compose.runtime.snapshots.SnapshotStateMap<K,V> mutableStateMapOf(kotlin.Pair<? extends K,? extends V>... pairs);
- method public static <T> androidx.compose.runtime.MutableState<T> mutableStateOf(T value, optional androidx.compose.runtime.SnapshotMutationPolicy<T> policy);
+ method @androidx.compose.runtime.snapshots.StateFactoryMarker public static <T> androidx.compose.runtime.snapshots.SnapshotStateList<T> mutableStateListOf();
+ method @androidx.compose.runtime.snapshots.StateFactoryMarker public static <T> androidx.compose.runtime.snapshots.SnapshotStateList<T> mutableStateListOf(T?... elements);
+ method @androidx.compose.runtime.snapshots.StateFactoryMarker public static <K, V> androidx.compose.runtime.snapshots.SnapshotStateMap<K,V> mutableStateMapOf();
+ method @androidx.compose.runtime.snapshots.StateFactoryMarker public static <K, V> androidx.compose.runtime.snapshots.SnapshotStateMap<K,V> mutableStateMapOf(kotlin.Pair<? extends K,? extends V>... pairs);
+ method @androidx.compose.runtime.snapshots.StateFactoryMarker public static <T> androidx.compose.runtime.MutableState<T> mutableStateOf(T value, optional androidx.compose.runtime.SnapshotMutationPolicy<T> policy);
method public static <T> androidx.compose.runtime.SnapshotMutationPolicy<T> neverEqualPolicy();
method @androidx.compose.runtime.Composable public static <T> androidx.compose.runtime.State<T> produceState(T initialValue, kotlin.jvm.functions.Function2<? super androidx.compose.runtime.ProduceStateScope<T>,? super kotlin.coroutines.Continuation<? super kotlin.Unit>,?> producer);
method @androidx.compose.runtime.Composable public static <T> androidx.compose.runtime.State<T> produceState(T initialValue, Object? key1, kotlin.jvm.functions.Function2<? super androidx.compose.runtime.ProduceStateScope<T>,? super kotlin.coroutines.Continuation<? super kotlin.Unit>,?> producer);
@@ -967,6 +967,9 @@
method @Deprecated public void withNoObservations(kotlin.jvm.functions.Function0<kotlin.Unit> block);
}
+ @kotlin.annotation.MustBeDocumented @kotlin.annotation.Retention(kotlin.annotation.AnnotationRetention.BINARY) @kotlin.annotation.Target(allowedTargets=kotlin.annotation.AnnotationTarget.FUNCTION) public @interface StateFactoryMarker {
+ }
+
@kotlin.jvm.JvmDefaultWithCompatibility public interface StateObject {
method public androidx.compose.runtime.snapshots.StateRecord getFirstStateRecord();
method public default androidx.compose.runtime.snapshots.StateRecord? mergeRecords(androidx.compose.runtime.snapshots.StateRecord previous, androidx.compose.runtime.snapshots.StateRecord current, androidx.compose.runtime.snapshots.StateRecord applied);
diff --git a/compose/runtime/runtime/api/restricted_current.txt b/compose/runtime/runtime/api/restricted_current.txt
index b855aea..fae054f 100644
--- a/compose/runtime/runtime/api/restricted_current.txt
+++ b/compose/runtime/runtime/api/restricted_current.txt
@@ -417,7 +417,7 @@
public final class PrimitiveSnapshotStateKt {
method public static inline operator float getValue(androidx.compose.runtime.FloatState, Object? thisObj, kotlin.reflect.KProperty<?> property);
- method public static androidx.compose.runtime.MutableFloatState mutableFloatStateOf(float value);
+ method @androidx.compose.runtime.snapshots.StateFactoryMarker public static androidx.compose.runtime.MutableFloatState mutableFloatStateOf(float value);
method public static inline operator void setValue(androidx.compose.runtime.MutableFloatState, Object? thisObj, kotlin.reflect.KProperty<?> property, float value);
}
@@ -519,19 +519,19 @@
public final class SnapshotDoubleStateKt {
method public static inline operator double getValue(androidx.compose.runtime.DoubleState, Object? thisObj, kotlin.reflect.KProperty<?> property);
- method public static androidx.compose.runtime.MutableDoubleState mutableDoubleStateOf(double value);
+ method @androidx.compose.runtime.snapshots.StateFactoryMarker public static androidx.compose.runtime.MutableDoubleState mutableDoubleStateOf(double value);
method public static inline operator void setValue(androidx.compose.runtime.MutableDoubleState, Object? thisObj, kotlin.reflect.KProperty<?> property, double value);
}
public final class SnapshotIntStateKt {
method public static inline operator int getValue(androidx.compose.runtime.IntState, Object? thisObj, kotlin.reflect.KProperty<?> property);
- method public static androidx.compose.runtime.MutableIntState mutableIntStateOf(int value);
+ method @androidx.compose.runtime.snapshots.StateFactoryMarker public static androidx.compose.runtime.MutableIntState mutableIntStateOf(int value);
method public static inline operator void setValue(androidx.compose.runtime.MutableIntState, Object? thisObj, kotlin.reflect.KProperty<?> property, int value);
}
public final class SnapshotLongStateKt {
method public static inline operator long getValue(androidx.compose.runtime.LongState, Object? thisObj, kotlin.reflect.KProperty<?> property);
- method public static androidx.compose.runtime.MutableLongState mutableLongStateOf(long value);
+ method @androidx.compose.runtime.snapshots.StateFactoryMarker public static androidx.compose.runtime.MutableLongState mutableLongStateOf(long value);
method public static inline operator void setValue(androidx.compose.runtime.MutableLongState, Object? thisObj, kotlin.reflect.KProperty<?> property, long value);
}
@@ -550,14 +550,14 @@
public final class SnapshotStateKt {
method @androidx.compose.runtime.Composable public static <T> androidx.compose.runtime.State<T> collectAsState(kotlinx.coroutines.flow.StateFlow<? extends T>, optional kotlin.coroutines.CoroutineContext context);
method @androidx.compose.runtime.Composable public static <T extends R, R> androidx.compose.runtime.State<R> collectAsState(kotlinx.coroutines.flow.Flow<? extends T>, R initial, optional kotlin.coroutines.CoroutineContext context);
- method public static <T> androidx.compose.runtime.State<T> derivedStateOf(kotlin.jvm.functions.Function0<? extends T> calculation);
- method public static <T> androidx.compose.runtime.State<T> derivedStateOf(androidx.compose.runtime.SnapshotMutationPolicy<T> policy, kotlin.jvm.functions.Function0<? extends T> calculation);
+ method @androidx.compose.runtime.snapshots.StateFactoryMarker public static <T> androidx.compose.runtime.State<T> derivedStateOf(kotlin.jvm.functions.Function0<? extends T> calculation);
+ method @androidx.compose.runtime.snapshots.StateFactoryMarker public static <T> androidx.compose.runtime.State<T> derivedStateOf(androidx.compose.runtime.SnapshotMutationPolicy<T> policy, kotlin.jvm.functions.Function0<? extends T> calculation);
method public static inline operator <T> T getValue(androidx.compose.runtime.State<? extends T>, Object? thisObj, kotlin.reflect.KProperty<?> property);
- method public static <T> androidx.compose.runtime.snapshots.SnapshotStateList<T> mutableStateListOf();
- method public static <T> androidx.compose.runtime.snapshots.SnapshotStateList<T> mutableStateListOf(T?... elements);
- method public static <K, V> androidx.compose.runtime.snapshots.SnapshotStateMap<K,V> mutableStateMapOf();
- method public static <K, V> androidx.compose.runtime.snapshots.SnapshotStateMap<K,V> mutableStateMapOf(kotlin.Pair<? extends K,? extends V>... pairs);
- method public static <T> androidx.compose.runtime.MutableState<T> mutableStateOf(T value, optional androidx.compose.runtime.SnapshotMutationPolicy<T> policy);
+ method @androidx.compose.runtime.snapshots.StateFactoryMarker public static <T> androidx.compose.runtime.snapshots.SnapshotStateList<T> mutableStateListOf();
+ method @androidx.compose.runtime.snapshots.StateFactoryMarker public static <T> androidx.compose.runtime.snapshots.SnapshotStateList<T> mutableStateListOf(T?... elements);
+ method @androidx.compose.runtime.snapshots.StateFactoryMarker public static <K, V> androidx.compose.runtime.snapshots.SnapshotStateMap<K,V> mutableStateMapOf();
+ method @androidx.compose.runtime.snapshots.StateFactoryMarker public static <K, V> androidx.compose.runtime.snapshots.SnapshotStateMap<K,V> mutableStateMapOf(kotlin.Pair<? extends K,? extends V>... pairs);
+ method @androidx.compose.runtime.snapshots.StateFactoryMarker public static <T> androidx.compose.runtime.MutableState<T> mutableStateOf(T value, optional androidx.compose.runtime.SnapshotMutationPolicy<T> policy);
method public static <T> androidx.compose.runtime.SnapshotMutationPolicy<T> neverEqualPolicy();
method @androidx.compose.runtime.Composable public static <T> androidx.compose.runtime.State<T> produceState(T initialValue, kotlin.jvm.functions.Function2<? super androidx.compose.runtime.ProduceStateScope<T>,? super kotlin.coroutines.Continuation<? super kotlin.Unit>,?> producer);
method @androidx.compose.runtime.Composable public static <T> androidx.compose.runtime.State<T> produceState(T initialValue, Object? key1, kotlin.jvm.functions.Function2<? super androidx.compose.runtime.ProduceStateScope<T>,? super kotlin.coroutines.Continuation<? super kotlin.Unit>,?> producer);
@@ -937,6 +937,9 @@
method @Deprecated public void withNoObservations(kotlin.jvm.functions.Function0<kotlin.Unit> block);
}
+ @kotlin.annotation.MustBeDocumented @kotlin.annotation.Retention(kotlin.annotation.AnnotationRetention.BINARY) @kotlin.annotation.Target(allowedTargets=kotlin.annotation.AnnotationTarget.FUNCTION) public @interface StateFactoryMarker {
+ }
+
@kotlin.jvm.JvmDefaultWithCompatibility public interface StateObject {
method public androidx.compose.runtime.snapshots.StateRecord getFirstStateRecord();
method public default androidx.compose.runtime.snapshots.StateRecord? mergeRecords(androidx.compose.runtime.snapshots.StateRecord previous, androidx.compose.runtime.snapshots.StateRecord current, androidx.compose.runtime.snapshots.StateRecord applied);
diff --git a/compose/runtime/runtime/compose-runtime-benchmark/src/main/AndroidManifest.xml b/compose/runtime/runtime/compose-runtime-benchmark/src/main/AndroidManifest.xml
deleted file mode 100644
index df93a1a..0000000
--- a/compose/runtime/runtime/compose-runtime-benchmark/src/main/AndroidManifest.xml
+++ /dev/null
@@ -1,16 +0,0 @@
-<!--
- Copyright 2019 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.
- -->
-<manifest />
\ No newline at end of file
diff --git a/compose/runtime/runtime/integration-tests/src/androidMain/AndroidManifest.xml b/compose/runtime/runtime/integration-tests/src/androidMain/AndroidManifest.xml
deleted file mode 100644
index 9cd4123..0000000
--- a/compose/runtime/runtime/integration-tests/src/androidMain/AndroidManifest.xml
+++ /dev/null
@@ -1,17 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
- 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.
- -->
-<manifest />
diff --git a/compose/runtime/runtime/samples/src/main/AndroidManifest.xml b/compose/runtime/runtime/samples/src/main/AndroidManifest.xml
deleted file mode 100644
index 67aa632..0000000
--- a/compose/runtime/runtime/samples/src/main/AndroidManifest.xml
+++ /dev/null
@@ -1,16 +0,0 @@
-<!--
- ~ Copyright (C) 2019 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
- -->
-<manifest />
diff --git a/compose/runtime/runtime/src/androidMain/AndroidManifest.xml b/compose/runtime/runtime/src/androidMain/AndroidManifest.xml
deleted file mode 100644
index b47339d..0000000
--- a/compose/runtime/runtime/src/androidMain/AndroidManifest.xml
+++ /dev/null
@@ -1,16 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2019 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.
--->
-<manifest />
diff --git a/compose/runtime/runtime/src/commonMain/kotlin/androidx/compose/runtime/DerivedState.kt b/compose/runtime/runtime/src/commonMain/kotlin/androidx/compose/runtime/DerivedState.kt
index 4fa3504..a131262 100644
--- a/compose/runtime/runtime/src/commonMain/kotlin/androidx/compose/runtime/DerivedState.kt
+++ b/compose/runtime/runtime/src/commonMain/kotlin/androidx/compose/runtime/DerivedState.kt
@@ -21,6 +21,7 @@
import androidx.compose.runtime.collection.IdentityArrayMap
import androidx.compose.runtime.collection.MutableVector
import androidx.compose.runtime.snapshots.Snapshot
+import androidx.compose.runtime.snapshots.StateFactoryMarker
import androidx.compose.runtime.snapshots.StateObject
import androidx.compose.runtime.snapshots.StateRecord
import androidx.compose.runtime.snapshots.current
@@ -279,6 +280,7 @@
*
* @param calculation the calculation to create the value this state object represents.
*/
+@StateFactoryMarker
fun <T> derivedStateOf(
calculation: () -> T,
): State<T> = DerivedSnapshotState(calculation, null)
@@ -296,6 +298,7 @@
* @param policy mutation policy to control when changes to the [calculation] result trigger update.
* @param calculation the calculation to create the value this state object represents.
*/
+@StateFactoryMarker
fun <T> derivedStateOf(
policy: SnapshotMutationPolicy<T>,
calculation: () -> T,
diff --git a/compose/runtime/runtime/src/commonMain/kotlin/androidx/compose/runtime/SnapshotDoubleState.kt b/compose/runtime/runtime/src/commonMain/kotlin/androidx/compose/runtime/SnapshotDoubleState.kt
index f4fb14b..8521c5a 100644
--- a/compose/runtime/runtime/src/commonMain/kotlin/androidx/compose/runtime/SnapshotDoubleState.kt
+++ b/compose/runtime/runtime/src/commonMain/kotlin/androidx/compose/runtime/SnapshotDoubleState.kt
@@ -22,6 +22,7 @@
import androidx.compose.runtime.snapshots.AutoboxingStateValueProperty
import androidx.compose.runtime.snapshots.Snapshot
import androidx.compose.runtime.snapshots.SnapshotMutableState
+import androidx.compose.runtime.snapshots.StateFactoryMarker
import androidx.compose.runtime.snapshots.StateObject
import androidx.compose.runtime.snapshots.StateRecord
import androidx.compose.runtime.snapshots.overwritable
@@ -46,6 +47,7 @@
* @see mutableLongStateOf
* @see mutableFloatStateOf
*/
+@StateFactoryMarker
fun mutableDoubleStateOf(
value: Double
): MutableDoubleState = createSnapshotMutableDoubleState(value)
diff --git a/compose/runtime/runtime/src/commonMain/kotlin/androidx/compose/runtime/SnapshotFloatState.kt b/compose/runtime/runtime/src/commonMain/kotlin/androidx/compose/runtime/SnapshotFloatState.kt
index df4a2f7..fa6bfe5 100644
--- a/compose/runtime/runtime/src/commonMain/kotlin/androidx/compose/runtime/SnapshotFloatState.kt
+++ b/compose/runtime/runtime/src/commonMain/kotlin/androidx/compose/runtime/SnapshotFloatState.kt
@@ -21,6 +21,7 @@
import androidx.compose.runtime.snapshots.AutoboxingStateValueProperty
import androidx.compose.runtime.snapshots.Snapshot
import androidx.compose.runtime.snapshots.SnapshotMutableState
+import androidx.compose.runtime.snapshots.StateFactoryMarker
import androidx.compose.runtime.snapshots.StateObject
import androidx.compose.runtime.snapshots.StateRecord
import androidx.compose.runtime.snapshots.overwritable
@@ -45,6 +46,7 @@
* @see mutableLongStateOf
* @see mutableDoubleStateOf
*/
+@StateFactoryMarker
fun mutableFloatStateOf(
value: Float
): MutableFloatState = createSnapshotMutableFloatState(value)
diff --git a/compose/runtime/runtime/src/commonMain/kotlin/androidx/compose/runtime/SnapshotIntState.kt b/compose/runtime/runtime/src/commonMain/kotlin/androidx/compose/runtime/SnapshotIntState.kt
index ec700ee..e43f884 100644
--- a/compose/runtime/runtime/src/commonMain/kotlin/androidx/compose/runtime/SnapshotIntState.kt
+++ b/compose/runtime/runtime/src/commonMain/kotlin/androidx/compose/runtime/SnapshotIntState.kt
@@ -21,6 +21,7 @@
import androidx.compose.runtime.snapshots.AutoboxingStateValueProperty
import androidx.compose.runtime.snapshots.Snapshot
import androidx.compose.runtime.snapshots.SnapshotMutableState
+import androidx.compose.runtime.snapshots.StateFactoryMarker
import androidx.compose.runtime.snapshots.StateObject
import androidx.compose.runtime.snapshots.StateRecord
import androidx.compose.runtime.snapshots.overwritable
@@ -45,6 +46,7 @@
* @see mutableFloatStateOf
* @see mutableDoubleStateOf
*/
+@StateFactoryMarker
fun mutableIntStateOf(
value: Int
): MutableIntState = createSnapshotMutableIntState(value)
diff --git a/compose/runtime/runtime/src/commonMain/kotlin/androidx/compose/runtime/SnapshotLongState.kt b/compose/runtime/runtime/src/commonMain/kotlin/androidx/compose/runtime/SnapshotLongState.kt
index a95ae2e..a22c5c4 100644
--- a/compose/runtime/runtime/src/commonMain/kotlin/androidx/compose/runtime/SnapshotLongState.kt
+++ b/compose/runtime/runtime/src/commonMain/kotlin/androidx/compose/runtime/SnapshotLongState.kt
@@ -22,6 +22,7 @@
import androidx.compose.runtime.snapshots.AutoboxingStateValueProperty
import androidx.compose.runtime.snapshots.Snapshot
import androidx.compose.runtime.snapshots.SnapshotMutableState
+import androidx.compose.runtime.snapshots.StateFactoryMarker
import androidx.compose.runtime.snapshots.StateObject
import androidx.compose.runtime.snapshots.StateRecord
import androidx.compose.runtime.snapshots.overwritable
@@ -46,6 +47,7 @@
* @see mutableFloatStateOf
* @see mutableDoubleStateOf
*/
+@StateFactoryMarker
fun mutableLongStateOf(
value: Long
): MutableLongState = createSnapshotMutableLongState(value)
diff --git a/compose/runtime/runtime/src/commonMain/kotlin/androidx/compose/runtime/SnapshotState.kt b/compose/runtime/runtime/src/commonMain/kotlin/androidx/compose/runtime/SnapshotState.kt
index d408eb3..60e2885 100644
--- a/compose/runtime/runtime/src/commonMain/kotlin/androidx/compose/runtime/SnapshotState.kt
+++ b/compose/runtime/runtime/src/commonMain/kotlin/androidx/compose/runtime/SnapshotState.kt
@@ -22,6 +22,7 @@
import androidx.compose.runtime.snapshots.SnapshotMutableState
import androidx.compose.runtime.snapshots.SnapshotStateList
import androidx.compose.runtime.snapshots.SnapshotStateMap
+import androidx.compose.runtime.snapshots.StateFactoryMarker
import androidx.compose.runtime.snapshots.StateObject
import androidx.compose.runtime.snapshots.StateRecord
import androidx.compose.runtime.snapshots.overwritable
@@ -53,6 +54,7 @@
* @see mutableFloatStateOf
* @see mutableDoubleStateOf
*/
+@StateFactoryMarker
fun <T> mutableStateOf(
value: T,
policy: SnapshotMutationPolicy<T> = structuralEqualityPolicy()
@@ -223,6 +225,7 @@
* @see MutableList
* @see Snapshot.takeSnapshot
*/
+@StateFactoryMarker
fun <T> mutableStateListOf() = SnapshotStateList<T>()
/**
@@ -233,6 +236,7 @@
* @see MutableList
* @see Snapshot.takeSnapshot
*/
+@StateFactoryMarker
fun <T> mutableStateListOf(vararg elements: T) =
SnapshotStateList<T>().also { it.addAll(elements.toList()) }
@@ -252,6 +256,7 @@
* @see MutableMap
* @see Snapshot.takeSnapshot
*/
+@StateFactoryMarker
fun <K, V> mutableStateMapOf() = SnapshotStateMap<K, V>()
/**
@@ -262,6 +267,7 @@
* @see MutableMap
* @see Snapshot.takeSnapshot
*/
+@StateFactoryMarker
fun <K, V> mutableStateMapOf(vararg pairs: Pair<K, V>) =
SnapshotStateMap<K, V>().apply { putAll(pairs.toMap()) }
diff --git a/compose/runtime/runtime/src/commonMain/kotlin/androidx/compose/runtime/snapshots/StateFactoryMarker.kt b/compose/runtime/runtime/src/commonMain/kotlin/androidx/compose/runtime/snapshots/StateFactoryMarker.kt
new file mode 100644
index 0000000..7555423
--- /dev/null
+++ b/compose/runtime/runtime/src/commonMain/kotlin/androidx/compose/runtime/snapshots/StateFactoryMarker.kt
@@ -0,0 +1,29 @@
+/*
+ * Copyright 2023 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 androidx.compose.runtime.snapshots
+
+/**
+ * Designates a function as a factory function that produces a State object. Since State factory
+ * functions create and initialize a state, they should usually only be called once per state value
+ * initialization. This annotation causes all invocations of marked state factory functions to be
+ * checked to ensure that they are not called directly inside the body of a [Composable] function
+ * and are instead wrapped with an appropriate [remember] call.
+ */
+@MustBeDocumented
+@Target(AnnotationTarget.FUNCTION)
+@Retention(AnnotationRetention.BINARY)
+annotation class StateFactoryMarker
\ No newline at end of file
diff --git a/compose/ui/ui-android-stubs/src/main/AndroidManifest.xml b/compose/ui/ui-android-stubs/src/main/AndroidManifest.xml
deleted file mode 100644
index ee19b21..0000000
--- a/compose/ui/ui-android-stubs/src/main/AndroidManifest.xml
+++ /dev/null
@@ -1,16 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 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.
--->
-<manifest />
diff --git a/compose/ui/ui-geometry/src/androidMain/AndroidManifest.xml b/compose/ui/ui-geometry/src/androidMain/AndroidManifest.xml
deleted file mode 100644
index ee19b21..0000000
--- a/compose/ui/ui-geometry/src/androidMain/AndroidManifest.xml
+++ /dev/null
@@ -1,16 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 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.
--->
-<manifest />
diff --git a/compose/ui/ui-graphics/benchmark/test/src/androidTest/AndroidManifest.xml b/compose/ui/ui-graphics/benchmark/test/src/androidTest/AndroidManifest.xml
deleted file mode 100644
index e865f27..0000000
--- a/compose/ui/ui-graphics/benchmark/test/src/androidTest/AndroidManifest.xml
+++ /dev/null
@@ -1,17 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
- ~ Copyright 2021 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.
- -->
-<manifest />
diff --git a/compose/ui/ui-graphics/samples/src/main/AndroidManifest.xml b/compose/ui/ui-graphics/samples/src/main/AndroidManifest.xml
deleted file mode 100644
index deac81d..0000000
--- a/compose/ui/ui-graphics/samples/src/main/AndroidManifest.xml
+++ /dev/null
@@ -1,17 +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.
- -->
-
-<manifest />
diff --git a/compose/ui/ui-graphics/src/androidMain/AndroidManifest.xml b/compose/ui/ui-graphics/src/androidMain/AndroidManifest.xml
deleted file mode 100644
index ee19b21..0000000
--- a/compose/ui/ui-graphics/src/androidMain/AndroidManifest.xml
+++ /dev/null
@@ -1,16 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 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.
--->
-<manifest />
diff --git a/compose/ui/ui-inspection/src/main/AndroidManifest.xml b/compose/ui/ui-inspection/src/main/AndroidManifest.xml
deleted file mode 100644
index f3ba9c7..0000000
--- a/compose/ui/ui-inspection/src/main/AndroidManifest.xml
+++ /dev/null
@@ -1,16 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2021 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.
--->
-<manifest />
\ No newline at end of file
diff --git a/compose/ui/ui-test-junit4/src/androidMain/AndroidManifest.xml b/compose/ui/ui-test-junit4/src/androidMain/AndroidManifest.xml
deleted file mode 100644
index dd3d3a3..0000000
--- a/compose/ui/ui-test-junit4/src/androidMain/AndroidManifest.xml
+++ /dev/null
@@ -1,16 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2018 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.
--->
-<manifest />
diff --git a/compose/ui/ui-test/samples/src/main/AndroidManifest.xml b/compose/ui/ui-test/samples/src/main/AndroidManifest.xml
deleted file mode 100644
index a7cd314..0000000
--- a/compose/ui/ui-test/samples/src/main/AndroidManifest.xml
+++ /dev/null
@@ -1,17 +0,0 @@
-<!--
- ~ Copyright (C) 2022 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
- -->
-
-<manifest />
diff --git a/compose/ui/ui-test/src/androidMain/AndroidManifest.xml b/compose/ui/ui-test/src/androidMain/AndroidManifest.xml
deleted file mode 100644
index dd3d3a3..0000000
--- a/compose/ui/ui-test/src/androidMain/AndroidManifest.xml
+++ /dev/null
@@ -1,16 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2018 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.
--->
-<manifest />
diff --git a/compose/ui/ui-text-google-fonts/src/androidTest/AndroidManifest.xml b/compose/ui/ui-text-google-fonts/src/androidTest/AndroidManifest.xml
deleted file mode 100644
index e865f27..0000000
--- a/compose/ui/ui-text-google-fonts/src/androidTest/AndroidManifest.xml
+++ /dev/null
@@ -1,17 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
- ~ Copyright 2021 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.
- -->
-<manifest />
diff --git a/compose/ui/ui-text-google-fonts/src/main/AndroidManifest.xml b/compose/ui/ui-text-google-fonts/src/main/AndroidManifest.xml
deleted file mode 100644
index 6a69672..0000000
--- a/compose/ui/ui-text-google-fonts/src/main/AndroidManifest.xml
+++ /dev/null
@@ -1,17 +0,0 @@
-<!--
- Copyright 2019 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.
- -->
-
-<manifest />
diff --git a/compose/ui/ui-text/samples/src/main/AndroidManifest.xml b/compose/ui/ui-text/samples/src/main/AndroidManifest.xml
deleted file mode 100644
index 6a69672..0000000
--- a/compose/ui/ui-text/samples/src/main/AndroidManifest.xml
+++ /dev/null
@@ -1,17 +0,0 @@
-<!--
- Copyright 2019 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.
- -->
-
-<manifest />
diff --git a/compose/ui/ui-text/src/androidAndroidTest/AndroidManifest.xml b/compose/ui/ui-text/src/androidAndroidTest/AndroidManifest.xml
deleted file mode 100644
index 61b6811..0000000
--- a/compose/ui/ui-text/src/androidAndroidTest/AndroidManifest.xml
+++ /dev/null
@@ -1,17 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
- Copyright 2019 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.
- -->
-<manifest />
diff --git a/compose/ui/ui-text/src/androidMain/AndroidManifest.xml b/compose/ui/ui-text/src/androidMain/AndroidManifest.xml
deleted file mode 100644
index 61b6811..0000000
--- a/compose/ui/ui-text/src/androidMain/AndroidManifest.xml
+++ /dev/null
@@ -1,17 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
- Copyright 2019 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.
- -->
-<manifest />
diff --git a/compose/ui/ui-text/src/commonMain/kotlin/androidx/compose/ui/text/input/PlatformTextInputAdapter.kt b/compose/ui/ui-text/src/commonMain/kotlin/androidx/compose/ui/text/input/PlatformTextInputAdapter.kt
index 92a2f4c..c2f3ac6 100644
--- a/compose/ui/ui-text/src/commonMain/kotlin/androidx/compose/ui/text/input/PlatformTextInputAdapter.kt
+++ b/compose/ui/ui-text/src/commonMain/kotlin/androidx/compose/ui/text/input/PlatformTextInputAdapter.kt
@@ -21,8 +21,8 @@
import androidx.compose.runtime.Immutable
import androidx.compose.runtime.Stable
import androidx.compose.runtime.getValue
+import androidx.compose.runtime.mutableIntStateOf
import androidx.compose.runtime.mutableStateMapOf
-import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
import androidx.compose.runtime.rememberCoroutineScope
import androidx.compose.runtime.setValue
@@ -294,7 +294,7 @@
* This is backed by a MutableState because it is incremented in [getOrCreateAdapter] which
* can be called directly from a composition, inside a [remember] block.
*/
- private var refCount by mutableStateOf(0)
+ private var refCount by mutableIntStateOf(0)
val isRefCountZero get() = refCount == 0
diff --git a/compose/ui/ui-tooling-data/src/androidMain/AndroidManifest.xml b/compose/ui/ui-tooling-data/src/androidMain/AndroidManifest.xml
deleted file mode 100644
index 0648ec7..0000000
--- a/compose/ui/ui-tooling-data/src/androidMain/AndroidManifest.xml
+++ /dev/null
@@ -1,16 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2019 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.
--->
-<manifest />
\ No newline at end of file
diff --git a/compose/ui/ui-unit/samples/src/main/AndroidManifest.xml b/compose/ui/ui-unit/samples/src/main/AndroidManifest.xml
deleted file mode 100644
index deac81d..0000000
--- a/compose/ui/ui-unit/samples/src/main/AndroidManifest.xml
+++ /dev/null
@@ -1,17 +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.
- -->
-
-<manifest />
diff --git a/compose/ui/ui-unit/src/androidMain/AndroidManifest.xml b/compose/ui/ui-unit/src/androidMain/AndroidManifest.xml
deleted file mode 100644
index ee19b21..0000000
--- a/compose/ui/ui-unit/src/androidMain/AndroidManifest.xml
+++ /dev/null
@@ -1,16 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 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.
--->
-<manifest />
diff --git a/compose/ui/ui-util/src/androidMain/AndroidManifest.xml b/compose/ui/ui-util/src/androidMain/AndroidManifest.xml
deleted file mode 100644
index b47339d..0000000
--- a/compose/ui/ui-util/src/androidMain/AndroidManifest.xml
+++ /dev/null
@@ -1,16 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2019 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.
--->
-<manifest />
diff --git a/compose/ui/ui-viewbinding/samples/src/main/AndroidManifest.xml b/compose/ui/ui-viewbinding/samples/src/main/AndroidManifest.xml
deleted file mode 100644
index deac81d..0000000
--- a/compose/ui/ui-viewbinding/samples/src/main/AndroidManifest.xml
+++ /dev/null
@@ -1,17 +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.
- -->
-
-<manifest />
diff --git a/compose/ui/ui-viewbinding/src/main/AndroidManifest.xml b/compose/ui/ui-viewbinding/src/main/AndroidManifest.xml
deleted file mode 100644
index 9cd4123..0000000
--- a/compose/ui/ui-viewbinding/src/main/AndroidManifest.xml
+++ /dev/null
@@ -1,17 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
- 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.
- -->
-<manifest />
diff --git a/compose/ui/ui/integration-tests/ui-demos/src/main/java/androidx/compose/ui/demos/PopupDemo.kt b/compose/ui/ui/integration-tests/ui-demos/src/main/java/androidx/compose/ui/demos/PopupDemo.kt
index 6e7516c..c656ad0 100644
--- a/compose/ui/ui/integration-tests/ui-demos/src/main/java/androidx/compose/ui/demos/PopupDemo.kt
+++ b/compose/ui/ui/integration-tests/ui-demos/src/main/java/androidx/compose/ui/demos/PopupDemo.kt
@@ -42,6 +42,7 @@
import androidx.compose.material.Text
import androidx.compose.runtime.Composable
import androidx.compose.runtime.getValue
+import androidx.compose.runtime.mutableIntStateOf
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
import androidx.compose.runtime.setValue
@@ -59,7 +60,7 @@
@Composable
fun PopupDemo() {
- val exampleIndex = remember { mutableStateOf(0) }
+ var exampleIndex by remember { mutableIntStateOf(0) }
val totalExamples = 8
Column {
@@ -71,11 +72,11 @@
text = "Prev",
color = Color.Cyan,
onClick = {
- if (exampleIndex.value == 0) {
- exampleIndex.value = totalExamples
+ if (exampleIndex == 0) {
+ exampleIndex = totalExamples
}
- exampleIndex.value = (exampleIndex.value - 1) % totalExamples
+ exampleIndex = (exampleIndex - 1) % totalExamples
},
padding = 20.dp
)
@@ -85,7 +86,7 @@
contentAlignment = Alignment.Center
) {
val description: String = {
- when (exampleIndex.value) {
+ when (exampleIndex) {
0 -> "Shadow demo"
1 -> "Toggle a simple popup"
2 -> "Different content for the popup"
@@ -118,13 +119,13 @@
text = "Next",
color = Color.Cyan,
onClick = {
- exampleIndex.value = (exampleIndex.value + 1) % totalExamples
+ exampleIndex = (exampleIndex + 1) % totalExamples
},
padding = 20.dp
)
}
- when (exampleIndex.value) {
+ when (exampleIndex) {
0 -> PopupElevation()
1 -> PopupToggle()
2 -> PopupWithChangingContent()
@@ -143,7 +144,7 @@
var shape by remember { mutableStateOf(RectangleShape) }
var background by remember { mutableStateOf(Color.Transparent) }
var contentSize by remember { mutableStateOf(100.dp) }
- var dismissCounter by remember { mutableStateOf(0) }
+ var dismissCounter by remember { mutableIntStateOf(0) }
var elevation by remember { mutableStateOf(6.dp) }
// This example utilizes the Card to draw its shadow.
@@ -238,18 +239,18 @@
Column(Modifier.align(Alignment.CenterHorizontally)) {
val heightSize = 120.dp
val widthSize = 160.dp
- val popupContentState = remember { mutableStateOf(0) }
+ var popupContentState by remember { mutableIntStateOf(0) }
val totalContentExamples = 2
- val popupCounter = remember { mutableStateOf(0) }
+ var popupCounter by remember { mutableIntStateOf(0) }
Box(Modifier.size(widthSize, heightSize).background(Color.Gray)) {
Popup(Alignment.Center) {
- when (popupContentState.value % totalContentExamples) {
+ when (popupContentState % totalContentExamples) {
0 -> ClickableTextWithBackground(
- text = "Counter : ${popupCounter.value}",
+ text = "Counter : $popupCounter",
color = Color.Green,
onClick = {
- popupCounter.value += 1
+ popupCounter += 1
}
)
1 -> Box(
@@ -264,7 +265,7 @@
text = "Change content",
color = Color.Cyan,
onClick = {
- popupContentState.value += 1
+ popupContentState++
}
)
}
@@ -328,7 +329,7 @@
Column(Modifier.align(Alignment.CenterHorizontally)) {
val heightSize = 200.dp
val widthSize = 400.dp
- val counter = remember { mutableStateOf(0) }
+ var counter by remember { mutableIntStateOf(0) }
val popupAlignment = remember { mutableStateOf(Alignment.TopStart) }
Box(
modifier = Modifier.size(widthSize, heightSize).background(Color.Red),
@@ -339,8 +340,8 @@
text = "Click to change alignment",
color = Color.White,
onClick = {
- counter.value += 1
- when (counter.value % 9) {
+ counter++
+ when (counter % 9) {
0 -> popupAlignment.value = Alignment.TopStart
1 -> popupAlignment.value = Alignment.TopCenter
2 -> popupAlignment.value = Alignment.TopEnd
@@ -413,7 +414,7 @@
val showPopup = remember { mutableStateOf(true) }
val heightSize = 120.dp
val widthSize = 160.dp
- val rectangleState = remember { mutableStateOf(0) }
+ var rectangleState by remember { mutableIntStateOf(0) }
Spacer(Modifier.height(15.dp))
Box(
@@ -421,7 +422,7 @@
) {
if (showPopup.value) {
Popup(Alignment.Center) {
- val size = when (rectangleState.value % 4) {
+ val size = when (rectangleState % 4) {
0 -> Modifier.size(30.dp)
1 -> Modifier.size(100.dp)
2 -> Modifier.size(30.dp, 90.dp)
@@ -436,7 +437,7 @@
text = "Change size",
color = Color.Cyan,
onClick = {
- rectangleState.value += 1
+ rectangleState++
}
)
}
diff --git a/compose/ui/ui/integration-tests/ui-demos/src/main/java/androidx/compose/ui/demos/gestures/HorizontalScrollersInVerticalScrollerDemo.kt b/compose/ui/ui/integration-tests/ui-demos/src/main/java/androidx/compose/ui/demos/gestures/HorizontalScrollersInVerticalScrollerDemo.kt
index d11018e..e79abb8 100644
--- a/compose/ui/ui/integration-tests/ui-demos/src/main/java/androidx/compose/ui/demos/gestures/HorizontalScrollersInVerticalScrollerDemo.kt
+++ b/compose/ui/ui/integration-tests/ui-demos/src/main/java/androidx/compose/ui/demos/gestures/HorizontalScrollersInVerticalScrollerDemo.kt
@@ -34,6 +34,9 @@
import androidx.compose.ui.draw.DrawModifier
import androidx.compose.ui.geometry.Offset
import androidx.compose.foundation.gestures.Orientation
+import androidx.compose.runtime.getValue
+import androidx.compose.runtime.mutableFloatStateOf
+import androidx.compose.runtime.setValue
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.graphics.drawscope.ContentDrawScope
import androidx.compose.ui.graphics.drawscope.clipRect
@@ -80,28 +83,28 @@
@Composable
private fun Scrollable(orientation: Orientation, content: @Composable () -> Unit) {
val maxOffset = 0f
- val offset = remember { mutableStateOf(maxOffset) }
- val minOffset = remember { mutableStateOf(0f) }
+ var offset by remember { mutableFloatStateOf(maxOffset) }
+ var minOffset by remember { mutableFloatStateOf(0f) }
Layout(
content = content,
modifier = Modifier.scrollable(
orientation = orientation,
state = rememberScrollableState { scrollDistance ->
- val resultingOffset = offset.value + scrollDistance
+ val resultingOffset = offset + scrollDistance
val toConsume =
when {
resultingOffset > maxOffset -> {
- maxOffset - offset.value
+ maxOffset - offset
}
- resultingOffset < minOffset.value -> {
- minOffset.value - offset.value
+ resultingOffset < minOffset -> {
+ minOffset - offset
}
else -> {
scrollDistance
}
}
- offset.value = offset.value + toConsume
+ offset = offset + toConsume
toConsume
}
)
@@ -123,7 +126,7 @@
)
}
- minOffset.value =
+ minOffset =
when (orientation) {
Orientation.Horizontal -> constraints.maxWidth.toFloat() - placeable.width
Orientation.Vertical -> constraints.maxHeight.toFloat() - placeable.height
@@ -143,8 +146,8 @@
layout(width, height) {
when (orientation) {
- Orientation.Horizontal -> placeable.placeRelative(offset.value.roundToInt(), 0)
- Orientation.Vertical -> placeable.placeRelative(0, offset.value.roundToInt())
+ Orientation.Horizontal -> placeable.placeRelative(offset.roundToInt(), 0)
+ Orientation.Vertical -> placeable.placeRelative(0, offset.roundToInt())
}
}
}
diff --git a/compose/ui/ui/integration-tests/ui-demos/src/main/java/androidx/compose/ui/demos/gestures/NestedScrollingDemo.kt b/compose/ui/ui/integration-tests/ui-demos/src/main/java/androidx/compose/ui/demos/gestures/NestedScrollingDemo.kt
index 3978b89..a6af47f 100644
--- a/compose/ui/ui/integration-tests/ui-demos/src/main/java/androidx/compose/ui/demos/gestures/NestedScrollingDemo.kt
+++ b/compose/ui/ui/integration-tests/ui-demos/src/main/java/androidx/compose/ui/demos/gestures/NestedScrollingDemo.kt
@@ -36,6 +36,9 @@
import androidx.compose.ui.draw.clipToBounds
import androidx.compose.ui.geometry.Offset
import androidx.compose.foundation.gestures.Orientation
+import androidx.compose.runtime.getValue
+import androidx.compose.runtime.mutableFloatStateOf
+import androidx.compose.runtime.setValue
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.input.pointer.pointerInput
import androidx.compose.ui.layout.Layout
@@ -79,8 +82,8 @@
*/
@Composable
private fun ScrollableContainer(content: @Composable () -> Unit) {
- val offset = remember { mutableStateOf(0f) }
- val maxOffset = remember { mutableStateOf(0f) }
+ var offset by remember { mutableFloatStateOf(0f) }
+ var maxOffset by remember { mutableFloatStateOf(0f) }
Layout(
content = content,
@@ -88,20 +91,20 @@
.scrollable(
orientation = Orientation.Vertical,
state = rememberScrollableState { scrollDistance ->
- val resultingOffset = offset.value + scrollDistance
+ val resultingOffset = offset + scrollDistance
val dyToConsume =
when {
resultingOffset > 0f -> {
- 0f - offset.value
+ 0f - offset
}
- resultingOffset < maxOffset.value -> {
- maxOffset.value - offset.value
+ resultingOffset < maxOffset -> {
+ maxOffset - offset
}
else -> {
scrollDistance
}
}
- offset.value += dyToConsume
+ offset += dyToConsume
dyToConsume
}
)
@@ -111,10 +114,10 @@
measurables.first()
.measure(constraints.copy(minHeight = 0, maxHeight = Constraints.Infinity))
- maxOffset.value = (constraints.maxHeight - placeable.height).toFloat()
+ maxOffset = (constraints.maxHeight - placeable.height).toFloat()
layout(constraints.maxWidth, constraints.maxHeight) {
- placeable.placeRelative(0, offset.value.roundToInt())
+ placeable.placeRelative(0, offset.roundToInt())
}
}
)
diff --git a/compose/ui/ui/integration-tests/ui-demos/src/main/java/androidx/compose/ui/demos/gestures/PointerInputDuringSubCompDemo.kt b/compose/ui/ui/integration-tests/ui-demos/src/main/java/androidx/compose/ui/demos/gestures/PointerInputDuringSubCompDemo.kt
index 0e7c5e7..17e91b3 100644
--- a/compose/ui/ui/integration-tests/ui-demos/src/main/java/androidx/compose/ui/demos/gestures/PointerInputDuringSubCompDemo.kt
+++ b/compose/ui/ui/integration-tests/ui-demos/src/main/java/androidx/compose/ui/demos/gestures/PointerInputDuringSubCompDemo.kt
@@ -26,8 +26,10 @@
import androidx.compose.foundation.lazy.LazyColumn
import androidx.compose.material.Text
import androidx.compose.runtime.Composable
-import androidx.compose.runtime.mutableStateOf
+import androidx.compose.runtime.getValue
+import androidx.compose.runtime.mutableIntStateOf
import androidx.compose.runtime.remember
+import androidx.compose.runtime.setValue
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.composed
@@ -68,16 +70,16 @@
.background(color = Color.White)
) {
items(100) {
- val pointerCount = remember { mutableStateOf(0) }
+ var pointerCount by remember { mutableIntStateOf(0) }
Box(
Modifier.fillParentMaxSize()
.border(width = 1.dp, color = Color.Black)
- .pointerCounterGestureFilter { newCount -> pointerCount.value = newCount },
+ .pointerCounterGestureFilter { newCount -> pointerCount = newCount },
contentAlignment = Alignment.Center
) {
Text(
- "${pointerCount.value}",
+ "$pointerCount",
fontSize = 16.em,
color = Color.Black
)
diff --git a/compose/ui/ui/integration-tests/ui-demos/src/main/java/androidx/compose/ui/demos/gestures/ScrollGestureFilterDemo.kt b/compose/ui/ui/integration-tests/ui-demos/src/main/java/androidx/compose/ui/demos/gestures/ScrollGestureFilterDemo.kt
index fea7034..6d9fc2f 100644
--- a/compose/ui/ui/integration-tests/ui-demos/src/main/java/androidx/compose/ui/demos/gestures/ScrollGestureFilterDemo.kt
+++ b/compose/ui/ui/integration-tests/ui-demos/src/main/java/androidx/compose/ui/demos/gestures/ScrollGestureFilterDemo.kt
@@ -29,11 +29,13 @@
import androidx.compose.foundation.layout.wrapContentSize
import androidx.compose.material.Text
import androidx.compose.runtime.Composable
-import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.foundation.gestures.Orientation
+import androidx.compose.runtime.getValue
+import androidx.compose.runtime.mutableFloatStateOf
+import androidx.compose.runtime.setValue
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.platform.LocalDensity
import androidx.compose.ui.unit.Dp
@@ -70,10 +72,10 @@
val interactionSource = remember { MutableInteractionSource() }
val color = if (interactionSource.collectIsDraggedAsState().value) activeColor else idleColor
- val offsetPx = remember { mutableStateOf(0f) }
+ var offsetPx by remember { mutableFloatStateOf(0f) }
val offsetDp = with(LocalDensity.current) {
- offsetPx.value.toDp()
+ offsetPx.toDp()
}
val (offsetX, offsetY) = when (orientation) {
Orientation.Horizontal -> offsetDp to Dp.Hairline
@@ -88,7 +90,7 @@
interactionSource = interactionSource,
orientation = orientation,
state = rememberScrollableState { scrollDistance ->
- offsetPx.value += scrollDistance
+ offsetPx += scrollDistance
scrollDistance
}
)
diff --git a/compose/ui/ui/integration-tests/ui-demos/src/main/java/androidx/compose/ui/demos/gestures/TapPressureGestureDetectorDemo.kt b/compose/ui/ui/integration-tests/ui-demos/src/main/java/androidx/compose/ui/demos/gestures/TapPressureGestureDetectorDemo.kt
index 0acd6aa91..709b169 100644
--- a/compose/ui/ui/integration-tests/ui-demos/src/main/java/androidx/compose/ui/demos/gestures/TapPressureGestureDetectorDemo.kt
+++ b/compose/ui/ui/integration-tests/ui-demos/src/main/java/androidx/compose/ui/demos/gestures/TapPressureGestureDetectorDemo.kt
@@ -30,6 +30,7 @@
import androidx.compose.material.Text
import androidx.compose.runtime.Composable
import androidx.compose.runtime.getValue
+import androidx.compose.runtime.mutableFloatStateOf
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
import androidx.compose.runtime.setValue
@@ -68,9 +69,9 @@
"For some pen supported devices, a finger touch pressure will equal 1.0."
)
- var gestureOffsetX by remember { mutableStateOf(0f) }
- var gestureOffsetY by remember { mutableStateOf(0f) }
- var gesturePressure by remember { mutableStateOf(0f) }
+ var gestureOffsetX by remember { mutableFloatStateOf(0f) }
+ var gestureOffsetY by remember { mutableFloatStateOf(0f) }
+ var gesturePressure by remember { mutableFloatStateOf(0f) }
// Gestures (detectDragGestures) with pressure.
Box(
diff --git a/compose/ui/ui/integration-tests/ui-demos/src/main/java/androidx/compose/ui/demos/gestures/VerticalScrollerInDrawerLayoutDemo.kt b/compose/ui/ui/integration-tests/ui-demos/src/main/java/androidx/compose/ui/demos/gestures/VerticalScrollerInDrawerLayoutDemo.kt
index 192a5b5..206cbf3 100644
--- a/compose/ui/ui/integration-tests/ui-demos/src/main/java/androidx/compose/ui/demos/gestures/VerticalScrollerInDrawerLayoutDemo.kt
+++ b/compose/ui/ui/integration-tests/ui-demos/src/main/java/androidx/compose/ui/demos/gestures/VerticalScrollerInDrawerLayoutDemo.kt
@@ -41,6 +41,9 @@
import androidx.compose.ui.draw.DrawModifier
import androidx.compose.ui.geometry.Offset
import androidx.compose.foundation.gestures.Orientation
+import androidx.compose.runtime.getValue
+import androidx.compose.runtime.mutableFloatStateOf
+import androidx.compose.runtime.setValue
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.graphics.drawscope.ContentDrawScope
import androidx.compose.ui.graphics.drawscope.clipRect
@@ -84,17 +87,16 @@
-drawerWidth.toPx()
}
- val currentOffset = remember { mutableStateOf(minOffset) }
+ var currentOffset by remember { mutableFloatStateOf(minOffset) }
val maxOffset = 0f
Box(
Modifier.scrollable(
orientation = Orientation.Horizontal,
state = rememberScrollableState { scrollDistance ->
- val originalOffset = currentOffset.value
- currentOffset.value =
- (currentOffset.value + scrollDistance).coerceIn(minOffset, maxOffset)
- currentOffset.value - originalOffset
+ val originalOffset = currentOffset
+ currentOffset = (currentOffset + scrollDistance).coerceIn(minOffset, maxOffset)
+ currentOffset - originalOffset
}
)
) {
@@ -103,7 +105,7 @@
Modifier
.fillMaxHeight()
.requiredWidth(drawerWidth)
- .offset { IntOffset(currentOffset.value.roundToInt(), 0) }
+ .offset { IntOffset(currentOffset.roundToInt(), 0) }
.background(color = DefaultBackgroundColor)
) {
Text(
@@ -122,28 +124,28 @@
@Composable
private fun Scrollable(orientation: Orientation, content: @Composable () -> Unit) {
val maxOffset = 0f
- val offset = remember { mutableStateOf(maxOffset) }
- val minOffset = remember { mutableStateOf(0f) }
+ var offset by remember { mutableFloatStateOf(maxOffset) }
+ var minOffset by remember { mutableFloatStateOf(0f) }
Layout(
content = content,
modifier = Modifier.scrollable(
orientation = orientation,
state = rememberScrollableState { scrollDistance ->
- val resultingOffset = offset.value + scrollDistance
+ val resultingOffset = offset + scrollDistance
val toConsume =
when {
resultingOffset > maxOffset -> {
- maxOffset - offset.value
+ maxOffset - offset
}
- resultingOffset < minOffset.value -> {
- minOffset.value - offset.value
+ resultingOffset < minOffset -> {
+ minOffset - offset
}
else -> {
scrollDistance
}
}
- offset.value = offset.value + toConsume
+ offset += toConsume
toConsume
}
).then(ClipModifier),
@@ -164,7 +166,7 @@
)
}
- minOffset.value =
+ minOffset =
when (orientation) {
Orientation.Horizontal -> constraints.maxWidth.toFloat() - placeable.width
Orientation.Vertical -> constraints.maxHeight.toFloat() - placeable.height
@@ -184,8 +186,8 @@
layout(width, height) {
when (orientation) {
- Orientation.Horizontal -> placeable.placeRelative(offset.value.roundToInt(), 0)
- Orientation.Vertical -> placeable.placeRelative(0, offset.value.roundToInt())
+ Orientation.Horizontal -> placeable.placeRelative(offset.roundToInt(), 0)
+ Orientation.Vertical -> placeable.placeRelative(0, offset.roundToInt())
}
}
}
diff --git a/compose/ui/ui/integration-tests/ui-demos/src/main/java/androidx/compose/ui/demos/recyclerview/RecyclerViewInteropDemoFragment.kt b/compose/ui/ui/integration-tests/ui-demos/src/main/java/androidx/compose/ui/demos/recyclerview/RecyclerViewInteropDemoFragment.kt
index 507e519..6a610255 100644
--- a/compose/ui/ui/integration-tests/ui-demos/src/main/java/androidx/compose/ui/demos/recyclerview/RecyclerViewInteropDemoFragment.kt
+++ b/compose/ui/ui/integration-tests/ui-demos/src/main/java/androidx/compose/ui/demos/recyclerview/RecyclerViewInteropDemoFragment.kt
@@ -34,6 +34,7 @@
import androidx.compose.runtime.Composable
import androidx.compose.runtime.DisposableEffect
import androidx.compose.runtime.getValue
+import androidx.compose.runtime.mutableIntStateOf
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.setValue
import androidx.compose.ui.Modifier
@@ -122,7 +123,7 @@
attrs: AttributeSet? = null,
defStyle: Int = 0
) : AbstractComposeView(context, attrs, defStyle) {
- var index by mutableStateOf(0)
+ var index by mutableIntStateOf(0)
var rowState: LazyListState? by mutableStateOf(null)
@Composable
diff --git a/compose/ui/ui/integration-tests/ui-demos/src/main/java/androidx/compose/ui/demos/viewinterop/NestedScrollInterop.kt b/compose/ui/ui/integration-tests/ui-demos/src/main/java/androidx/compose/ui/demos/viewinterop/NestedScrollInterop.kt
index 8ccc757..c584f2e 100644
--- a/compose/ui/ui/integration-tests/ui-demos/src/main/java/androidx/compose/ui/demos/viewinterop/NestedScrollInterop.kt
+++ b/compose/ui/ui/integration-tests/ui-demos/src/main/java/androidx/compose/ui/demos/viewinterop/NestedScrollInterop.kt
@@ -44,8 +44,10 @@
import androidx.compose.material.Text
import androidx.compose.material.TopAppBar
import androidx.compose.runtime.Composable
-import androidx.compose.runtime.mutableStateOf
+import androidx.compose.runtime.getValue
+import androidx.compose.runtime.mutableFloatStateOf
import androidx.compose.runtime.remember
+import androidx.compose.runtime.setValue
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.demos.R
@@ -73,14 +75,14 @@
@Composable
private fun OuterComposeWithNestedScroll(factory: (Context) -> View) {
val toolbarHeightPx = with(LocalDensity.current) { ToolbarHeight.roundToPx().toFloat() }
- val toolbarOffsetHeightPx = remember { mutableStateOf(0f) }
+ var toolbarOffsetHeightPx by remember { mutableFloatStateOf(0f) }
val nestedScrollConnection = remember {
object : NestedScrollConnection {
override fun onPreScroll(available: Offset, source: NestedScrollSource): Offset {
val delta = available.y
- val newOffset = toolbarOffsetHeightPx.value + delta
- toolbarOffsetHeightPx.value = newOffset.coerceIn(-toolbarHeightPx, 0f)
+ val newOffset = toolbarOffsetHeightPx + delta
+ toolbarOffsetHeightPx = newOffset.coerceIn(-toolbarHeightPx, 0f)
return Offset.Zero
}
}
@@ -96,8 +98,8 @@
TopAppBar(
modifier = Modifier
.height(ToolbarHeight)
- .offset { IntOffset(x = 0, y = toolbarOffsetHeightPx.value.roundToInt()) },
- title = { Text("toolbar offset is ${toolbarOffsetHeightPx.value}") }
+ .offset { IntOffset(x = 0, y = toolbarOffsetHeightPx.roundToInt()) },
+ title = { Text("toolbar offset is $toolbarOffsetHeightPx") }
)
// Android View
diff --git a/compose/ui/ui/integration-tests/ui-demos/src/main/java/androidx/compose/ui/demos/viewinterop/ScrollingAndroidViewsDemo.kt b/compose/ui/ui/integration-tests/ui-demos/src/main/java/androidx/compose/ui/demos/viewinterop/ScrollingAndroidViewsDemo.kt
index 20eb48b..6cfb3ae 100644
--- a/compose/ui/ui/integration-tests/ui-demos/src/main/java/androidx/compose/ui/demos/viewinterop/ScrollingAndroidViewsDemo.kt
+++ b/compose/ui/ui/integration-tests/ui-demos/src/main/java/androidx/compose/ui/demos/viewinterop/ScrollingAndroidViewsDemo.kt
@@ -30,6 +30,7 @@
import androidx.compose.material.Text
import androidx.compose.runtime.Composable
import androidx.compose.runtime.getValue
+import androidx.compose.runtime.mutableIntStateOf
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
import androidx.compose.runtime.setValue
@@ -79,7 +80,7 @@
checkedItems: Set<Int>,
onChangeCheck: (Int, Boolean) -> Unit
) {
- var allocationCounter by remember { mutableStateOf(0) }
+ var allocationCounter by remember { mutableIntStateOf(0) }
val resetViews = remember { mutableSetOf<View>() }
LazyColumn {
diff --git a/compose/ui/ui/integration-tests/ui-demos/src/main/java/androidx/compose/ui/demos/viewinterop/ViewInterop.kt b/compose/ui/ui/integration-tests/ui-demos/src/main/java/androidx/compose/ui/demos/viewinterop/ViewInterop.kt
index 4300e08..20cfb51 100644
--- a/compose/ui/ui/integration-tests/ui-demos/src/main/java/androidx/compose/ui/demos/viewinterop/ViewInterop.kt
+++ b/compose/ui/ui/integration-tests/ui-demos/src/main/java/androidx/compose/ui/demos/viewinterop/ViewInterop.kt
@@ -30,7 +30,7 @@
import androidx.compose.material.Text
import androidx.compose.runtime.Composable
import androidx.compose.runtime.getValue
-import androidx.compose.runtime.mutableStateOf
+import androidx.compose.runtime.mutableIntStateOf
import androidx.compose.runtime.remember
import androidx.compose.runtime.setValue
import androidx.compose.ui.Modifier
@@ -56,7 +56,7 @@
AndroidView({ context -> TextView(context).apply { text = "This is a TextView" } })
// Compose Android View and update its size based on state. The AndroidView takes modifiers.
- var size by remember { mutableStateOf(20) }
+ var size by remember { mutableIntStateOf(20) }
AndroidView(::View, Modifier.clickable { size += 20 }.background(Color.Blue)) { view ->
view.layoutParams = ViewGroup.LayoutParams(size, size)
}
@@ -74,7 +74,7 @@
Button(onClick = { squareRef.value!!.size += 50 }) {
Text("Increase size of Android view")
}
- val colorIndex = remember { mutableStateOf(0) }
+ val colorIndex = remember { mutableIntStateOf(0) }
Button(
onClick = {
colorIndex.value = (colorIndex.value + 1) % 4
diff --git a/compose/ui/ui/samples/src/main/AndroidManifest.xml b/compose/ui/ui/samples/src/main/AndroidManifest.xml
deleted file mode 100644
index 6a69672..0000000
--- a/compose/ui/ui/samples/src/main/AndroidManifest.xml
+++ /dev/null
@@ -1,17 +0,0 @@
-<!--
- Copyright 2019 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.
- -->
-
-<manifest />
diff --git a/compose/ui/ui/src/androidMain/AndroidManifest.xml b/compose/ui/ui/src/androidMain/AndroidManifest.xml
deleted file mode 100644
index b47339d..0000000
--- a/compose/ui/ui/src/androidMain/AndroidManifest.xml
+++ /dev/null
@@ -1,16 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2019 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.
--->
-<manifest />
diff --git a/compose/ui/ui/src/androidMain/kotlin/androidx/compose/ui/platform/WindowRecomposer.android.kt b/compose/ui/ui/src/androidMain/kotlin/androidx/compose/ui/platform/WindowRecomposer.android.kt
index 87b2aed..4d6135f 100644
--- a/compose/ui/ui/src/androidMain/kotlin/androidx/compose/ui/platform/WindowRecomposer.android.kt
+++ b/compose/ui/ui/src/androidMain/kotlin/androidx/compose/ui/platform/WindowRecomposer.android.kt
@@ -28,7 +28,7 @@
import androidx.compose.runtime.PausableMonotonicFrameClock
import androidx.compose.runtime.Recomposer
import androidx.compose.runtime.getValue
-import androidx.compose.runtime.mutableStateOf
+import androidx.compose.runtime.mutableFloatStateOf
import androidx.compose.runtime.setValue
import androidx.compose.ui.ExperimentalComposeUiApi
import androidx.compose.ui.InternalComposeUiApi
@@ -437,5 +437,5 @@
}
private class MotionDurationScaleImpl : MotionDurationScale {
- override var scaleFactor by mutableStateOf(1f)
+ override var scaleFactor by mutableFloatStateOf(1f)
}
diff --git a/compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/focus/FocusInvalidationManager.kt b/compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/focus/FocusInvalidationManager.kt
index 5fa03797..65ea0ca 100644
--- a/compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/focus/FocusInvalidationManager.kt
+++ b/compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/focus/FocusInvalidationManager.kt
@@ -45,15 +45,12 @@
}
private fun <T> MutableSet<T>.scheduleInvalidation(node: T) {
- // We don't schedule a node if it is already scheduled during this composition.
- if (contains(node)) return
-
- add(node)
-
- // If this is the first node scheduled for invalidation,
- // we set up a listener that runs after onApplyChanges.
- if (focusTargetNodes.size + focusEventNodes.size + focusPropertiesNodes.size == 1) {
- onRequestApplyChangesListener.invoke(invalidateNodes)
+ if (add(node)) {
+ // If this is the first node scheduled for invalidation,
+ // we set up a listener that runs after onApplyChanges.
+ if (focusTargetNodes.size + focusEventNodes.size + focusPropertiesNodes.size == 1) {
+ onRequestApplyChangesListener.invoke(invalidateNodes)
+ }
}
}
@@ -131,8 +128,9 @@
focusTargetNodes.clear()
focusTargetsWithInvalidatedFocusEvents.clear()
- check(focusPropertiesNodes.isEmpty())
- check(focusEventNodes.isEmpty())
- check(focusTargetNodes.isEmpty())
+ // TODO(b/280941088): Re-enable after we find the root issue.
+ // check(focusPropertiesNodes.isEmpty())
+ // check(focusEventNodes.isEmpty())
+ // check(focusTargetNodes.isEmpty())
}
}
diff --git a/constraintlayout/constraintlayout-compose/integration-tests/demos/src/main/java/androidx/constraintlayout/compose/demos/AllDemos.kt b/constraintlayout/constraintlayout-compose/integration-tests/demos/src/main/java/androidx/constraintlayout/compose/demos/AllDemos.kt
index 4121bed..53be7dc 100644
--- a/constraintlayout/constraintlayout-compose/integration-tests/demos/src/main/java/androidx/constraintlayout/compose/demos/AllDemos.kt
+++ b/constraintlayout/constraintlayout-compose/integration-tests/demos/src/main/java/androidx/constraintlayout/compose/demos/AllDemos.kt
@@ -36,7 +36,7 @@
import androidx.compose.material.icons.filled.ArrowBack
import androidx.compose.runtime.Composable
import androidx.compose.runtime.getValue
-import androidx.compose.runtime.mutableStateOf
+import androidx.compose.runtime.mutableIntStateOf
import androidx.compose.runtime.remember
import androidx.compose.runtime.setValue
import androidx.compose.ui.Alignment
@@ -71,7 +71,7 @@
@Preview
@Composable
fun ComposeConstraintLayoutDemos() {
- var displayedDemoIndex by remember { mutableStateOf(-1) }
+ var displayedDemoIndex by remember { mutableIntStateOf(-1) }
val maxIndex = AllComposeConstraintLayoutDemos.size - 1
Column {
Column {
diff --git a/constraintlayout/constraintlayout-compose/integration-tests/demos/src/main/java/androidx/constraintlayout/compose/demos/CollapsibleToolbarDemo.kt b/constraintlayout/constraintlayout-compose/integration-tests/demos/src/main/java/androidx/constraintlayout/compose/demos/CollapsibleToolbarDemo.kt
index 21dd10a..a1aa8cc 100644
--- a/constraintlayout/constraintlayout-compose/integration-tests/demos/src/main/java/androidx/constraintlayout/compose/demos/CollapsibleToolbarDemo.kt
+++ b/constraintlayout/constraintlayout-compose/integration-tests/demos/src/main/java/androidx/constraintlayout/compose/demos/CollapsibleToolbarDemo.kt
@@ -34,7 +34,7 @@
import androidx.compose.material.icons.filled.Face
import androidx.compose.material.icons.filled.Menu
import androidx.compose.runtime.Composable
-import androidx.compose.runtime.mutableStateOf
+import androidx.compose.runtime.mutableFloatStateOf
import androidx.compose.runtime.remember
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
@@ -241,30 +241,30 @@
val maxPx = with(LocalDensity.current) { big.roundToPx().toFloat() }
val minPx = with(LocalDensity.current) { small.roundToPx().toFloat() }
- val toolbarHeight = remember { mutableStateOf(maxPx) }
+ val toolbarHeight = remember { mutableFloatStateOf(maxPx) }
val nestedScrollConnection = remember {
object : NestedScrollConnection {
override fun onPreScroll(available: Offset, source: NestedScrollSource): Offset {
- val height = toolbarHeight.value
+ val height = toolbarHeight.floatValue
if (height + available.y > maxPx) {
- toolbarHeight.value = maxPx
+ toolbarHeight.floatValue = maxPx
return Offset(0f, maxPx - height)
}
if (height + available.y < minPx) {
- toolbarHeight.value = minPx
+ toolbarHeight.floatValue = minPx
return Offset(0f, minPx - height)
}
- toolbarHeight.value += available.y
+ toolbarHeight.floatValue += available.y
return Offset(0f, available.y)
}
}
}
- val progress = 1 - (toolbarHeight.value - minPx) / (maxPx - minPx)
+ val progress = 1 - (toolbarHeight.floatValue - minPx) / (maxPx - minPx)
Column {
MotionLayout(
diff --git a/constraintlayout/constraintlayout-compose/integration-tests/demos/src/main/java/androidx/constraintlayout/compose/demos/ReactionSelectorDemo.kt b/constraintlayout/constraintlayout-compose/integration-tests/demos/src/main/java/androidx/constraintlayout/compose/demos/ReactionSelectorDemo.kt
index 5377ef1..ecd1404 100644
--- a/constraintlayout/constraintlayout-compose/integration-tests/demos/src/main/java/androidx/constraintlayout/compose/demos/ReactionSelectorDemo.kt
+++ b/constraintlayout/constraintlayout-compose/integration-tests/demos/src/main/java/androidx/constraintlayout/compose/demos/ReactionSelectorDemo.kt
@@ -28,6 +28,7 @@
import androidx.compose.runtime.Composable
import androidx.compose.runtime.LaunchedEffect
import androidx.compose.runtime.getValue
+import androidx.compose.runtime.mutableIntStateOf
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
import androidx.compose.runtime.setValue
@@ -47,7 +48,7 @@
@Preview
@Composable
fun ReactionSelectorDemo() {
- var selected by remember { mutableStateOf(3) }
+ var selected by remember { mutableIntStateOf(3) }
val transitionName = remember { mutableStateOf("transition1") }
val emojis = remember { "😀 🙂 🤨 😐 😒 😬".split(' ') }
val emojiNames = remember {
diff --git a/constraintlayout/constraintlayout-compose/integration-tests/macrobenchmark/src/androidTest/AndroidManifest.xml b/constraintlayout/constraintlayout-compose/integration-tests/macrobenchmark/src/androidTest/AndroidManifest.xml
deleted file mode 100644
index 8e90956..0000000
--- a/constraintlayout/constraintlayout-compose/integration-tests/macrobenchmark/src/androidTest/AndroidManifest.xml
+++ /dev/null
@@ -1,17 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
- Copyright 2022 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.
- -->
-<manifest />
diff --git a/constraintlayout/constraintlayout-compose/src/androidMain/kotlin/androidx/constraintlayout/compose/ConstraintLayout.kt b/constraintlayout/constraintlayout-compose/src/androidMain/kotlin/androidx/constraintlayout/compose/ConstraintLayout.kt
index 1896407..aa46490 100644
--- a/constraintlayout/constraintlayout-compose/src/androidMain/kotlin/androidx/constraintlayout/compose/ConstraintLayout.kt
+++ b/constraintlayout/constraintlayout-compose/src/androidMain/kotlin/androidx/constraintlayout/compose/ConstraintLayout.kt
@@ -41,6 +41,7 @@
import androidx.compose.runtime.Stable
import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableIntStateOf
+import androidx.compose.runtime.mutableLongStateOf
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.neverEqualPolicy
import androidx.compose.runtime.remember
@@ -290,7 +291,7 @@
content = { content() })
} else {
val needsUpdate = remember {
- mutableStateOf(0L)
+ mutableLongStateOf(0L)
}
val contentTracker = remember { mutableStateOf(Unit, neverEqualPolicy()) }
diff --git a/constraintlayout/constraintlayout-compose/src/androidMain/kotlin/androidx/constraintlayout/compose/MotionCarousel.kt b/constraintlayout/constraintlayout-compose/src/androidMain/kotlin/androidx/constraintlayout/compose/MotionCarousel.kt
index 2656198..61b5811 100644
--- a/constraintlayout/constraintlayout-compose/src/androidMain/kotlin/androidx/constraintlayout/compose/MotionCarousel.kt
+++ b/constraintlayout/constraintlayout-compose/src/androidMain/kotlin/androidx/constraintlayout/compose/MotionCarousel.kt
@@ -26,6 +26,8 @@
import androidx.compose.runtime.LaunchedEffect
import androidx.compose.runtime.derivedStateOf
import androidx.compose.runtime.getValue
+import androidx.compose.runtime.mutableFloatStateOf
+import androidx.compose.runtime.mutableIntStateOf
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
import androidx.compose.runtime.rememberUpdatedState
@@ -168,9 +170,9 @@
val provider = rememberStateOfItemsProvider(content)
- var componentWidth by remember { mutableStateOf(1000f) }
+ var componentWidth by remember { mutableFloatStateOf(1000f) }
val swipeableState = rememberCarouselSwipeableState(swipeStateStart)
- var mprogress = (swipeableState.offset.value / componentWidth)
+ var mprogress = (swipeableState.offset.floatValue / componentWidth)
var state by remember {
mutableStateOf(
@@ -183,11 +185,11 @@
)
)
}
- var currentIndex = remember { mutableStateOf(0) }
+ var currentIndex by remember { mutableIntStateOf(0) }
- val anchors = if (currentIndex.value == 0) {
+ val anchors = if (currentIndex == 0) {
mapOf(0f to swipeStateStart, componentWidth to swipeStateForward)
- } else if (currentIndex.value == provider.value.count() - 1) {
+ } else if (currentIndex == provider.value.count() - 1) {
mapOf(-componentWidth to swipeStateBackward, 0f to swipeStateStart)
} else {
mapOf(
@@ -232,7 +234,7 @@
state.direction = MotionCarouselDirection.FORWARD
}
}
- currentIndex.value = state.index
+ currentIndex = state.index
}
MotionLayout(motionScene = motionScene,
@@ -254,7 +256,7 @@
}
) {
for (i in 0 until numSlots) {
- val idx = i + currentIndex.value - initialSlotIndex
+ val idx = i + currentIndex - initialSlotIndex
val visible = idx in 0 until provider.value.count()
ItemHolder(i, slotPrefix, showSlots) {
if (visible) {
diff --git a/constraintlayout/constraintlayout-compose/src/androidMain/kotlin/androidx/constraintlayout/compose/MotionLayout.kt b/constraintlayout/constraintlayout-compose/src/androidMain/kotlin/androidx/constraintlayout/compose/MotionLayout.kt
index a003146..d1aff18 100644
--- a/constraintlayout/constraintlayout-compose/src/androidMain/kotlin/androidx/constraintlayout/compose/MotionLayout.kt
+++ b/constraintlayout/constraintlayout-compose/src/androidMain/kotlin/androidx/constraintlayout/compose/MotionLayout.kt
@@ -29,6 +29,8 @@
import androidx.compose.runtime.SideEffect
import androidx.compose.runtime.State
import androidx.compose.runtime.getValue
+import androidx.compose.runtime.mutableFloatStateOf
+import androidx.compose.runtime.mutableLongStateOf
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.neverEqualPolicy
import androidx.compose.runtime.remember
@@ -411,18 +413,18 @@
content: @Composable (MotionLayoutScope.() -> Unit)
) {
val needsUpdate = remember {
- mutableStateOf(0L)
+ mutableLongStateOf(0L)
}
- val transition = remember(motionScene, needsUpdate.value) {
+ val transition = remember(motionScene, needsUpdate.longValue) {
motionScene.getTransitionInstance("default")
}
- val initialStart = remember(motionScene, needsUpdate.value) {
+ val initialStart = remember(motionScene, needsUpdate.longValue) {
val startId = transition?.getStartConstraintSetId() ?: "start"
motionScene.getConstraintSetInstance(startId)
}
- val initialEnd = remember(motionScene, needsUpdate.value) {
+ val initialEnd = remember(motionScene, needsUpdate.longValue) {
val endId = transition?.getEndConstraintSetId() ?: "end"
motionScene.getConstraintSetInstance(endId)
}
@@ -557,8 +559,8 @@
val motionProgress = createAndUpdateMotionProgress(progress = progress)
val transitionImpl = (transition as? TransitionImpl) ?: TransitionImpl.EMPTY
// TODO: Merge this snippet with UpdateWithForcedIfNoUserChange
- val needsUpdate = remember { mutableStateOf(0L) }
- needsUpdate.value // Read the value to allow recomposition from informationReceiver
+ val needsUpdate = remember { mutableLongStateOf(0L) }
+ needsUpdate.longValue // Read the value to allow recomposition from informationReceiver
informationReceiver?.setUpdateFlag(needsUpdate)
UpdateWithForcedIfNoUserChange(
@@ -1005,7 +1007,7 @@
@Composable
internal fun createAndUpdateMotionProgress(progress: Float): MotionProgress {
val motionProgress = remember {
- MotionProgress.fromMutableState(mutableStateOf(progress))
+ MotionProgress.fromMutableState(mutableFloatStateOf(progress))
}
val last = remember { Ref<Float>().apply { value = progress } }
if (last.value != progress) {
diff --git a/constraintlayout/constraintlayout-compose/src/androidMain/kotlin/androidx/constraintlayout/compose/MotionRenderDebug.java b/constraintlayout/constraintlayout-compose/src/androidMain/kotlin/androidx/constraintlayout/compose/MotionRenderDebug.java
deleted file mode 100644
index e259358..0000000
--- a/constraintlayout/constraintlayout-compose/src/androidMain/kotlin/androidx/constraintlayout/compose/MotionRenderDebug.java
+++ /dev/null
@@ -1,437 +0,0 @@
-/*
- * Copyright (C) 2021 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 androidx.constraintlayout.compose;
-
-import android.graphics.Canvas;
-import android.graphics.DashPathEffect;
-import android.graphics.Paint;
-import android.graphics.Path;
-import android.graphics.Rect;
-
-import androidx.annotation.NonNull;
-import androidx.constraintlayout.core.motion.Motion;
-import androidx.constraintlayout.core.motion.MotionPaths;
-
-import java.util.HashMap;
-
-class MotionRenderDebug {
- public static final int DEBUG_SHOW_NONE = 0;
- public static final int DEBUG_SHOW_PROGRESS = 1;
- public static final int DEBUG_SHOW_PATH = 2;
-
- static final int MAX_KEY_FRAMES = 50;
- private static final int DEBUG_PATH_TICKS_PER_MS = 16;
- float[] mPoints;
- int[] mPathMode;
- float[] mKeyFramePoints;
- Path mPath;
- Paint mPaint;
- Paint mPaintKeyframes;
- Paint mPaintGraph;
- Paint mTextPaint;
- Paint mFillPaint;
- private float[] mRectangle;
- final int mRedColor = 0xFFFFAA33;
- final int mKeyframeColor = 0xffe0759a;
- final int mGraphColor = 0xFF33AA00;
- final int mShadowColor = 0x77000000;
- final int mDiamondSize = 10;
- DashPathEffect mDashPathEffect;
- int mKeyFrameCount;
- Rect mBounds = new Rect();
- boolean mPresentationMode = false;
- int mShadowTranslate = 1;
-
- MotionRenderDebug(float textSize) {
-
- mPaint = new Paint();
- mPaint.setAntiAlias(true);
- mPaint.setColor(mRedColor);
- mPaint.setStrokeWidth(2);
- mPaint.setStyle(Paint.Style.STROKE);
-
- mPaintKeyframes = new Paint();
- mPaintKeyframes.setAntiAlias(true);
- mPaintKeyframes.setColor(mKeyframeColor);
- mPaintKeyframes.setStrokeWidth(2);
- mPaintKeyframes.setStyle(Paint.Style.STROKE);
-
- mPaintGraph = new Paint();
- mPaintGraph.setAntiAlias(true);
- mPaintGraph.setColor(mGraphColor);
- mPaintGraph.setStrokeWidth(2);
- mPaintGraph.setStyle(Paint.Style.STROKE);
-
- mTextPaint = new Paint();
- mTextPaint.setAntiAlias(true);
- mTextPaint.setColor(mGraphColor);
- mTextPaint.setTextSize(textSize);
- mRectangle = new float[8];
- mFillPaint = new Paint();
- mFillPaint.setAntiAlias(true);
- mDashPathEffect = new DashPathEffect(new float[]{4, 8}, 0);
- mPaintGraph.setPathEffect(mDashPathEffect);
- mKeyFramePoints = new float[MAX_KEY_FRAMES * 2];
- mPathMode = new int[MAX_KEY_FRAMES];
-
- if (mPresentationMode) {
- mPaint.setStrokeWidth(8);
- mFillPaint.setStrokeWidth(8);
- mPaintKeyframes.setStrokeWidth(8);
- mShadowTranslate = 4;
- }
- }
-
- public void draw(Canvas canvas,
- HashMap<String, Motion> frameArrayList,
- int duration, int debugPath,
- int layoutWidth, int layoutHeight) {
- if (frameArrayList == null || frameArrayList.size() == 0) {
- return;
- }
- canvas.save();
-
- for (Motion motionController : frameArrayList.values()) {
- draw(canvas, motionController, duration, debugPath,
- layoutWidth, layoutHeight);
- }
- canvas.restore();
- }
-
- public void draw(Canvas canvas,
- Motion motionController,
- int duration, int debugPath,
- int layoutWidth, int layoutHeight) {
- int mode = motionController.getDrawPath();
- if (debugPath > 0 && mode == Motion.DRAW_PATH_NONE) {
- mode = Motion.DRAW_PATH_BASIC;
- }
- if (mode == Motion.DRAW_PATH_NONE) { // do not draw path
- return;
- }
-
- mKeyFrameCount = motionController.buildKeyFrames(mKeyFramePoints, mPathMode, null);
-
- if (mode >= Motion.DRAW_PATH_BASIC) {
-
- int frames = duration / DEBUG_PATH_TICKS_PER_MS;
- if (mPoints == null || mPoints.length != frames * 2) {
- mPoints = new float[frames * 2];
- mPath = new Path();
- }
-
- canvas.translate(mShadowTranslate, mShadowTranslate);
-
- mPaint.setColor(mShadowColor);
- mFillPaint.setColor(mShadowColor);
- mPaintKeyframes.setColor(mShadowColor);
- mPaintGraph.setColor(mShadowColor);
- motionController.buildPath(mPoints, frames);
- drawAll(canvas, mode, mKeyFrameCount, motionController, layoutWidth, layoutHeight);
- mPaint.setColor(mRedColor);
- mPaintKeyframes.setColor(mKeyframeColor);
- mFillPaint.setColor(mKeyframeColor);
- mPaintGraph.setColor(mGraphColor);
-
- canvas.translate(-mShadowTranslate, -mShadowTranslate);
- drawAll(canvas, mode, mKeyFrameCount, motionController, layoutWidth, layoutHeight);
- if (mode == Motion.DRAW_PATH_RECTANGLE) {
- drawRectangle(canvas, motionController);
- }
- }
-
- }
-
-
- public void drawAll(Canvas canvas, int mode, int keyFrames, Motion motionController,
- int layoutWidth, int layoutHeight) {
- if (mode == Motion.DRAW_PATH_AS_CONFIGURED) {
- drawPathAsConfigured(canvas);
- }
- if (mode == Motion.DRAW_PATH_RELATIVE) {
- drawPathRelative(canvas);
- }
- if (mode == Motion.DRAW_PATH_CARTESIAN) {
- drawPathCartesian(canvas);
- }
- drawBasicPath(canvas);
- drawTicks(canvas, mode, keyFrames, motionController, layoutWidth, layoutHeight);
- }
-
-
- /**
- * Draws the paths of the given {@link Motion motionController}, forcing the drawing mode
- * {@link Motion#DRAW_PATH_BASIC}.
- *
- * @param canvas Canvas instance used to draw on
- * @param motionController Controller containing path information
- * @param duration Defined in milliseconds, sets the amount of ticks used to draw the path
- * based on {@link #DEBUG_PATH_TICKS_PER_MS}
- * @param layoutWidth Width of the containing MotionLayout
- * @param layoutHeight Height of the containing MotionLayout
- * @param drawPath Whether to draw the path, paths are drawn using dashed lines
- * @param drawTicks Whether to draw diamond shaped ticks that indicate KeyPositions along a path
- */
- void basicDraw(@NonNull Canvas canvas,
- @NonNull Motion motionController,
- int duration,
- int layoutWidth,
- int layoutHeight,
- boolean drawPath,
- boolean drawTicks) {
- int mode = Motion.DRAW_PATH_BASIC;
- mKeyFrameCount = motionController.buildKeyFrames(mKeyFramePoints, mPathMode, null);
-
- int frames = duration / DEBUG_PATH_TICKS_PER_MS;
- if (mPoints == null || mPoints.length != frames * 2) {
- mPoints = new float[frames * 2];
- mPath = new Path();
- }
-
- canvas.translate(mShadowTranslate, mShadowTranslate);
-
- mPaint.setColor(mShadowColor);
- mFillPaint.setColor(mShadowColor);
- mPaintKeyframes.setColor(mShadowColor);
- mPaintGraph.setColor(mShadowColor);
- motionController.buildPath(mPoints, frames);
- if (drawPath) {
- drawBasicPath(canvas);
- }
- if (drawTicks) {
- drawTicks(canvas, mode, mKeyFrameCount, motionController, layoutWidth, layoutHeight);
- }
-
- mPaint.setColor(mRedColor);
- mPaintKeyframes.setColor(mKeyframeColor);
- mFillPaint.setColor(mKeyframeColor);
- mPaintGraph.setColor(mGraphColor);
- canvas.translate(-mShadowTranslate, -mShadowTranslate);
- if (drawPath) {
- drawBasicPath(canvas);
- }
- if (drawTicks) {
- drawTicks(canvas, mode, mKeyFrameCount, motionController, layoutWidth, layoutHeight);
- }
- }
-
- private void drawBasicPath(Canvas canvas) {
- canvas.drawLines(mPoints, mPaint);
- }
-
- private void drawTicks(Canvas canvas, int mode, int keyFrames, Motion motionController,
- int layoutWidth, int layoutHeight) {
- int viewWidth = 0;
- int viewHeight = 0;
- if (motionController.getView() != null) {
- viewWidth = motionController.getView().getWidth();
- viewHeight = motionController.getView().getHeight();
- }
- for (int i = 1; i < keyFrames - 1; i++) {
- if (mode == Motion.DRAW_PATH_AS_CONFIGURED
- && mPathMode[i - 1] == Motion.DRAW_PATH_NONE) {
- continue;
-
- }
- float x = mKeyFramePoints[i * 2];
- float y = mKeyFramePoints[i * 2 + 1];
- mPath.reset();
- mPath.moveTo(x, y + mDiamondSize);
- mPath.lineTo(x + mDiamondSize, y);
- mPath.lineTo(x, y - mDiamondSize);
- mPath.lineTo(x - mDiamondSize, y);
- mPath.close();
- float dx = 0; //framePoint.translationX
- float dy = 0; //framePoint.translationY
- if (mode == Motion.DRAW_PATH_AS_CONFIGURED) {
-
- if (mPathMode[i - 1] == MotionPaths.PERPENDICULAR) {
- drawPathRelativeTicks(canvas, x - dx, y - dy);
- } else if (mPathMode[i - 1] == MotionPaths.CARTESIAN) {
- drawPathCartesianTicks(canvas, x - dx, y - dy);
- } else if (mPathMode[i - 1] == MotionPaths.SCREEN) {
- drawPathScreenTicks(canvas, x - dx, y - dy,
- viewWidth, viewHeight, layoutWidth, layoutHeight);
- }
-
- canvas.drawPath(mPath, mFillPaint);
- }
- if (mode == Motion.DRAW_PATH_RELATIVE) {
- drawPathRelativeTicks(canvas, x - dx, y - dy);
- }
- if (mode == Motion.DRAW_PATH_CARTESIAN) {
- drawPathCartesianTicks(canvas, x - dx, y - dy);
- }
- if (mode == Motion.DRAW_PATH_SCREEN) {
- drawPathScreenTicks(canvas, x - dx, y - dy,
- viewWidth, viewHeight, layoutWidth, layoutHeight);
- }
- if (dx != 0 || dy != 0) {
- drawTranslation(canvas, x - dx, y - dy, x, y);
- } else {
- canvas.drawPath(mPath, mFillPaint);
- }
- }
- if (mPoints.length > 1) {
- // Draw the starting and ending circle
- canvas.drawCircle(mPoints[0], mPoints[1], 8, mPaintKeyframes);
- canvas.drawCircle(mPoints[mPoints.length - 2],
- mPoints[mPoints.length - 1], 8, mPaintKeyframes);
- }
- }
-
- private void drawTranslation(Canvas canvas, float x1, float y1, float x2, float y2) {
- canvas.drawRect(x1, y1, x2, y2, mPaintGraph);
- canvas.drawLine(x1, y1, x2, y2, mPaintGraph);
- }
-
- private void drawPathRelative(Canvas canvas) {
- canvas.drawLine(mPoints[0], mPoints[1],
- mPoints[mPoints.length - 2], mPoints[mPoints.length - 1], mPaintGraph);
- }
-
- private void drawPathAsConfigured(Canvas canvas) {
- boolean path = false;
- boolean cart = false;
- for (int i = 0; i < mKeyFrameCount; i++) {
- if (mPathMode[i] == MotionPaths.PERPENDICULAR) {
- path = true;
- }
- if (mPathMode[i] == MotionPaths.CARTESIAN) {
- cart = true;
- }
- }
- if (path) {
- drawPathRelative(canvas);
- }
- if (cart) {
- drawPathCartesian(canvas);
- }
- }
-
- private void drawPathRelativeTicks(Canvas canvas, float x, float y) {
- float x1 = mPoints[0];
- float y1 = mPoints[1];
- float x2 = mPoints[mPoints.length - 2];
- float y2 = mPoints[mPoints.length - 1];
- float dist = (float) Math.hypot(x1 - x2, y1 - y2);
- float t = ((x - x1) * (x2 - x1) + (y - y1) * (y2 - y1)) / (dist * dist);
- float xp = x1 + t * (x2 - x1);
- float yp = y1 + t * (y2 - y1);
-
- Path path = new Path();
- path.moveTo(x, y);
- path.lineTo(xp, yp);
- float len = (float) Math.hypot(xp - x, yp - y);
- String text = "" + ((int) (100 * len / dist)) / 100.0f;
- getTextBounds(text, mTextPaint);
- float off = len / 2 - mBounds.width() / 2;
- canvas.drawTextOnPath(text, path, off, -20, mTextPaint);
- canvas.drawLine(x, y, xp, yp, mPaintGraph);
- }
-
- void getTextBounds(String text, Paint paint) {
- paint.getTextBounds(text, 0, text.length(), mBounds);
- }
-
- private void drawPathCartesian(Canvas canvas) {
- float x1 = mPoints[0];
- float y1 = mPoints[1];
- float x2 = mPoints[mPoints.length - 2];
- float y2 = mPoints[mPoints.length - 1];
-
- canvas.drawLine(Math.min(x1, x2), Math.max(y1, y2),
- Math.max(x1, x2), Math.max(y1, y2), mPaintGraph);
- canvas.drawLine(Math.min(x1, x2), Math.min(y1, y2),
- Math.min(x1, x2), Math.max(y1, y2), mPaintGraph);
- }
-
- private void drawPathCartesianTicks(Canvas canvas, float x, float y) {
- float x1 = mPoints[0];
- float y1 = mPoints[1];
- float x2 = mPoints[mPoints.length - 2];
- float y2 = mPoints[mPoints.length - 1];
- float minx = Math.min(x1, x2);
- float maxy = Math.max(y1, y2);
- float xgap = x - Math.min(x1, x2);
- float ygap = Math.max(y1, y2) - y;
- // Horizontal line
- String text = "" + ((int) (0.5 + 100 * xgap / Math.abs(x2 - x1))) / 100.0f;
- getTextBounds(text, mTextPaint);
- float off = xgap / 2 - mBounds.width() / 2;
- canvas.drawText(text, off + minx, y - 20, mTextPaint);
- canvas.drawLine(x, y,
- Math.min(x1, x2), y, mPaintGraph);
-
- // Vertical line
- text = "" + ((int) (0.5 + 100 * ygap / Math.abs(y2 - y1))) / 100.0f;
- getTextBounds(text, mTextPaint);
- off = ygap / 2 - mBounds.height() / 2;
- canvas.drawText(text, x + 5, maxy - off, mTextPaint);
- canvas.drawLine(x, y,
- x, Math.max(y1, y2), mPaintGraph);
- }
-
- private void drawPathScreenTicks(Canvas canvas, float x, float y, int viewWidth, int viewHeight,
- int layoutWidth, int layoutHeight) {
- float x1 = 0;
- float y1 = 0;
- float x2 = 1;
- float y2 = 1;
- float minx = 0;
- float maxy = 0;
- float xgap = x;
- float ygap = y;
- // Horizontal line
- String text = "" + ((int) (0.5 + 100 * (xgap - viewWidth / 2)
- / (layoutWidth - viewWidth))) / 100.0f;
- getTextBounds(text, mTextPaint);
- float off = xgap / 2 - mBounds.width() / 2;
- canvas.drawText(text, off + minx, y - 20, mTextPaint);
- canvas.drawLine(x, y,
- Math.min(x1, x2), y, mPaintGraph);
-
- // Vertical line
- text = "" + ((int) (0.5 + 100 * (ygap - viewHeight / 2)
- / (layoutHeight - viewHeight))) / 100.0f;
- getTextBounds(text, mTextPaint);
- off = ygap / 2 - mBounds.height() / 2;
- canvas.drawText(text, x + 5, maxy - off, mTextPaint);
- canvas.drawLine(x, y,
- x, Math.max(y1, y2), mPaintGraph);
- }
-
- private void drawRectangle(Canvas canvas, Motion motionController) {
- mPath.reset();
- int rectFrames = 50;
- for (int i = 0; i <= rectFrames; i++) {
- float p = i / (float) rectFrames;
- motionController.buildRect(p, mRectangle, 0);
- mPath.moveTo(mRectangle[0], mRectangle[1]);
- mPath.lineTo(mRectangle[2], mRectangle[3]);
- mPath.lineTo(mRectangle[4], mRectangle[5]);
- mPath.lineTo(mRectangle[6], mRectangle[7]);
- mPath.close();
- }
- mPaint.setColor(0x44000000);
- canvas.translate(2, 2);
- canvas.drawPath(mPath, mPaint);
-
- canvas.translate(-2, -2);
- mPaint.setColor(0xFFFF0000);
- canvas.drawPath(mPath, mPaint);
- }
-}
\ No newline at end of file
diff --git a/constraintlayout/constraintlayout-compose/src/androidMain/kotlin/androidx/constraintlayout/compose/MotionRenderDebug.kt b/constraintlayout/constraintlayout-compose/src/androidMain/kotlin/androidx/constraintlayout/compose/MotionRenderDebug.kt
new file mode 100644
index 0000000..1477c32
--- /dev/null
+++ b/constraintlayout/constraintlayout-compose/src/androidMain/kotlin/androidx/constraintlayout/compose/MotionRenderDebug.kt
@@ -0,0 +1,460 @@
+/*
+ * Copyright (C) 2021 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 androidx.constraintlayout.compose
+
+import android.graphics.Canvas
+import android.graphics.DashPathEffect
+import android.graphics.Paint
+import android.graphics.Path
+import android.graphics.Rect
+import androidx.constraintlayout.core.motion.Motion
+import androidx.constraintlayout.core.motion.MotionPaths
+
+internal class MotionRenderDebug(textSize: Float) {
+ var mPoints: FloatArray? = null
+ var mPathMode: IntArray
+ var mKeyFramePoints: FloatArray
+ var mPath: Path? = null
+ var mPaint: Paint
+ var mPaintKeyframes: Paint
+ var mPaintGraph: Paint
+ var mTextPaint: Paint
+ var mFillPaint: Paint
+ private val mRectangle: FloatArray
+ val mRedColor = -0x55cd
+ val mKeyframeColor = -0x1f8a66
+ val mGraphColor = -0xcc5600
+ val mShadowColor = 0x77000000
+ val mDiamondSize = 10
+ var mDashPathEffect: DashPathEffect
+ var mKeyFrameCount = 0
+ var mBounds = Rect()
+ var mPresentationMode = false
+ var mShadowTranslate = 1
+
+ init {
+ mPaint = Paint()
+ mPaint.isAntiAlias = true
+ mPaint.color = mRedColor
+ mPaint.strokeWidth = 2f
+ mPaint.style = Paint.Style.STROKE
+ mPaintKeyframes = Paint()
+ mPaintKeyframes.isAntiAlias = true
+ mPaintKeyframes.color = mKeyframeColor
+ mPaintKeyframes.strokeWidth = 2f
+ mPaintKeyframes.style = Paint.Style.STROKE
+ mPaintGraph = Paint()
+ mPaintGraph.isAntiAlias = true
+ mPaintGraph.color = mGraphColor
+ mPaintGraph.strokeWidth = 2f
+ mPaintGraph.style = Paint.Style.STROKE
+ mTextPaint = Paint()
+ mTextPaint.isAntiAlias = true
+ mTextPaint.color = mGraphColor
+ mTextPaint.textSize = textSize
+ mRectangle = FloatArray(8)
+ mFillPaint = Paint()
+ mFillPaint.isAntiAlias = true
+ mDashPathEffect = DashPathEffect(floatArrayOf(4f, 8f), 0f)
+ mPaintGraph.pathEffect = mDashPathEffect
+ mKeyFramePoints = FloatArray(MAX_KEY_FRAMES * 2)
+ mPathMode = IntArray(MAX_KEY_FRAMES)
+ if (mPresentationMode) {
+ mPaint.strokeWidth = 8f
+ mFillPaint.strokeWidth = 8f
+ mPaintKeyframes.strokeWidth = 8f
+ mShadowTranslate = 4
+ }
+ }
+
+ fun draw(
+ canvas: Canvas,
+ frameArrayList: HashMap<String?, Motion>?,
+ duration: Int,
+ debugPath: Int,
+ layoutWidth: Int,
+ layoutHeight: Int
+ ) {
+ if (frameArrayList == null || frameArrayList.size == 0) {
+ return
+ }
+ canvas.save()
+ for (motionController in frameArrayList.values) {
+ draw(
+ canvas, motionController, duration, debugPath,
+ layoutWidth, layoutHeight
+ )
+ }
+ canvas.restore()
+ }
+
+ fun draw(
+ canvas: Canvas,
+ motionController: Motion,
+ duration: Int,
+ debugPath: Int,
+ layoutWidth: Int,
+ layoutHeight: Int
+ ) {
+ var mode = motionController.drawPath
+ if (debugPath > 0 && mode == Motion.DRAW_PATH_NONE) {
+ mode = Motion.DRAW_PATH_BASIC
+ }
+ if (mode == Motion.DRAW_PATH_NONE) { // do not draw path
+ return
+ }
+ mKeyFrameCount = motionController.buildKeyFrames(mKeyFramePoints, mPathMode, null)
+ if (mode >= Motion.DRAW_PATH_BASIC) {
+ val frames = duration / DEBUG_PATH_TICKS_PER_MS
+ if (mPoints == null || mPoints!!.size != frames * 2) {
+ mPoints = FloatArray(frames * 2)
+ mPath = Path()
+ }
+ canvas.translate(mShadowTranslate.toFloat(), mShadowTranslate.toFloat())
+ mPaint.color = mShadowColor
+ mFillPaint.color = mShadowColor
+ mPaintKeyframes.color = mShadowColor
+ mPaintGraph.color = mShadowColor
+ motionController.buildPath(mPoints, frames)
+ drawAll(canvas, mode, mKeyFrameCount, motionController, layoutWidth, layoutHeight)
+ mPaint.color = mRedColor
+ mPaintKeyframes.color = mKeyframeColor
+ mFillPaint.color = mKeyframeColor
+ mPaintGraph.color = mGraphColor
+ canvas.translate(-mShadowTranslate.toFloat(), -mShadowTranslate.toFloat())
+ drawAll(canvas, mode, mKeyFrameCount, motionController, layoutWidth, layoutHeight)
+ if (mode == Motion.DRAW_PATH_RECTANGLE) {
+ drawRectangle(canvas, motionController)
+ }
+ }
+ }
+
+ fun drawAll(
+ canvas: Canvas,
+ mode: Int,
+ keyFrames: Int,
+ motionController: Motion,
+ layoutWidth: Int,
+ layoutHeight: Int
+ ) {
+ if (mode == Motion.DRAW_PATH_AS_CONFIGURED) {
+ drawPathAsConfigured(canvas)
+ }
+ if (mode == Motion.DRAW_PATH_RELATIVE) {
+ drawPathRelative(canvas)
+ }
+ if (mode == Motion.DRAW_PATH_CARTESIAN) {
+ drawPathCartesian(canvas)
+ }
+ drawBasicPath(canvas)
+ drawTicks(canvas, mode, keyFrames, motionController, layoutWidth, layoutHeight)
+ }
+
+ /**
+ * Draws the paths of the given [motionController][Motion], forcing the drawing mode
+ * [Motion.DRAW_PATH_BASIC].
+ *
+ * @param canvas Canvas instance used to draw on
+ * @param motionController Controller containing path information
+ * @param duration Defined in milliseconds, sets the amount of ticks used to draw the path
+ * based on [.DEBUG_PATH_TICKS_PER_MS]
+ * @param layoutWidth Width of the containing MotionLayout
+ * @param layoutHeight Height of the containing MotionLayout
+ * @param drawPath Whether to draw the path, paths are drawn using dashed lines
+ * @param drawTicks Whether to draw diamond shaped ticks that indicate KeyPositions along a path
+ */
+ fun basicDraw(
+ canvas: Canvas,
+ motionController: Motion,
+ duration: Int,
+ layoutWidth: Int,
+ layoutHeight: Int,
+ drawPath: Boolean,
+ drawTicks: Boolean
+ ) {
+ val mode = Motion.DRAW_PATH_BASIC
+ mKeyFrameCount = motionController.buildKeyFrames(mKeyFramePoints, mPathMode, null)
+ val frames = duration / DEBUG_PATH_TICKS_PER_MS
+ if (mPoints == null || mPoints!!.size != frames * 2) {
+ mPoints = FloatArray(frames * 2)
+ mPath = Path()
+ }
+ canvas.translate(mShadowTranslate.toFloat(), mShadowTranslate.toFloat())
+ mPaint.color = mShadowColor
+ mFillPaint.color = mShadowColor
+ mPaintKeyframes.color = mShadowColor
+ mPaintGraph.color = mShadowColor
+ motionController.buildPath(mPoints, frames)
+ if (drawPath) {
+ drawBasicPath(canvas)
+ }
+ if (drawTicks) {
+ drawTicks(canvas, mode, mKeyFrameCount, motionController, layoutWidth, layoutHeight)
+ }
+ mPaint.color = mRedColor
+ mPaintKeyframes.color = mKeyframeColor
+ mFillPaint.color = mKeyframeColor
+ mPaintGraph.color = mGraphColor
+ canvas.translate(-mShadowTranslate.toFloat(), -mShadowTranslate.toFloat())
+ if (drawPath) {
+ drawBasicPath(canvas)
+ }
+ if (drawTicks) {
+ drawTicks(canvas, mode, mKeyFrameCount, motionController, layoutWidth, layoutHeight)
+ }
+ }
+
+ private fun drawBasicPath(canvas: Canvas) {
+ canvas.drawLines(mPoints!!, mPaint)
+ }
+
+ private fun drawTicks(
+ canvas: Canvas,
+ mode: Int,
+ keyFrames: Int,
+ motionController: Motion,
+ layoutWidth: Int,
+ layoutHeight: Int
+ ) {
+ var viewWidth = 0
+ var viewHeight = 0
+ if (motionController.view != null) {
+ viewWidth = motionController.view.width
+ viewHeight = motionController.view.height
+ }
+ for (i in 1 until keyFrames - 1) {
+ if (
+ mode == Motion.DRAW_PATH_AS_CONFIGURED && mPathMode[i - 1] == Motion.DRAW_PATH_NONE
+ ) {
+ continue
+ }
+ val x = mKeyFramePoints[i * 2]
+ val y = mKeyFramePoints[i * 2 + 1]
+ mPath!!.reset()
+ mPath!!.moveTo(x, y + mDiamondSize)
+ mPath!!.lineTo(x + mDiamondSize, y)
+ mPath!!.lineTo(x, y - mDiamondSize)
+ mPath!!.lineTo(x - mDiamondSize, y)
+ mPath!!.close()
+ val dx = 0f // framePoint.translationX
+ val dy = 0f // framePoint.translationY
+ if (mode == Motion.DRAW_PATH_AS_CONFIGURED) {
+ if (mPathMode[i - 1] == MotionPaths.PERPENDICULAR) {
+ drawPathRelativeTicks(canvas, x - dx, y - dy)
+ } else if (mPathMode[i - 1] == MotionPaths.CARTESIAN) {
+ drawPathCartesianTicks(canvas, x - dx, y - dy)
+ } else if (mPathMode[i - 1] == MotionPaths.SCREEN) {
+ drawPathScreenTicks(
+ canvas, x - dx, y - dy,
+ viewWidth, viewHeight, layoutWidth, layoutHeight
+ )
+ }
+ canvas.drawPath(mPath!!, mFillPaint)
+ }
+ if (mode == Motion.DRAW_PATH_RELATIVE) {
+ drawPathRelativeTicks(canvas, x - dx, y - dy)
+ }
+ if (mode == Motion.DRAW_PATH_CARTESIAN) {
+ drawPathCartesianTicks(canvas, x - dx, y - dy)
+ }
+ if (mode == Motion.DRAW_PATH_SCREEN) {
+ drawPathScreenTicks(
+ canvas, x - dx, y - dy,
+ viewWidth, viewHeight, layoutWidth, layoutHeight
+ )
+ }
+ if (dx != 0f || dy != 0f) {
+ drawTranslation(canvas, x - dx, y - dy, x, y)
+ } else {
+ canvas.drawPath(mPath!!, mFillPaint)
+ }
+ }
+ if (mPoints!!.size > 1) {
+ // Draw the starting and ending circle
+ canvas.drawCircle(mPoints!![0], mPoints!![1], 8f, mPaintKeyframes)
+ canvas.drawCircle(
+ mPoints!![mPoints!!.size - 2],
+ mPoints!![mPoints!!.size - 1], 8f, mPaintKeyframes
+ )
+ }
+ }
+
+ private fun drawTranslation(canvas: Canvas, x1: Float, y1: Float, x2: Float, y2: Float) {
+ canvas.drawRect(x1, y1, x2, y2, mPaintGraph)
+ canvas.drawLine(x1, y1, x2, y2, mPaintGraph)
+ }
+
+ private fun drawPathRelative(canvas: Canvas) {
+ canvas.drawLine(
+ mPoints!![0], mPoints!![1],
+ mPoints!![mPoints!!.size - 2], mPoints!![mPoints!!.size - 1], mPaintGraph
+ )
+ }
+
+ private fun drawPathAsConfigured(canvas: Canvas) {
+ var path = false
+ var cart = false
+ for (i in 0 until mKeyFrameCount) {
+ if (mPathMode[i] == MotionPaths.PERPENDICULAR) {
+ path = true
+ }
+ if (mPathMode[i] == MotionPaths.CARTESIAN) {
+ cart = true
+ }
+ }
+ if (path) {
+ drawPathRelative(canvas)
+ }
+ if (cart) {
+ drawPathCartesian(canvas)
+ }
+ }
+
+ private fun drawPathRelativeTicks(canvas: Canvas, x: Float, y: Float) {
+ val x1 = mPoints!![0]
+ val y1 = mPoints!![1]
+ val x2 = mPoints!![mPoints!!.size - 2]
+ val y2 = mPoints!![mPoints!!.size - 1]
+ val dist = Math.hypot((x1 - x2).toDouble(), (y1 - y2).toDouble()).toFloat()
+ val t = ((x - x1) * (x2 - x1) + (y - y1) * (y2 - y1)) / (dist * dist)
+ val xp = x1 + t * (x2 - x1)
+ val yp = y1 + t * (y2 - y1)
+ val path = Path()
+ path.moveTo(x, y)
+ path.lineTo(xp, yp)
+ val len = Math.hypot((xp - x).toDouble(), (yp - y).toDouble()).toFloat()
+ val text = "" + (100 * len / dist).toInt() / 100.0f
+ getTextBounds(text, mTextPaint)
+ val off = len / 2 - mBounds.width() / 2
+ canvas.drawTextOnPath(text, path, off, -20f, mTextPaint)
+ canvas.drawLine(x, y, xp, yp, mPaintGraph)
+ }
+
+ fun getTextBounds(text: String, paint: Paint) {
+ paint.getTextBounds(text, 0, text.length, mBounds)
+ }
+
+ private fun drawPathCartesian(canvas: Canvas) {
+ val x1 = mPoints!![0]
+ val y1 = mPoints!![1]
+ val x2 = mPoints!![mPoints!!.size - 2]
+ val y2 = mPoints!![mPoints!!.size - 1]
+ canvas.drawLine(
+ Math.min(x1, x2), Math.max(y1, y2),
+ Math.max(x1, x2), Math.max(y1, y2), mPaintGraph
+ )
+ canvas.drawLine(
+ Math.min(x1, x2), Math.min(y1, y2),
+ Math.min(x1, x2), Math.max(y1, y2), mPaintGraph
+ )
+ }
+
+ private fun drawPathCartesianTicks(canvas: Canvas, x: Float, y: Float) {
+ val x1 = mPoints!![0]
+ val y1 = mPoints!![1]
+ val x2 = mPoints!![mPoints!!.size - 2]
+ val y2 = mPoints!![mPoints!!.size - 1]
+ val minx = Math.min(x1, x2)
+ val maxy = Math.max(y1, y2)
+ val xgap = x - Math.min(x1, x2)
+ val ygap = Math.max(y1, y2) - y
+ // Horizontal line
+ var text = "" + (0.5 + 100 * xgap / Math.abs(x2 - x1)).toInt() / 100.0f
+ getTextBounds(text, mTextPaint)
+ var off = xgap / 2 - mBounds.width() / 2
+ canvas.drawText(text, off + minx, y - 20, mTextPaint)
+ canvas.drawLine(
+ x, y,
+ Math.min(x1, x2), y, mPaintGraph
+ )
+
+ // Vertical line
+ text = "" + (0.5 + 100 * ygap / Math.abs(y2 - y1)).toInt() / 100.0f
+ getTextBounds(text, mTextPaint)
+ off = ygap / 2 - mBounds.height() / 2
+ canvas.drawText(text, x + 5, maxy - off, mTextPaint)
+ canvas.drawLine(
+ x, y,
+ x, Math.max(y1, y2), mPaintGraph
+ )
+ }
+
+ private fun drawPathScreenTicks(
+ canvas: Canvas,
+ x: Float,
+ y: Float,
+ viewWidth: Int,
+ viewHeight: Int,
+ layoutWidth: Int,
+ layoutHeight: Int
+ ) {
+ val x1 = 0f
+ val y1 = 0f
+ val x2 = 1f
+ val y2 = 1f
+ val minx = 0f
+ val maxy = 0f
+ // Horizontal line
+ var text = "" + (0.5 + 100 * (x - viewWidth / 2) /
+ (layoutWidth - viewWidth)).toInt() / 100.0f
+ getTextBounds(text, mTextPaint)
+ var off = x / 2 - mBounds.width() / 2
+ canvas.drawText(text, off + minx, y - 20, mTextPaint)
+ canvas.drawLine(
+ x, y,
+ Math.min(x1, x2), y, mPaintGraph
+ )
+
+ // Vertical line
+ text = "" + (0.5 + 100 * (y - viewHeight / 2) /
+ (layoutHeight - viewHeight)).toInt() / 100.0f
+ getTextBounds(text, mTextPaint)
+ off = y / 2 - mBounds.height() / 2
+ canvas.drawText(text, x + 5, maxy - off, mTextPaint)
+ canvas.drawLine(
+ x, y,
+ x, Math.max(y1, y2), mPaintGraph
+ )
+ }
+
+ private fun drawRectangle(canvas: Canvas, motionController: Motion) {
+ mPath!!.reset()
+ val rectFrames = 50
+ for (i in 0..rectFrames) {
+ val p = i / rectFrames.toFloat()
+ motionController.buildRect(p, mRectangle, 0)
+ mPath!!.moveTo(mRectangle[0], mRectangle[1])
+ mPath!!.lineTo(mRectangle[2], mRectangle[3])
+ mPath!!.lineTo(mRectangle[4], mRectangle[5])
+ mPath!!.lineTo(mRectangle[6], mRectangle[7])
+ mPath!!.close()
+ }
+ mPaint.color = 0x44000000
+ canvas.translate(2f, 2f)
+ canvas.drawPath(mPath!!, mPaint)
+ canvas.translate(-2f, -2f)
+ mPaint.color = -0x10000
+ canvas.drawPath(mPath!!, mPaint)
+ }
+
+ companion object {
+ const val DEBUG_SHOW_NONE = 0
+ const val DEBUG_SHOW_PROGRESS = 1
+ const val DEBUG_SHOW_PATH = 2
+ const val MAX_KEY_FRAMES = 50
+ private const val DEBUG_PATH_TICKS_PER_MS = 16
+ }
+}
\ No newline at end of file
diff --git a/constraintlayout/constraintlayout-compose/src/androidMain/kotlin/androidx/constraintlayout/compose/carousel/CarouselSwipeable.kt b/constraintlayout/constraintlayout-compose/src/androidMain/kotlin/androidx/constraintlayout/compose/carousel/CarouselSwipeable.kt
index 3c7ee4d..a0bb06f 100644
--- a/constraintlayout/constraintlayout-compose/src/androidMain/kotlin/androidx/constraintlayout/compose/carousel/CarouselSwipeable.kt
+++ b/constraintlayout/constraintlayout-compose/src/androidMain/kotlin/androidx/constraintlayout/compose/carousel/CarouselSwipeable.kt
@@ -189,7 +189,7 @@
internal var thresholds: (Float, Float) -> Float by mutableStateOf({ _, _ -> 0f })
- internal var velocityThreshold by mutableStateOf(0f)
+ internal var velocityThreshold by mutableFloatStateOf(0f)
internal var resistance: ResistanceConfig? by mutableStateOf(null)
diff --git a/constraintlayout/constraintlayout/src/main/java/androidx/constraintlayout/motion/widget/KeyFrames.java b/constraintlayout/constraintlayout/src/main/java/androidx/constraintlayout/motion/widget/KeyFrames.java
index f7c980f..517236c 100644
--- a/constraintlayout/constraintlayout/src/main/java/androidx/constraintlayout/motion/widget/KeyFrames.java
+++ b/constraintlayout/constraintlayout/src/main/java/androidx/constraintlayout/motion/widget/KeyFrames.java
@@ -91,19 +91,30 @@
tagName = parser.getName();
if (sKeyMakers.containsKey(tagName)) {
- try {
- Constructor<? extends Key> keyMaker = sKeyMakers.get(tagName);
- if (keyMaker != null) {
- key = keyMaker.newInstance();
- key.load(context, Xml.asAttributeSet(parser));
- addKey(key);
- } else {
+
+ switch (tagName) {
+ case KeyAttributes.NAME:
+ key = new KeyAttributes();
+ break;
+ case KeyPosition.NAME:
+ key = new KeyPosition();
+ break;
+ case KeyCycle.NAME:
+ key = new KeyCycle();
+ break;
+ case KeyTimeCycle.NAME:
+ key = new KeyTimeCycle();
+ break;
+ case KeyTrigger.NAME:
+ key = new KeyTrigger();
+ break;
+ default:
throw new NullPointerException(
- "Keymaker for " + tagName + " not found");
- }
- } catch (Exception e) {
- Log.e(TAG, "unable to create ", e);
+ "Key " + tagName + " not found");
}
+ key.load(context, Xml.asAttributeSet(parser));
+ addKey(key);
+
} else if (tagName.equalsIgnoreCase(CUSTOM_ATTRIBUTE)) {
if (key != null && key.mCustomConstraints != null) {
ConstraintAttribute.parse(context, parser, key.mCustomConstraints);
diff --git a/contentpager/contentpager/src/main/AndroidManifest.xml b/contentpager/contentpager/src/main/AndroidManifest.xml
deleted file mode 100644
index 95c4426..0000000
--- a/contentpager/contentpager/src/main/AndroidManifest.xml
+++ /dev/null
@@ -1,16 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2017 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.
--->
-<manifest />
diff --git a/coordinatorlayout/coordinatorlayout/src/main/AndroidManifest.xml b/coordinatorlayout/coordinatorlayout/src/main/AndroidManifest.xml
deleted file mode 100644
index dd3d3a3..0000000
--- a/coordinatorlayout/coordinatorlayout/src/main/AndroidManifest.xml
+++ /dev/null
@@ -1,16 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2018 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.
--->
-<manifest />
diff --git a/core/core-animation-integration-tests/testapp/src/main/AndroidManifest.xml b/core/core-animation-integration-tests/testapp/src/main/AndroidManifest.xml
deleted file mode 100644
index dd3d3a3..0000000
--- a/core/core-animation-integration-tests/testapp/src/main/AndroidManifest.xml
+++ /dev/null
@@ -1,16 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2018 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.
--->
-<manifest />
diff --git a/core/core-animation-testing/src/main/AndroidManifest.xml b/core/core-animation-testing/src/main/AndroidManifest.xml
deleted file mode 100644
index dd3d3a3..0000000
--- a/core/core-animation-testing/src/main/AndroidManifest.xml
+++ /dev/null
@@ -1,16 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2018 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.
--->
-<manifest />
diff --git a/core/core-animation/src/main/AndroidManifest.xml b/core/core-animation/src/main/AndroidManifest.xml
deleted file mode 100644
index dd3d3a3..0000000
--- a/core/core-animation/src/main/AndroidManifest.xml
+++ /dev/null
@@ -1,16 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2018 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.
--->
-<manifest />
diff --git a/core/core-appdigest/src/main/AndroidManifest.xml b/core/core-appdigest/src/main/AndroidManifest.xml
deleted file mode 100644
index 3031a00..0000000
--- a/core/core-appdigest/src/main/AndroidManifest.xml
+++ /dev/null
@@ -1,19 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-
-<!--
- ~ Copyright (C) 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.
- -->
-
-<manifest />
diff --git a/core/core-ktx/src/main/AndroidManifest.xml b/core/core-ktx/src/main/AndroidManifest.xml
deleted file mode 100644
index cc947c5..0000000
--- a/core/core-ktx/src/main/AndroidManifest.xml
+++ /dev/null
@@ -1 +0,0 @@
-<manifest />
diff --git a/core/core-role/src/main/AndroidManifest.xml b/core/core-role/src/main/AndroidManifest.xml
deleted file mode 100644
index 5e016ed..0000000
--- a/core/core-role/src/main/AndroidManifest.xml
+++ /dev/null
@@ -1,19 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-
-<!--
- ~ Copyright (C) 2019 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.
- -->
-
-<manifest />
diff --git a/cursoradapter/cursoradapter/src/main/AndroidManifest.xml b/cursoradapter/cursoradapter/src/main/AndroidManifest.xml
deleted file mode 100644
index 6f49e23..0000000
--- a/cursoradapter/cursoradapter/src/main/AndroidManifest.xml
+++ /dev/null
@@ -1,16 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2014 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.
--->
-<manifest />
diff --git a/customview/customview/src/main/AndroidManifest.xml b/customview/customview/src/main/AndroidManifest.xml
deleted file mode 100644
index 6f49e23..0000000
--- a/customview/customview/src/main/AndroidManifest.xml
+++ /dev/null
@@ -1,16 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2014 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.
--->
-<manifest />
diff --git a/documentfile/documentfile/src/main/AndroidManifest.xml b/documentfile/documentfile/src/main/AndroidManifest.xml
deleted file mode 100644
index 6f49e23..0000000
--- a/documentfile/documentfile/src/main/AndroidManifest.xml
+++ /dev/null
@@ -1,16 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2014 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.
--->
-<manifest />
diff --git a/drawerlayout/drawerlayout/src/main/AndroidManifest.xml b/drawerlayout/drawerlayout/src/main/AndroidManifest.xml
deleted file mode 100644
index 6f49e23..0000000
--- a/drawerlayout/drawerlayout/src/main/AndroidManifest.xml
+++ /dev/null
@@ -1,16 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2014 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.
--->
-<manifest />
diff --git a/dynamicanimation/dynamicanimation-ktx/src/main/AndroidManifest.xml b/dynamicanimation/dynamicanimation-ktx/src/main/AndroidManifest.xml
deleted file mode 100644
index 9db011d..0000000
--- a/dynamicanimation/dynamicanimation-ktx/src/main/AndroidManifest.xml
+++ /dev/null
@@ -1,17 +0,0 @@
-<!--
- ~ Copyright 2018 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.
- -->
-
-<manifest />
\ No newline at end of file
diff --git a/dynamicanimation/dynamicanimation/src/androidTest/java/androidx/dynamicanimation/tests/SpringTests.java b/dynamicanimation/dynamicanimation/src/androidTest/java/androidx/dynamicanimation/tests/SpringTests.java
index 58b53c0..7caf3e7 100644
--- a/dynamicanimation/dynamicanimation/src/androidTest/java/androidx/dynamicanimation/tests/SpringTests.java
+++ b/dynamicanimation/dynamicanimation/src/androidTest/java/androidx/dynamicanimation/tests/SpringTests.java
@@ -126,6 +126,7 @@
* Test that spring animation can work with a single property without an object.
*/
@Test
+ @Ignore("b/280665072")
public void testFloatValueHolder() {
final FloatValueHolder floatValueHolder = new FloatValueHolder(0f);
DynamicAnimation.OnAnimationUpdateListener updateListener =
@@ -354,6 +355,7 @@
*/
@LargeTest
@Test
+ @Ignore("b/280665072")
public void testStiffness() {
float[] dampingRatios = {0.3f, 0.5f, 1f, 5f};
final float[] stiffness = {50f, 500f, 1500f, 5000f};
diff --git a/dynamicanimation/dynamicanimation/src/main/AndroidManifest.xml b/dynamicanimation/dynamicanimation/src/main/AndroidManifest.xml
deleted file mode 100644
index 95c4426..0000000
--- a/dynamicanimation/dynamicanimation/src/main/AndroidManifest.xml
+++ /dev/null
@@ -1,16 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2017 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.
--->
-<manifest />
diff --git a/emoji/emoji-appcompat/src/main/AndroidManifest.xml b/emoji/emoji-appcompat/src/main/AndroidManifest.xml
deleted file mode 100644
index c7003d8..0000000
--- a/emoji/emoji-appcompat/src/main/AndroidManifest.xml
+++ /dev/null
@@ -1,17 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
- ~ Copyright (C) 2017 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.
- -->
-<manifest />
diff --git a/emoji/emoji-bundled/src/main/AndroidManifest.xml b/emoji/emoji-bundled/src/main/AndroidManifest.xml
deleted file mode 100644
index c50336e..0000000
--- a/emoji/emoji-bundled/src/main/AndroidManifest.xml
+++ /dev/null
@@ -1,16 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2017 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.
--->
-<manifest />
\ No newline at end of file
diff --git a/emoji/emoji/src/main/AndroidManifest.xml b/emoji/emoji/src/main/AndroidManifest.xml
deleted file mode 100644
index a213cdc..0000000
--- a/emoji/emoji/src/main/AndroidManifest.xml
+++ /dev/null
@@ -1,16 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2017 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.
--->
-<manifest/>
diff --git a/emoji2/emoji2-benchmark/src/main/AndroidManifest.xml b/emoji2/emoji2-benchmark/src/main/AndroidManifest.xml
deleted file mode 100644
index 29b496b..0000000
--- a/emoji2/emoji2-benchmark/src/main/AndroidManifest.xml
+++ /dev/null
@@ -1,17 +0,0 @@
-<!--
- ~ Copyright (C) 2018 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.
- -->
-
-<manifest />
diff --git a/emoji2/integration-tests/init-disabled-macrobenchmark/src/androidTest/AndroidManifest.xml b/emoji2/integration-tests/init-disabled-macrobenchmark/src/androidTest/AndroidManifest.xml
deleted file mode 100644
index 5b41847..0000000
--- a/emoji2/integration-tests/init-disabled-macrobenchmark/src/androidTest/AndroidManifest.xml
+++ /dev/null
@@ -1,17 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
- ~ Copyright (C) 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.
- -->
-<manifest />
diff --git a/emoji2/integration-tests/init-disabled-macrobenchmark/src/main/AndroidManifest.xml b/emoji2/integration-tests/init-disabled-macrobenchmark/src/main/AndroidManifest.xml
deleted file mode 100644
index ed173d5..0000000
--- a/emoji2/integration-tests/init-disabled-macrobenchmark/src/main/AndroidManifest.xml
+++ /dev/null
@@ -1,16 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?><!--
- ~ Copyright (C) 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.
- -->
-<manifest />
diff --git a/emoji2/integration-tests/init-enabled-macrobenchmark/src/androidTest/AndroidManifest.xml b/emoji2/integration-tests/init-enabled-macrobenchmark/src/androidTest/AndroidManifest.xml
deleted file mode 100644
index 5b41847..0000000
--- a/emoji2/integration-tests/init-enabled-macrobenchmark/src/androidTest/AndroidManifest.xml
+++ /dev/null
@@ -1,17 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
- ~ Copyright (C) 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.
- -->
-<manifest />
diff --git a/emoji2/integration-tests/init-enabled-macrobenchmark/src/main/AndroidManifest.xml b/emoji2/integration-tests/init-enabled-macrobenchmark/src/main/AndroidManifest.xml
deleted file mode 100644
index ed173d5..0000000
--- a/emoji2/integration-tests/init-enabled-macrobenchmark/src/main/AndroidManifest.xml
+++ /dev/null
@@ -1,16 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?><!--
- ~ Copyright (C) 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.
- -->
-<manifest />
diff --git a/enterprise/enterprise-feedback-testing/src/main/AndroidManifest.xml b/enterprise/enterprise-feedback-testing/src/main/AndroidManifest.xml
deleted file mode 100644
index de53569..0000000
--- a/enterprise/enterprise-feedback-testing/src/main/AndroidManifest.xml
+++ /dev/null
@@ -1,18 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
- Copyright 2019 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.
- -->
-
-<manifest />
diff --git a/exifinterface/exifinterface/src/main/AndroidManifest.xml b/exifinterface/exifinterface/src/main/AndroidManifest.xml
deleted file mode 100644
index 5197378..0000000
--- a/exifinterface/exifinterface/src/main/AndroidManifest.xml
+++ /dev/null
@@ -1,16 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2015 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.
--->
-<manifest />
diff --git a/external/libyuv/src/main/AndroidManifest.xml b/external/libyuv/src/main/AndroidManifest.xml
deleted file mode 100644
index 95ab252..0000000
--- a/external/libyuv/src/main/AndroidManifest.xml
+++ /dev/null
@@ -1,16 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?><!--
- ~ Copyright 2021 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.
- -->
-<manifest />
\ No newline at end of file
diff --git a/fragment/fragment-ktx/src/main/AndroidManifest.xml b/fragment/fragment-ktx/src/main/AndroidManifest.xml
deleted file mode 100644
index dd3d3a3..0000000
--- a/fragment/fragment-ktx/src/main/AndroidManifest.xml
+++ /dev/null
@@ -1,16 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2018 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.
--->
-<manifest />
diff --git a/fragment/fragment-truth/src/main/AndroidManifest.xml b/fragment/fragment-truth/src/main/AndroidManifest.xml
deleted file mode 100644
index cf0d807..0000000
--- a/fragment/fragment-truth/src/main/AndroidManifest.xml
+++ /dev/null
@@ -1,17 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
- ~ Copyright (C) 2019 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.
- -->
-<manifest />
diff --git a/fragment/fragment/src/main/AndroidManifest.xml b/fragment/fragment/src/main/AndroidManifest.xml
deleted file mode 100644
index 6f49e23..0000000
--- a/fragment/fragment/src/main/AndroidManifest.xml
+++ /dev/null
@@ -1,16 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2014 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.
--->
-<manifest />
diff --git a/glance/glance-appwidget/integration-tests/demos/src/main/java/androidx/glance/appwidget/demos/ProgressIndicatorAppWidget.kt b/glance/glance-appwidget/integration-tests/demos/src/main/java/androidx/glance/appwidget/demos/ProgressIndicatorAppWidget.kt
index 3f5283a..171a220 100644
--- a/glance/glance-appwidget/integration-tests/demos/src/main/java/androidx/glance/appwidget/demos/ProgressIndicatorAppWidget.kt
+++ b/glance/glance-appwidget/integration-tests/demos/src/main/java/androidx/glance/appwidget/demos/ProgressIndicatorAppWidget.kt
@@ -17,22 +17,30 @@
package androidx.glance.appwidget.demos
import android.content.Context
+import androidx.compose.material3.darkColorScheme
+import androidx.compose.material3.lightColorScheme
+import androidx.compose.runtime.Composable
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.unit.dp
import androidx.glance.GlanceId
import androidx.glance.GlanceModifier
+import androidx.glance.GlanceTheme
import androidx.glance.appwidget.CircularProgressIndicator
import androidx.glance.appwidget.GlanceAppWidget
import androidx.glance.appwidget.GlanceAppWidgetReceiver
import androidx.glance.appwidget.LinearProgressIndicator
import androidx.glance.appwidget.provideContent
import androidx.glance.background
+import androidx.glance.color.ColorProvider
import androidx.glance.layout.Alignment
import androidx.glance.layout.Column
+import androidx.glance.layout.Row
import androidx.glance.layout.Spacer
import androidx.glance.layout.fillMaxSize
import androidx.glance.layout.padding
import androidx.glance.layout.size
+import androidx.glance.layout.width
+import androidx.glance.material3.ColorProviders
import androidx.glance.unit.ColorProvider
class ProgressIndicatorAppWidget : GlanceAppWidget() {
@@ -40,31 +48,97 @@
context: Context,
id: GlanceId
) = provideContent {
- Column(
- modifier = GlanceModifier.fillMaxSize()
- .background(R.color.default_widget_background),
- verticalAlignment = Alignment.CenterVertically,
- horizontalAlignment = Alignment.CenterHorizontally
- ) {
+ GlanceTheme(ProgressIndicatorDemoColorScheme.colors) {
+ Column(
+ modifier = GlanceModifier.fillMaxSize()
+ .background(R.color.default_widget_background),
+ verticalAlignment = Alignment.CenterVertically,
+ horizontalAlignment = Alignment.CenterHorizontally
+ ) {
+ Row {
+ LinearProgressIndicatorsDemo(modifier = GlanceModifier.defaultWeight())
+ Spacer(modifier = GlanceModifier.width(10.dp))
+ CircularProgressIndicatorsDemo()
+ }
+ }
+ }
+ }
+
+ @Composable
+ private fun CircularProgressIndicatorsDemo(modifier: GlanceModifier = GlanceModifier) {
+ Column(modifier) {
+ CircularProgressIndicator()
+ Spacer(GlanceModifier.size(8.dp))
+ CircularProgressIndicator(
+ color = GlanceTheme.colors.primary
+ )
+ Spacer(GlanceModifier.size(8.dp))
+ CircularProgressIndicator(
+ color = ColorProvider(day = Color.White, night = Color.Red)
+ )
+ Spacer(GlanceModifier.size(8.dp))
+ CircularProgressIndicator(
+ color = ColorProvider(androidx.glance.R.color.glance_colorSecondary)
+ )
+ Spacer(GlanceModifier.size(8.dp))
+ CircularProgressIndicator(
+ color = ColorProvider(Color.Red)
+ )
+ }
+ }
+
+ @Composable
+ private fun LinearProgressIndicatorsDemo(modifier: GlanceModifier) {
+ Column(modifier) {
LinearProgressIndicator()
Spacer(GlanceModifier.size(8.dp))
- LinearProgressIndicator(0.5f)
+ LinearProgressIndicator(
+ progress = 0.5f,
+ color = GlanceTheme.colors.primary,
+ backgroundColor = GlanceTheme.colors.onBackground
+ )
Spacer(GlanceModifier.size(8.dp))
LinearProgressIndicator(
progress = .66f,
modifier = GlanceModifier.padding(bottom = 8.dp),
color = ColorProvider(androidx.glance.R.color.glance_colorError),
- backgroundColor = ColorProvider(androidx.glance.R.color.glance_colorSecondary)
+ backgroundColor = ColorProvider(
+ resId = androidx.glance.R.color.glance_colorSecondary
+ )
)
+ Spacer(GlanceModifier.size(8.dp))
+ LinearProgressIndicator(
+ progress = .66f,
+ modifier = GlanceModifier.padding(bottom = 8.dp),
+ color = ColorProvider(day = Color.White, night = Color.Red),
+ backgroundColor = ColorProvider(day = Color.Red, night = Color.White)
+ )
+ Spacer(GlanceModifier.size(8.dp))
LinearProgressIndicator(progress = 0.8f, color = ColorProvider(Color.White))
- Spacer(GlanceModifier.size(8.dp))
- CircularProgressIndicator()
- Spacer(GlanceModifier.size(8.dp))
- CircularProgressIndicator(color = ColorProvider(Color.White))
}
}
}
class ProgressIndicatorAppWidgetReceiver : GlanceAppWidgetReceiver() {
override val glanceAppWidget: GlanceAppWidget = ProgressIndicatorAppWidget()
+}
+
+internal object ProgressIndicatorDemoColorScheme {
+ private val md_theme_light_primary = Color(0xFF026E00)
+ private val md_theme_light_onBackground = Color(0xFF1E1C00)
+
+ private val md_theme_dark_primary = Color(0xFF02E600)
+ private val md_theme_dark_onBackground = Color(0xFFF2E720)
+
+ private val LightColors = lightColorScheme(
+ primary = md_theme_light_primary,
+ onBackground = md_theme_light_onBackground,
+ )
+
+ private val DarkColors = darkColorScheme(
+ primary = md_theme_dark_primary,
+ onBackground = md_theme_dark_onBackground,
+ )
+
+ val colors = ColorProviders(light = LightColors, dark = DarkColors)
}
\ No newline at end of file
diff --git a/glance/glance-appwidget/integration-tests/macrobenchmark/src/main/AndroidManifest.xml b/glance/glance-appwidget/integration-tests/macrobenchmark/src/main/AndroidManifest.xml
deleted file mode 100644
index 5b41847..0000000
--- a/glance/glance-appwidget/integration-tests/macrobenchmark/src/main/AndroidManifest.xml
+++ /dev/null
@@ -1,17 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
- ~ Copyright (C) 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.
- -->
-<manifest />
diff --git a/glance/glance-appwidget/src/androidMain/kotlin/androidx/glance/appwidget/translators/CircularProgressIndicatorTranslator.kt b/glance/glance-appwidget/src/androidMain/kotlin/androidx/glance/appwidget/translators/CircularProgressIndicatorTranslator.kt
index 0d7c717..33a20ed 100644
--- a/glance/glance-appwidget/src/androidMain/kotlin/androidx/glance/appwidget/translators/CircularProgressIndicatorTranslator.kt
+++ b/glance/glance-appwidget/src/androidMain/kotlin/androidx/glance/appwidget/translators/CircularProgressIndicatorTranslator.kt
@@ -25,10 +25,13 @@
import androidx.core.widget.RemoteViewsCompat.setProgressBarIndeterminateTintList
import androidx.compose.ui.graphics.toArgb
import android.content.res.ColorStateList
+import android.util.Log
import androidx.glance.unit.FixedColorProvider
import androidx.glance.unit.ResourceColorProvider
import androidx.glance.appwidget.EmittableCircularProgressIndicator
+import androidx.glance.appwidget.GlanceAppWidgetTag
+import androidx.glance.color.DayNightColorProvider
internal fun RemoteViews.translateEmittableCircularProgressIndicator(
translationContext: TranslationContext,
@@ -49,9 +52,18 @@
is ResourceColorProvider -> {
setProgressBarIndeterminateTintList(
viewId = viewDef.mainViewId,
- tint = ColorStateList.valueOf(indicatorColor.resId)
+ resId = indicatorColor.resId
)
}
+ is DayNightColorProvider -> {
+ setProgressBarIndeterminateTintList(
+ viewId = viewDef.mainViewId,
+ notNightTint = ColorStateList.valueOf(indicatorColor.day.toArgb()),
+ nightTint = ColorStateList.valueOf(indicatorColor.night.toArgb())
+ )
+ }
+ else ->
+ Log.w(GlanceAppWidgetTag, "Unexpected progress indicator color: $indicatorColor")
}
}
applyModifiers(translationContext, this, element.modifier, viewDef)
diff --git a/glance/glance-appwidget/src/androidMain/kotlin/androidx/glance/appwidget/translators/LinearProgressIndicatorTranslator.kt b/glance/glance-appwidget/src/androidMain/kotlin/androidx/glance/appwidget/translators/LinearProgressIndicatorTranslator.kt
index 0c1342b..5b9aca4 100644
--- a/glance/glance-appwidget/src/androidMain/kotlin/androidx/glance/appwidget/translators/LinearProgressIndicatorTranslator.kt
+++ b/glance/glance-appwidget/src/androidMain/kotlin/androidx/glance/appwidget/translators/LinearProgressIndicatorTranslator.kt
@@ -26,10 +26,13 @@
import androidx.core.widget.RemoteViewsCompat.setProgressBarProgressBackgroundTintList
import androidx.compose.ui.graphics.toArgb
import android.content.res.ColorStateList
+import android.util.Log
import androidx.glance.unit.FixedColorProvider
import androidx.glance.unit.ResourceColorProvider
import androidx.glance.appwidget.EmittableLinearProgressIndicator
+import androidx.glance.appwidget.GlanceAppWidgetTag
+import androidx.glance.color.DayNightColorProvider
internal fun RemoteViews.translateEmittableLinearProgressIndicator(
translationContext: TranslationContext,
@@ -54,6 +57,15 @@
resId = indicatorColor.resId
)
}
+ is DayNightColorProvider -> {
+ setProgressBarProgressTintList(
+ viewId = viewDef.mainViewId,
+ notNightTint = ColorStateList.valueOf(indicatorColor.day.toArgb()),
+ nightTint = ColorStateList.valueOf(indicatorColor.night.toArgb())
+ )
+ }
+ else ->
+ Log.w(GlanceAppWidgetTag, "Unexpected progress indicator color: $indicatorColor")
}
when (val backgroundColor = element.backgroundColor) {
@@ -69,6 +81,16 @@
resId = backgroundColor.resId
)
}
+ is DayNightColorProvider -> {
+ setProgressBarProgressBackgroundTintList(
+ viewId = viewDef.mainViewId,
+ notNightTint = ColorStateList.valueOf(backgroundColor.day.toArgb()),
+ nightTint = ColorStateList.valueOf(backgroundColor.night.toArgb())
+ )
+ }
+ else ->
+ Log.w(GlanceAppWidgetTag,
+ "Unexpected progress indicator background color: $backgroundColor")
}
}
applyModifiers(translationContext, this, element.modifier, viewDef)
diff --git a/glance/glance-wear-tiles/src/androidAndroidTest/AndroidManifest.xml b/glance/glance-wear-tiles/src/androidAndroidTest/AndroidManifest.xml
deleted file mode 100644
index 3c3c224..0000000
--- a/glance/glance-wear-tiles/src/androidAndroidTest/AndroidManifest.xml
+++ /dev/null
@@ -1,17 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
- Copyright 2021 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.
- -->
-<manifest />
diff --git a/glance/glance-wear-tiles/src/androidMain/AndroidManifest.xml b/glance/glance-wear-tiles/src/androidMain/AndroidManifest.xml
deleted file mode 100644
index 3c3c224..0000000
--- a/glance/glance-wear-tiles/src/androidMain/AndroidManifest.xml
+++ /dev/null
@@ -1,17 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
- Copyright 2021 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.
- -->
-<manifest />
diff --git a/glance/glance/src/androidMain/AndroidManifest.xml b/glance/glance/src/androidMain/AndroidManifest.xml
deleted file mode 100644
index 3c3c224..0000000
--- a/glance/glance/src/androidMain/AndroidManifest.xml
+++ /dev/null
@@ -1,17 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
- Copyright 2021 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.
- -->
-<manifest />
diff --git a/gridlayout/gridlayout/src/main/AndroidManifest.xml b/gridlayout/gridlayout/src/main/AndroidManifest.xml
deleted file mode 100644
index bd7af07..0000000
--- a/gridlayout/gridlayout/src/main/AndroidManifest.xml
+++ /dev/null
@@ -1,16 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2013 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.
--->
-<manifest />
diff --git a/health/connect/connect-client/samples/src/main/AndroidManifest.xml b/health/connect/connect-client/samples/src/main/AndroidManifest.xml
deleted file mode 100644
index 676b645..0000000
--- a/health/connect/connect-client/samples/src/main/AndroidManifest.xml
+++ /dev/null
@@ -1,17 +0,0 @@
-<!--
- Copyright 2022 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.
- -->
-
-<manifest />
\ No newline at end of file
diff --git a/heifwriter/heifwriter/src/main/AndroidManifest.xml b/heifwriter/heifwriter/src/main/AndroidManifest.xml
deleted file mode 100644
index dd3d3a3..0000000
--- a/heifwriter/heifwriter/src/main/AndroidManifest.xml
+++ /dev/null
@@ -1,16 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2018 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.
--->
-<manifest />
diff --git a/hilt/hilt-navigation-compose/samples/src/main/AndroidManifest.xml b/hilt/hilt-navigation-compose/samples/src/main/AndroidManifest.xml
deleted file mode 100644
index 20af317..0000000
--- a/hilt/hilt-navigation-compose/samples/src/main/AndroidManifest.xml
+++ /dev/null
@@ -1,17 +0,0 @@
-<!--
- Copyright 2021 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.
- -->
-
-<manifest />
diff --git a/hilt/hilt-navigation-compose/src/main/AndroidManifest.xml b/hilt/hilt-navigation-compose/src/main/AndroidManifest.xml
deleted file mode 100644
index 38e6839..0000000
--- a/hilt/hilt-navigation-compose/src/main/AndroidManifest.xml
+++ /dev/null
@@ -1,18 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
- ~ Copyright (C) 2021 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.
- -->
-
-<manifest />
diff --git a/hilt/hilt-navigation-fragment/src/main/AndroidManifest.xml b/hilt/hilt-navigation-fragment/src/main/AndroidManifest.xml
deleted file mode 100644
index 38e6839..0000000
--- a/hilt/hilt-navigation-fragment/src/main/AndroidManifest.xml
+++ /dev/null
@@ -1,18 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
- ~ Copyright (C) 2021 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.
- -->
-
-<manifest />
diff --git a/hilt/hilt-navigation/src/main/AndroidManifest.xml b/hilt/hilt-navigation/src/main/AndroidManifest.xml
deleted file mode 100644
index 38e6839..0000000
--- a/hilt/hilt-navigation/src/main/AndroidManifest.xml
+++ /dev/null
@@ -1,18 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
- ~ Copyright (C) 2021 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.
- -->
-
-<manifest />
diff --git a/input/input-motionprediction/src/main/AndroidManifest.xml b/input/input-motionprediction/src/main/AndroidManifest.xml
deleted file mode 100644
index e4e6dc1f..0000000
--- a/input/input-motionprediction/src/main/AndroidManifest.xml
+++ /dev/null
@@ -1,17 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright 2022 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.
--->
-
-<manifest />
\ No newline at end of file
diff --git a/inspection/inspection-testing/src/main/AndroidManifest.xml b/inspection/inspection-testing/src/main/AndroidManifest.xml
deleted file mode 100644
index 61b6811..0000000
--- a/inspection/inspection-testing/src/main/AndroidManifest.xml
+++ /dev/null
@@ -1,17 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
- Copyright 2019 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.
- -->
-<manifest />
diff --git a/inspection/inspection/src/main/AndroidManifest.xml b/inspection/inspection/src/main/AndroidManifest.xml
deleted file mode 100644
index 873a38a..0000000
--- a/inspection/inspection/src/main/AndroidManifest.xml
+++ /dev/null
@@ -1,16 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
- <!-- Copyright (C) 2014 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.
- -->
-<manifest />
diff --git a/interpolator/interpolator/src/main/AndroidManifest.xml b/interpolator/interpolator/src/main/AndroidManifest.xml
deleted file mode 100644
index 6f49e23..0000000
--- a/interpolator/interpolator/src/main/AndroidManifest.xml
+++ /dev/null
@@ -1,16 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2014 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.
--->
-<manifest />
diff --git a/javascriptengine/javascriptengine/src/androidTest/java/androidx/javascriptengine/WebViewJavaScriptSandboxTest.java b/javascriptengine/javascriptengine/src/androidTest/java/androidx/javascriptengine/WebViewJavaScriptSandboxTest.java
index 495d89f..1619734 100644
--- a/javascriptengine/javascriptengine/src/androidTest/java/androidx/javascriptengine/WebViewJavaScriptSandboxTest.java
+++ b/javascriptengine/javascriptengine/src/androidTest/java/androidx/javascriptengine/WebViewJavaScriptSandboxTest.java
@@ -33,6 +33,7 @@
import org.junit.Assert;
import org.junit.Assume;
import org.junit.Before;
+import org.junit.Ignore;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -208,6 +209,7 @@
@Test
@MediumTest
+ @Ignore("b/268212217")
public void testInfiniteLoop() throws Throwable {
final String code = "while(true){}";
Context context = ApplicationProvider.getApplicationContext();
@@ -236,6 +238,7 @@
@Test
@MediumTest
+ @Ignore("b/268212217")
public void testMultipleInfiniteLoops() throws Throwable {
final String code = "while(true){}";
final int num_of_evaluations = 10;
@@ -270,6 +273,7 @@
@Test
@MediumTest
+ @Ignore("b/268212217")
public void testSimpleArrayBuffer() throws Throwable {
final String provideString = "Hello World";
final byte[] bytes = provideString.getBytes(StandardCharsets.US_ASCII);
@@ -301,6 +305,7 @@
@Test
@MediumTest
+ @Ignore("b/268212217")
public void testArrayBufferWasmCompilation() throws Throwable {
final String success = "success";
// The bytes of a minimal WebAssembly module, courtesy of v8/test/cctest/test-api-wasm.cc
@@ -334,6 +339,7 @@
@Test
@MediumTest
+ @Ignore("b/268212217")
public void testPromiseReturn() throws Throwable {
final String code = "Promise.resolve(\"PASS\")";
final String expected = "PASS";
@@ -354,6 +360,7 @@
@Test
@MediumTest
+ @Ignore("b/268212217")
public void testPromiseReturnLaterResolve() throws Throwable {
final String code1 = "var promiseResolve, promiseReject;"
+ "new Promise(function(resolve, reject){"
@@ -381,6 +388,7 @@
@Test
@MediumTest
+ @Ignore("b/268212217")
public void testNestedConsumeNamedDataAsArrayBuffer() throws Throwable {
final String success = "success";
// The bytes of a minimal WebAssembly module, courtesy of v8/test/cctest/test-api-wasm.cc
@@ -424,6 +432,7 @@
@Test
@MediumTest
+ @Ignore("b/268212217")
public void testPromiseEvaluationThrow() throws Throwable {
final String provideString = "Hello World";
final byte[] bytes = provideString.getBytes(StandardCharsets.US_ASCII);
@@ -546,6 +555,7 @@
@Test
@MediumTest
+ @Ignore("b/268212217")
public void testHeapSizeAdjustment() throws Throwable {
final String code = "\"PASS\"";
final String expected = "PASS";
@@ -585,6 +595,7 @@
@Test
@LargeTest
+ @Ignore("b/268212217")
public void testHeapSizeEnforced() throws Throwable {
// WebView versions < 110.0.5438.0 do not contain OOM crashes to a single isolate and
// instead crash the whole sandbox process. This change is not tracked in a feature flag.
@@ -680,6 +691,7 @@
@Test
@LargeTest
+ @Ignore("b/268212217")
public void testIsolateCreationAfterCrash() throws Throwable {
// WebView versions < 110.0.5438.0 do not contain OOM crashes to a single isolate and
// instead crash the whole sandbox process. This change is not tracked in a feature flag.
@@ -759,6 +771,7 @@
@Test
@MediumTest
+ @Ignore("b/268212217")
public void testAsyncPromiseCallbacks() throws Throwable {
// Unlike testPromiseReturn and testPromiseEvaluationThrow, this test is guaranteed to
// exercise promises in an asynchronous way, rather than in ways which cause a promise to
@@ -827,6 +840,7 @@
@Test
@LargeTest
+ @Ignore("b/268212217")
public void testLargeScriptJsEvaluation() throws Throwable {
String longString = "a".repeat(2000000);
final String code = ""
@@ -851,6 +865,7 @@
@Test
@LargeTest
+ @Ignore("b/268212217")
public void testLargeScriptByteArrayJsEvaluation() throws Throwable {
final String longString = "a".repeat(2000000);
final String codeString = ""
@@ -876,6 +891,7 @@
@Test
@LargeTest
+ @Ignore("b/268212217")
public void testLargeReturn() throws Throwable {
final String longString = "a".repeat(2000000);
final String code = "'a'.repeat(2000000);";
@@ -898,6 +914,7 @@
@Test
@LargeTest
+ @Ignore("b/268212217")
public void testLargeError() throws Throwable {
final String longString = "a".repeat(2000000);
final String code = "throw \"" + longString + "\");";
@@ -924,6 +941,7 @@
@Test
@MediumTest
+ @Ignore("b/268212217")
public void testResultSizeEnforced() throws Throwable {
final int maxSize = 100;
Context context = ApplicationProvider.getApplicationContext();
@@ -974,6 +992,7 @@
@Test
@LargeTest
+ @Ignore("b/268212217")
public void testConsoleLogging() throws Throwable {
final class LoggingJavaScriptConsoleCallback implements JavaScriptConsoleCallback {
private final Object mLock = new Object();
@@ -1126,6 +1145,7 @@
@Test
@MediumTest
+ @Ignore("b/268212217")
public void testConsoleCallbackCanCallService() throws Throwable {
// This checks that there is nothing intrinsically wrong with calling service APIs from a
// console client. Note that, in theory, Binder will reuse the same threads if code recurses
diff --git a/javascriptengine/javascriptengine/src/main/AndroidManifest.xml b/javascriptengine/javascriptengine/src/main/AndroidManifest.xml
deleted file mode 100644
index 8e90956..0000000
--- a/javascriptengine/javascriptengine/src/main/AndroidManifest.xml
+++ /dev/null
@@ -1,17 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
- Copyright 2022 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.
- -->
-<manifest />
diff --git a/leanback/leanback-grid/src/main/AndroidManifest.xml b/leanback/leanback-grid/src/main/AndroidManifest.xml
deleted file mode 100644
index 3c3c224..0000000
--- a/leanback/leanback-grid/src/main/AndroidManifest.xml
+++ /dev/null
@@ -1,17 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
- Copyright 2021 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.
- -->
-<manifest />
diff --git a/leanback/leanback-paging/src/main/AndroidManifest.xml b/leanback/leanback-paging/src/main/AndroidManifest.xml
deleted file mode 100644
index 95dabe9..0000000
--- a/leanback/leanback-paging/src/main/AndroidManifest.xml
+++ /dev/null
@@ -1,17 +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.
- -->
-
-<manifest />
\ No newline at end of file
diff --git a/leanback/leanback-preference/src/main/AndroidManifest.xml b/leanback/leanback-preference/src/main/AndroidManifest.xml
deleted file mode 100644
index 107b553..0000000
--- a/leanback/leanback-preference/src/main/AndroidManifest.xml
+++ /dev/null
@@ -1,18 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
- ~ Copyright (C) 2015 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
- -->
-
-<manifest />
diff --git a/leanback/leanback-tab/src/main/AndroidManifest.xml b/leanback/leanback-tab/src/main/AndroidManifest.xml
deleted file mode 100644
index a297096..0000000
--- a/leanback/leanback-tab/src/main/AndroidManifest.xml
+++ /dev/null
@@ -1,16 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 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.
--->
-<manifest />
\ No newline at end of file
diff --git a/leanback/leanback/src/androidTest/java/androidx/leanback/app/BrowseFragmentTest.java b/leanback/leanback/src/androidTest/java/androidx/leanback/app/BrowseFragmentTest.java
index 02e6d11..50f2fee 100644
--- a/leanback/leanback/src/androidTest/java/androidx/leanback/app/BrowseFragmentTest.java
+++ b/leanback/leanback/src/androidTest/java/androidx/leanback/app/BrowseFragmentTest.java
@@ -59,6 +59,7 @@
import androidx.test.rule.ActivityTestRule;
import org.junit.After;
+import org.junit.Ignore;
import org.junit.Rule;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -190,6 +191,7 @@
}
@Test
+ @Ignore("b/281082608")
public void testPressRightBeforeMainFragmentCreated() throws Throwable {
final long dataLoadingDelay = 1000;
Intent intent = new Intent();
diff --git a/leanback/leanback/src/androidTest/java/androidx/leanback/app/SearchFragmentTest.java b/leanback/leanback/src/androidTest/java/androidx/leanback/app/SearchFragmentTest.java
index cd4bca8..897d008 100644
--- a/leanback/leanback/src/androidTest/java/androidx/leanback/app/SearchFragmentTest.java
+++ b/leanback/leanback/src/androidTest/java/androidx/leanback/app/SearchFragmentTest.java
@@ -30,6 +30,7 @@
import android.view.ViewGroup;
import android.view.inputmethod.InputMethodManager;
import android.widget.EditText;
+import org.junit.Ignore;
import android.app.Fragment;
import androidx.leanback.test.R;
@@ -190,6 +191,7 @@
}
@Test
+ @Ignore("b/281082608")
public void testFocusWithSpeechRecognizerEnabled() throws Exception {
// Skip the test for devices which do not have SpeechRecognizer
diff --git a/leanback/leanback/src/androidTest/java/androidx/leanback/app/SearchSupportFragmentTest.java b/leanback/leanback/src/androidTest/java/androidx/leanback/app/SearchSupportFragmentTest.java
index 804ffa3..32d6e59 100644
--- a/leanback/leanback/src/androidTest/java/androidx/leanback/app/SearchSupportFragmentTest.java
+++ b/leanback/leanback/src/androidTest/java/androidx/leanback/app/SearchSupportFragmentTest.java
@@ -27,6 +27,7 @@
import android.view.ViewGroup;
import android.view.inputmethod.InputMethodManager;
import android.widget.EditText;
+import org.junit.Ignore;
import androidx.fragment.app.Fragment;
import androidx.leanback.test.R;
@@ -187,6 +188,7 @@
}
@Test
+ @Ignore("b/281082608")
public void testFocusWithSpeechRecognizerEnabled() throws Exception {
// Skip the test for devices which do not have SpeechRecognizer
diff --git a/leanback/leanback/src/main/AndroidManifest.xml b/leanback/leanback/src/main/AndroidManifest.xml
deleted file mode 100644
index 6f49e23..0000000
--- a/leanback/leanback/src/main/AndroidManifest.xml
+++ /dev/null
@@ -1,16 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2014 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.
--->
-<manifest />
diff --git a/lifecycle/lifecycle-livedata-core-ktx/src/main/AndroidManifest.xml b/lifecycle/lifecycle-livedata-core-ktx/src/main/AndroidManifest.xml
deleted file mode 100644
index 7535bfb..0000000
--- a/lifecycle/lifecycle-livedata-core-ktx/src/main/AndroidManifest.xml
+++ /dev/null
@@ -1,17 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
- ~ Copyright 2018 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.
- -->
-<manifest />
diff --git a/lifecycle/lifecycle-livedata-core-truth/src/main/AndroidManifest.xml b/lifecycle/lifecycle-livedata-core-truth/src/main/AndroidManifest.xml
deleted file mode 100644
index 7535bfb..0000000
--- a/lifecycle/lifecycle-livedata-core-truth/src/main/AndroidManifest.xml
+++ /dev/null
@@ -1,17 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
- ~ Copyright 2018 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.
- -->
-<manifest />
diff --git a/lifecycle/lifecycle-livedata-ktx/src/main/AndroidManifest.xml b/lifecycle/lifecycle-livedata-ktx/src/main/AndroidManifest.xml
deleted file mode 100644
index 7535bfb..0000000
--- a/lifecycle/lifecycle-livedata-ktx/src/main/AndroidManifest.xml
+++ /dev/null
@@ -1,17 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
- ~ Copyright 2018 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.
- -->
-<manifest />
diff --git a/lifecycle/lifecycle-reactivestreams-ktx/src/main/AndroidManifest.xml b/lifecycle/lifecycle-reactivestreams-ktx/src/main/AndroidManifest.xml
deleted file mode 100644
index 29b496b..0000000
--- a/lifecycle/lifecycle-reactivestreams-ktx/src/main/AndroidManifest.xml
+++ /dev/null
@@ -1,17 +0,0 @@
-<!--
- ~ Copyright (C) 2018 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.
- -->
-
-<manifest />
diff --git a/lifecycle/lifecycle-service/src/main/AndroidManifest.xml b/lifecycle/lifecycle-service/src/main/AndroidManifest.xml
deleted file mode 100644
index 1f3367f..0000000
--- a/lifecycle/lifecycle-service/src/main/AndroidManifest.xml
+++ /dev/null
@@ -1,17 +0,0 @@
-<!--
- ~ Copyright (C) 2016 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.
- -->
-
-<manifest />
diff --git a/lifecycle/lifecycle-viewmodel-compose/integration-tests/lifecycle-viewmodel-demos/src/main/AndroidManifest.xml b/lifecycle/lifecycle-viewmodel-compose/integration-tests/lifecycle-viewmodel-demos/src/main/AndroidManifest.xml
deleted file mode 100644
index 20af317..0000000
--- a/lifecycle/lifecycle-viewmodel-compose/integration-tests/lifecycle-viewmodel-demos/src/main/AndroidManifest.xml
+++ /dev/null
@@ -1,17 +0,0 @@
-<!--
- Copyright 2021 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.
- -->
-
-<manifest />
diff --git a/lifecycle/lifecycle-viewmodel-compose/samples/src/main/AndroidManifest.xml b/lifecycle/lifecycle-viewmodel-compose/samples/src/main/AndroidManifest.xml
deleted file mode 100644
index 20af317..0000000
--- a/lifecycle/lifecycle-viewmodel-compose/samples/src/main/AndroidManifest.xml
+++ /dev/null
@@ -1,17 +0,0 @@
-<!--
- Copyright 2021 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.
- -->
-
-<manifest />
diff --git a/lifecycle/lifecycle-viewmodel-compose/src/main/AndroidManifest.xml b/lifecycle/lifecycle-viewmodel-compose/src/main/AndroidManifest.xml
deleted file mode 100644
index 3c3c224..0000000
--- a/lifecycle/lifecycle-viewmodel-compose/src/main/AndroidManifest.xml
+++ /dev/null
@@ -1,17 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
- Copyright 2021 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.
- -->
-<manifest />
diff --git a/lifecycle/lifecycle-viewmodel-ktx/src/main/AndroidManifest.xml b/lifecycle/lifecycle-viewmodel-ktx/src/main/AndroidManifest.xml
deleted file mode 100644
index dd3d3a3..0000000
--- a/lifecycle/lifecycle-viewmodel-ktx/src/main/AndroidManifest.xml
+++ /dev/null
@@ -1,16 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2018 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.
--->
-<manifest />
diff --git a/loader/loader-ktx/src/main/AndroidManifest.xml b/loader/loader-ktx/src/main/AndroidManifest.xml
deleted file mode 100644
index b47339d..0000000
--- a/loader/loader-ktx/src/main/AndroidManifest.xml
+++ /dev/null
@@ -1,16 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2019 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.
--->
-<manifest />
diff --git a/loader/loader/src/main/AndroidManifest.xml b/loader/loader/src/main/AndroidManifest.xml
deleted file mode 100644
index 6f49e23..0000000
--- a/loader/loader/src/main/AndroidManifest.xml
+++ /dev/null
@@ -1,16 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2014 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.
--->
-<manifest />
diff --git a/media/media/src/main/AndroidManifest.xml b/media/media/src/main/AndroidManifest.xml
deleted file mode 100644
index 6f49e23..0000000
--- a/media/media/src/main/AndroidManifest.xml
+++ /dev/null
@@ -1,16 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2014 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.
--->
-<manifest />
diff --git a/media2/media2-common/src/main/AndroidManifest.xml b/media2/media2-common/src/main/AndroidManifest.xml
deleted file mode 100644
index dd3d3a3..0000000
--- a/media2/media2-common/src/main/AndroidManifest.xml
+++ /dev/null
@@ -1,16 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2018 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.
--->
-<manifest />
diff --git a/media2/media2-exoplayer/src/main/AndroidManifest.xml b/media2/media2-exoplayer/src/main/AndroidManifest.xml
deleted file mode 100644
index dd3d3a3..0000000
--- a/media2/media2-exoplayer/src/main/AndroidManifest.xml
+++ /dev/null
@@ -1,16 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2018 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.
--->
-<manifest />
diff --git a/media2/media2-player/src/main/AndroidManifest.xml b/media2/media2-player/src/main/AndroidManifest.xml
deleted file mode 100644
index dd3d3a3..0000000
--- a/media2/media2-player/src/main/AndroidManifest.xml
+++ /dev/null
@@ -1,16 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2018 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.
--->
-<manifest />
diff --git a/media2/media2-session/src/main/AndroidManifest.xml b/media2/media2-session/src/main/AndroidManifest.xml
deleted file mode 100644
index dd3d3a3..0000000
--- a/media2/media2-session/src/main/AndroidManifest.xml
+++ /dev/null
@@ -1,16 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2018 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.
--->
-<manifest />
diff --git a/media2/media2-widget/src/main/AndroidManifest.xml b/media2/media2-widget/src/main/AndroidManifest.xml
deleted file mode 100644
index 7535bfb..0000000
--- a/media2/media2-widget/src/main/AndroidManifest.xml
+++ /dev/null
@@ -1,17 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
- ~ Copyright 2018 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.
- -->
-<manifest />
diff --git a/mediarouter/mediarouter-testing/src/main/AndroidManifest.xml b/mediarouter/mediarouter-testing/src/main/AndroidManifest.xml
deleted file mode 100644
index 3c3c224..0000000
--- a/mediarouter/mediarouter-testing/src/main/AndroidManifest.xml
+++ /dev/null
@@ -1,17 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
- Copyright 2021 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.
- -->
-<manifest />
diff --git a/mediarouter/mediarouter/src/main/AndroidManifest.xml b/mediarouter/mediarouter/src/main/AndroidManifest.xml
deleted file mode 100644
index bd7af07..0000000
--- a/mediarouter/mediarouter/src/main/AndroidManifest.xml
+++ /dev/null
@@ -1,16 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2013 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.
--->
-<manifest />
diff --git a/metrics/metrics-benchmark/src/main/AndroidManifest.xml b/metrics/metrics-benchmark/src/main/AndroidManifest.xml
deleted file mode 100644
index 29b496b..0000000
--- a/metrics/metrics-benchmark/src/main/AndroidManifest.xml
+++ /dev/null
@@ -1,17 +0,0 @@
-<!--
- ~ Copyright (C) 2018 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.
- -->
-
-<manifest />
diff --git a/metrics/metrics-performance/src/main/AndroidManifest.xml b/metrics/metrics-performance/src/main/AndroidManifest.xml
deleted file mode 100644
index 6a68baf..0000000
--- a/metrics/metrics-performance/src/main/AndroidManifest.xml
+++ /dev/null
@@ -1,16 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2021 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.
--->
-<manifest />
diff --git a/navigation/navigation-common-ktx/src/main/AndroidManifest.xml b/navigation/navigation-common-ktx/src/main/AndroidManifest.xml
deleted file mode 100644
index fdfdce5..0000000
--- a/navigation/navigation-common-ktx/src/main/AndroidManifest.xml
+++ /dev/null
@@ -1,17 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
- ~ Copyright (C) 2018 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.
- -->
-<manifest />
diff --git a/navigation/navigation-compose/integration-tests/navigation-demos/src/main/AndroidManifest.xml b/navigation/navigation-compose/integration-tests/navigation-demos/src/main/AndroidManifest.xml
deleted file mode 100644
index deac81d..0000000
--- a/navigation/navigation-compose/integration-tests/navigation-demos/src/main/AndroidManifest.xml
+++ /dev/null
@@ -1,17 +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.
- -->
-
-<manifest />
diff --git a/navigation/navigation-compose/samples/src/main/AndroidManifest.xml b/navigation/navigation-compose/samples/src/main/AndroidManifest.xml
deleted file mode 100644
index deac81d..0000000
--- a/navigation/navigation-compose/samples/src/main/AndroidManifest.xml
+++ /dev/null
@@ -1,17 +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.
- -->
-
-<manifest />
diff --git a/navigation/navigation-compose/src/androidTest/AndroidManifest.xml b/navigation/navigation-compose/src/androidTest/AndroidManifest.xml
deleted file mode 100644
index 9cd4123..0000000
--- a/navigation/navigation-compose/src/androidTest/AndroidManifest.xml
+++ /dev/null
@@ -1,17 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
- 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.
- -->
-<manifest />
diff --git a/navigation/navigation-compose/src/main/AndroidManifest.xml b/navigation/navigation-compose/src/main/AndroidManifest.xml
deleted file mode 100644
index 9cd4123..0000000
--- a/navigation/navigation-compose/src/main/AndroidManifest.xml
+++ /dev/null
@@ -1,17 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
- 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.
- -->
-<manifest />
diff --git a/navigation/navigation-fragment-ktx/src/androidTest/AndroidManifest.xml b/navigation/navigation-fragment-ktx/src/androidTest/AndroidManifest.xml
deleted file mode 100644
index 8358852..0000000
--- a/navigation/navigation-fragment-ktx/src/androidTest/AndroidManifest.xml
+++ /dev/null
@@ -1,18 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
- ~ Copyright (C) 2017 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.
- -->
-
-<manifest />
diff --git a/navigation/navigation-fragment-ktx/src/main/AndroidManifest.xml b/navigation/navigation-fragment-ktx/src/main/AndroidManifest.xml
deleted file mode 100644
index 0e03c43..0000000
--- a/navigation/navigation-fragment-ktx/src/main/AndroidManifest.xml
+++ /dev/null
@@ -1,18 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
- ~ Copyright (C) 2018 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.
- -->
-
-<manifest />
diff --git a/navigation/navigation-runtime-ktx/src/androidTest/AndroidManifest.xml b/navigation/navigation-runtime-ktx/src/androidTest/AndroidManifest.xml
deleted file mode 100644
index 8358852..0000000
--- a/navigation/navigation-runtime-ktx/src/androidTest/AndroidManifest.xml
+++ /dev/null
@@ -1,18 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
- ~ Copyright (C) 2017 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.
- -->
-
-<manifest />
diff --git a/navigation/navigation-runtime-ktx/src/main/AndroidManifest.xml b/navigation/navigation-runtime-ktx/src/main/AndroidManifest.xml
deleted file mode 100644
index fdfdce5..0000000
--- a/navigation/navigation-runtime-ktx/src/main/AndroidManifest.xml
+++ /dev/null
@@ -1,17 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
- ~ Copyright (C) 2018 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.
- -->
-<manifest />
diff --git a/navigation/navigation-runtime-truth/src/main/AndroidManifest.xml b/navigation/navigation-runtime-truth/src/main/AndroidManifest.xml
deleted file mode 100644
index fdfdce5..0000000
--- a/navigation/navigation-runtime-truth/src/main/AndroidManifest.xml
+++ /dev/null
@@ -1,17 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
- ~ Copyright (C) 2018 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.
- -->
-<manifest />
diff --git a/navigation/navigation-ui-ktx/src/main/AndroidManifest.xml b/navigation/navigation-ui-ktx/src/main/AndroidManifest.xml
deleted file mode 100644
index fdfdce5..0000000
--- a/navigation/navigation-ui-ktx/src/main/AndroidManifest.xml
+++ /dev/null
@@ -1,17 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
- ~ Copyright (C) 2018 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.
- -->
-<manifest />
diff --git a/paging/integration-tests/testapp/src/androidTest/kotlin/androidx/paging/integration/testapp/v3/OnPagesUpdatedTest.kt b/paging/integration-tests/testapp/src/androidTest/kotlin/androidx/paging/integration/testapp/v3/OnPagesUpdatedTest.kt
index a615eb5..fe5a24b 100644
--- a/paging/integration-tests/testapp/src/androidTest/kotlin/androidx/paging/integration/testapp/v3/OnPagesUpdatedTest.kt
+++ b/paging/integration-tests/testapp/src/androidTest/kotlin/androidx/paging/integration/testapp/v3/OnPagesUpdatedTest.kt
@@ -36,6 +36,7 @@
import kotlinx.coroutines.launch
import kotlinx.coroutines.runBlocking
import kotlinx.coroutines.withTimeout
+import org.junit.Ignore
import org.junit.Rule
import org.junit.Test
import org.junit.runner.RunWith
@@ -50,6 +51,7 @@
@OptIn(ExperimentalCoroutinesApi::class)
@Test
+ @Ignore("b/278918559")
fun onPagesUpdatedFlow() = runBlocking {
val scenario = scenarioRule.scenario
diff --git a/paging/paging-compose/integration-tests/paging-demos/src/main/AndroidManifest.xml b/paging/paging-compose/integration-tests/paging-demos/src/main/AndroidManifest.xml
deleted file mode 100644
index deac81d..0000000
--- a/paging/paging-compose/integration-tests/paging-demos/src/main/AndroidManifest.xml
+++ /dev/null
@@ -1,17 +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.
- -->
-
-<manifest />
diff --git a/paging/paging-compose/integration-tests/paging-demos/src/main/java/androidx/paging/compose/demos/room/PagingRoomSample.kt b/paging/paging-compose/integration-tests/paging-demos/src/main/java/androidx/paging/compose/demos/room/PagingRoomSample.kt
index e16c7b7..cdcd575 100644
--- a/paging/paging-compose/integration-tests/paging-demos/src/main/java/androidx/paging/compose/demos/room/PagingRoomSample.kt
+++ b/paging/paging-compose/integration-tests/paging-demos/src/main/java/androidx/paging/compose/demos/room/PagingRoomSample.kt
@@ -23,7 +23,7 @@
import androidx.compose.material.Text
import androidx.compose.runtime.Composable
import androidx.compose.runtime.getValue
-import androidx.compose.runtime.mutableStateOf
+import androidx.compose.runtime.mutableIntStateOf
import androidx.compose.runtime.remember
import androidx.compose.runtime.rememberCoroutineScope
import androidx.compose.runtime.saveable.rememberSaveable
@@ -118,7 +118,7 @@
key = lazyPagingItems.itemKey { user -> user.id },
) { index ->
val user = lazyPagingItems[index]
- var counter by rememberSaveable { mutableStateOf(0) }
+ var counter by rememberSaveable { mutableIntStateOf(0) }
Text(
text = "counter=$counter index=$index ${user?.name} ${user?.id}",
fontSize = 50.sp,
diff --git a/paging/paging-compose/samples/src/main/AndroidManifest.xml b/paging/paging-compose/samples/src/main/AndroidManifest.xml
deleted file mode 100644
index deac81d..0000000
--- a/paging/paging-compose/samples/src/main/AndroidManifest.xml
+++ /dev/null
@@ -1,17 +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.
- -->
-
-<manifest />
diff --git a/paging/paging-compose/src/androidTest/AndroidManifest.xml b/paging/paging-compose/src/androidTest/AndroidManifest.xml
deleted file mode 100644
index 9cd4123..0000000
--- a/paging/paging-compose/src/androidTest/AndroidManifest.xml
+++ /dev/null
@@ -1,17 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
- 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.
- -->
-<manifest />
diff --git a/paging/paging-compose/src/main/AndroidManifest.xml b/paging/paging-compose/src/main/AndroidManifest.xml
deleted file mode 100644
index 9cd4123..0000000
--- a/paging/paging-compose/src/main/AndroidManifest.xml
+++ /dev/null
@@ -1,17 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
- 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.
- -->
-<manifest />
diff --git a/paging/paging-runtime-ktx/src/main/AndroidManifest.xml b/paging/paging-runtime-ktx/src/main/AndroidManifest.xml
deleted file mode 100644
index 61b6811..0000000
--- a/paging/paging-runtime-ktx/src/main/AndroidManifest.xml
+++ /dev/null
@@ -1,17 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
- Copyright 2019 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.
- -->
-<manifest />
diff --git a/paging/paging-runtime/src/main/AndroidManifest.xml b/paging/paging-runtime/src/main/AndroidManifest.xml
deleted file mode 100644
index 7b5bc6e..0000000
--- a/paging/paging-runtime/src/main/AndroidManifest.xml
+++ /dev/null
@@ -1,16 +0,0 @@
-<!--
- ~ Copyright (C) 2017 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.
- -->
-<manifest />
diff --git a/paging/paging-rxjava2-ktx/src/main/AndroidManifest.xml b/paging/paging-rxjava2-ktx/src/main/AndroidManifest.xml
deleted file mode 100644
index dd3d3a3..0000000
--- a/paging/paging-rxjava2-ktx/src/main/AndroidManifest.xml
+++ /dev/null
@@ -1,16 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2018 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.
--->
-<manifest />
diff --git a/paging/paging-rxjava2/src/androidTest/AndroidManifest.xml b/paging/paging-rxjava2/src/androidTest/AndroidManifest.xml
deleted file mode 100644
index 61b6811..0000000
--- a/paging/paging-rxjava2/src/androidTest/AndroidManifest.xml
+++ /dev/null
@@ -1,17 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
- Copyright 2019 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.
- -->
-<manifest />
diff --git a/paging/paging-rxjava3/src/androidTest/AndroidManifest.xml b/paging/paging-rxjava3/src/androidTest/AndroidManifest.xml
deleted file mode 100644
index 3c3c224..0000000
--- a/paging/paging-rxjava3/src/androidTest/AndroidManifest.xml
+++ /dev/null
@@ -1,17 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
- Copyright 2021 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.
- -->
-<manifest />
diff --git a/palette/palette-ktx/src/main/AndroidManifest.xml b/palette/palette-ktx/src/main/AndroidManifest.xml
deleted file mode 100644
index 7535bfb..0000000
--- a/palette/palette-ktx/src/main/AndroidManifest.xml
+++ /dev/null
@@ -1,17 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
- ~ Copyright 2018 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.
- -->
-<manifest />
diff --git a/palette/palette/src/main/AndroidManifest.xml b/palette/palette/src/main/AndroidManifest.xml
deleted file mode 100644
index 6f49e23..0000000
--- a/palette/palette/src/main/AndroidManifest.xml
+++ /dev/null
@@ -1,16 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2014 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.
--->
-<manifest />
diff --git a/percentlayout/percentlayout/src/main/AndroidManifest.xml b/percentlayout/percentlayout/src/main/AndroidManifest.xml
deleted file mode 100644
index 5197378..0000000
--- a/percentlayout/percentlayout/src/main/AndroidManifest.xml
+++ /dev/null
@@ -1,16 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2015 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.
--->
-<manifest />
diff --git a/playground-common/playground.properties b/playground-common/playground.properties
index fec6fdf..68b1459 100644
--- a/playground-common/playground.properties
+++ b/playground-common/playground.properties
@@ -26,5 +26,5 @@
# Disable docs
androidx.enableDocumentation=false
androidx.playground.snapshotBuildId=10041883
-androidx.playground.metalavaBuildId=10009114
+androidx.playground.metalavaBuildId=10074764
androidx.studio.type=playground
diff --git a/preference/preference-ktx/src/main/AndroidManifest.xml b/preference/preference-ktx/src/main/AndroidManifest.xml
deleted file mode 100644
index 7535bfb..0000000
--- a/preference/preference-ktx/src/main/AndroidManifest.xml
+++ /dev/null
@@ -1,17 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
- ~ Copyright 2018 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.
- -->
-<manifest />
diff --git a/preference/preference/src/main/AndroidManifest.xml b/preference/preference/src/main/AndroidManifest.xml
deleted file mode 100644
index 5197378..0000000
--- a/preference/preference/src/main/AndroidManifest.xml
+++ /dev/null
@@ -1,16 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2015 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.
--->
-<manifest />
diff --git a/print/print/src/main/AndroidManifest.xml b/print/print/src/main/AndroidManifest.xml
deleted file mode 100644
index 6f49e23..0000000
--- a/print/print/src/main/AndroidManifest.xml
+++ /dev/null
@@ -1,16 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2014 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.
--->
-<manifest />
diff --git a/privacysandbox/ui/ui-client/src/androidTest/java/androidx/privacysandbox/ui/client/test/SandboxedSdkViewTest.kt b/privacysandbox/ui/ui-client/src/androidTest/java/androidx/privacysandbox/ui/client/test/SandboxedSdkViewTest.kt
index 84d3466..68778460 100644
--- a/privacysandbox/ui/ui-client/src/androidTest/java/androidx/privacysandbox/ui/client/test/SandboxedSdkViewTest.kt
+++ b/privacysandbox/ui/ui-client/src/androidTest/java/androidx/privacysandbox/ui/client/test/SandboxedSdkViewTest.kt
@@ -43,6 +43,7 @@
import org.junit.Assert.assertTrue
import org.junit.Assume
import org.junit.Before
+import org.junit.Ignore
import org.junit.Rule
import org.junit.Test
import org.junit.runner.RunWith
@@ -277,6 +278,7 @@
}
@Test
+ @Ignore("b/272324246")
fun onConfigurationChangedTest() {
val layout = activity.findViewById<LinearLayout>(R.id.mainlayout)
diff --git a/privacysandbox/ui/ui-tests/src/androidTest/java/androidx/privacysandbox/ui/tests/endtoend/IntegrationTests.kt b/privacysandbox/ui/ui-tests/src/androidTest/java/androidx/privacysandbox/ui/tests/endtoend/IntegrationTests.kt
index 5084dc1..a2ea2da 100644
--- a/privacysandbox/ui/ui-tests/src/androidTest/java/androidx/privacysandbox/ui/tests/endtoend/IntegrationTests.kt
+++ b/privacysandbox/ui/ui-tests/src/androidTest/java/androidx/privacysandbox/ui/tests/endtoend/IntegrationTests.kt
@@ -182,6 +182,7 @@
}
@Test
+ @Ignore("b/272324246")
fun testConfigurationChanged() {
val configChangedLatch = CountDownLatch(1)
val adapter = TestSandboxedUiAdapter(
diff --git a/profileinstaller/integration-tests/init-macrobenchmark/src/androidTest/AndroidManifest.xml b/profileinstaller/integration-tests/init-macrobenchmark/src/androidTest/AndroidManifest.xml
deleted file mode 100644
index 5b41847..0000000
--- a/profileinstaller/integration-tests/init-macrobenchmark/src/androidTest/AndroidManifest.xml
+++ /dev/null
@@ -1,17 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
- ~ Copyright (C) 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.
- -->
-<manifest />
diff --git a/profileinstaller/integration-tests/init-macrobenchmark/src/main/AndroidManifest.xml b/profileinstaller/integration-tests/init-macrobenchmark/src/main/AndroidManifest.xml
deleted file mode 100644
index ed173d5..0000000
--- a/profileinstaller/integration-tests/init-macrobenchmark/src/main/AndroidManifest.xml
+++ /dev/null
@@ -1,16 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?><!--
- ~ Copyright (C) 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.
- -->
-<manifest />
diff --git a/profileinstaller/integration-tests/profile-verification/src/androidTest/AndroidManifest.xml b/profileinstaller/integration-tests/profile-verification/src/androidTest/AndroidManifest.xml
deleted file mode 100644
index bae036b..0000000
--- a/profileinstaller/integration-tests/profile-verification/src/androidTest/AndroidManifest.xml
+++ /dev/null
@@ -1,17 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
- ~ Copyright (C) 2022 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.
- -->
-<manifest />
diff --git a/profileinstaller/integration-tests/profile-verification/src/main/AndroidManifest.xml b/profileinstaller/integration-tests/profile-verification/src/main/AndroidManifest.xml
deleted file mode 100644
index d4c1970..0000000
--- a/profileinstaller/integration-tests/profile-verification/src/main/AndroidManifest.xml
+++ /dev/null
@@ -1,16 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?><!--
- ~ Copyright (C) 2022 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.
- -->
-<manifest />
diff --git a/profileinstaller/profileinstaller-benchmark/src/main/AndroidManifest.xml b/profileinstaller/profileinstaller-benchmark/src/main/AndroidManifest.xml
deleted file mode 100644
index 29b496b..0000000
--- a/profileinstaller/profileinstaller-benchmark/src/main/AndroidManifest.xml
+++ /dev/null
@@ -1,17 +0,0 @@
-<!--
- ~ Copyright (C) 2018 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.
- -->
-
-<manifest />
diff --git a/recommendation/recommendation/src/main/AndroidManifest.xml b/recommendation/recommendation/src/main/AndroidManifest.xml
deleted file mode 100644
index 6f49e23..0000000
--- a/recommendation/recommendation/src/main/AndroidManifest.xml
+++ /dev/null
@@ -1,16 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2014 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.
--->
-<manifest />
diff --git a/recyclerview/recyclerview-selection/src/main/AndroidManifest.xml b/recyclerview/recyclerview-selection/src/main/AndroidManifest.xml
deleted file mode 100644
index 8162281..0000000
--- a/recyclerview/recyclerview-selection/src/main/AndroidManifest.xml
+++ /dev/null
@@ -1,16 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright 2017 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.
--->
-<manifest />
diff --git a/recyclerview/recyclerview/src/androidTest/java/androidx/recyclerview/widget/StaggeredGridLayoutManagerCacheTest.java b/recyclerview/recyclerview/src/androidTest/java/androidx/recyclerview/widget/StaggeredGridLayoutManagerCacheTest.java
index dd7781b..e5076f6 100644
--- a/recyclerview/recyclerview/src/androidTest/java/androidx/recyclerview/widget/StaggeredGridLayoutManagerCacheTest.java
+++ b/recyclerview/recyclerview/src/androidTest/java/androidx/recyclerview/widget/StaggeredGridLayoutManagerCacheTest.java
@@ -23,6 +23,7 @@
import static org.junit.Assert.assertTrue;
import android.os.Build;
+import androidx.test.filters.FlakyTest;
import androidx.test.filters.MediumTest;
import androidx.test.filters.SdkSuppress;
@@ -92,6 +93,7 @@
@MediumTest
@Test
+ @FlakyTest(bugId = 281085288)
public void cacheAndPrefetch() throws Throwable {
final Config config = (Config) mConfig.clone();
setupByConfig(config);
diff --git a/recyclerview/recyclerview/src/main/AndroidManifest.xml b/recyclerview/recyclerview/src/main/AndroidManifest.xml
deleted file mode 100644
index 3c8a63b..0000000
--- a/recyclerview/recyclerview/src/main/AndroidManifest.xml
+++ /dev/null
@@ -1,16 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2013 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.
--->
-<manifest />
\ No newline at end of file
diff --git a/room/integration-tests/incremental-annotation-processing/src/test/test-data/simple-project/src/main/AndroidManifest.xml b/room/integration-tests/incremental-annotation-processing/src/test/test-data/simple-project/src/main/AndroidManifest.xml
deleted file mode 100644
index 809c0d9..0000000
--- a/room/integration-tests/incremental-annotation-processing/src/test/test-data/simple-project/src/main/AndroidManifest.xml
+++ /dev/null
@@ -1,17 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
- Copyright 2019 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.
- -->
-<manifest/>
\ No newline at end of file
diff --git a/room/room-common/src/main/java/androidx/room/Delete.kt b/room/room-common/src/main/java/androidx/room/Delete.kt
index 176fd26..fbae415 100644
--- a/room/room-common/src/main/java/androidx/room/Delete.kt
+++ b/room/room-common/src/main/java/androidx/room/Delete.kt
@@ -34,7 +34,7 @@
* public fun deleteSongs(vararg songs: Song)
*
* @Delete
- * public fun deleteAlbumAndSongs(val album: Album, val songs: List<Song>)
+ * public fun deleteAlbumAndSongs(album: Album, songs: List<Song>)
* }
* ```
*
diff --git a/room/room-compiler-processing/src/main/java/androidx/room/compiler/processing/ksp/KSTypeExt.kt b/room/room-compiler-processing/src/main/java/androidx/room/compiler/processing/ksp/KSTypeExt.kt
index 213eeb9..1b31225 100644
--- a/room/room-compiler-processing/src/main/java/androidx/room/compiler/processing/ksp/KSTypeExt.kt
+++ b/room/room-compiler-processing/src/main/java/androidx/room/compiler/processing/ksp/KSTypeExt.kt
@@ -89,16 +89,7 @@
.newInstance(this)
}
fun hasAnnotationViaReflection(qName: String): Boolean {
- val ksType = if (
- // Note: Technically, we could just make KSTypeWrapper internal and cast to get the
- // delegate, but since we need to use reflection anyway, just get it via reflection.
- this.javaClass.canonicalName == "androidx.room.compiler.processing.ksp.KSTypeWrapper") {
- this.javaClass.methods.find { it.name == "getDelegate" }?.invoke(this)
- } else {
- this
- }
- val kotlinType =
- ksType?.javaClass?.methods?.find { it.name == "getKotlinType" }?.invoke(ksType)
+ val kotlinType = javaClass.methods.find { it.name == "getKotlinType" }?.invoke(this)
val kotlinAnnotations =
kotlinType?.javaClass
?.methods
diff --git a/room/room-compiler-processing/src/main/java/androidx/room/compiler/processing/ksp/KSTypeJavaPoetExt.kt b/room/room-compiler-processing/src/main/java/androidx/room/compiler/processing/ksp/KSTypeJavaPoetExt.kt
index 6150713..a40fe41 100644
--- a/room/room-compiler-processing/src/main/java/androidx/room/compiler/processing/ksp/KSTypeJavaPoetExt.kt
+++ b/room/room-compiler-processing/src/main/java/androidx/room/compiler/processing/ksp/KSTypeJavaPoetExt.kt
@@ -35,7 +35,6 @@
import com.squareup.kotlinpoet.javapoet.JTypeName
import com.squareup.kotlinpoet.javapoet.JTypeVariableName
import com.squareup.kotlinpoet.javapoet.JWildcardTypeName
-import kotlin.coroutines.Continuation
// Catch-all type name when we cannot resolve to anything. This is what KAPT uses as error type
// and we use the same type in KSP for consistency.
@@ -150,16 +149,8 @@
return when (variance) {
Variance.CONTRAVARIANT -> JWildcardTypeName.supertypeOf(resolveTypeName())
Variance.COVARIANT -> JWildcardTypeName.subtypeOf(resolveTypeName())
- Variance.STAR -> {
- JWildcardTypeName.subtypeOf(JTypeName.OBJECT)
- }
- else -> {
- if (hasJvmWildcardAnnotation()) {
- JWildcardTypeName.subtypeOf(resolveTypeName())
- } else {
- resolveTypeName()
- }
- }
+ Variance.STAR -> JWildcardTypeName.subtypeOf(JTypeName.OBJECT)
+ else -> resolveTypeName()
}
}
@@ -179,28 +170,13 @@
): JTypeName {
return if (this.arguments.isNotEmpty() && !resolver.isJavaRawType(this)) {
val args: Array<JTypeName> = this.arguments
- .map { typeArg ->
- typeArg.asJTypeName(
- resolver = resolver,
- typeArgumentTypeLookup = typeArgumentTypeLookup
- )
- }
+ .map { typeArg -> typeArg.asJTypeName(resolver, typeArgumentTypeLookup) }
.map { it.tryBox() }
- .let { args ->
- if (this.isSuspendFunctionType) args.convertToSuspendSignature()
- else args
- }
.toTypedArray()
- when (
- val typeName = declaration
- .asJTypeName(resolver, typeArgumentTypeLookup).tryBox()
- ) {
+ when (val typeName = declaration.asJTypeName(resolver, typeArgumentTypeLookup).tryBox()) {
is JArrayTypeName -> JArrayTypeName.of(args.single())
- is JClassName -> JParameterizedTypeName.get(
- typeName,
- *args
- )
+ is JClassName -> JParameterizedTypeName.get(typeName, *args)
else -> error("Unexpected type name for KSType: $typeName")
}
} else {
@@ -209,29 +185,6 @@
}
/**
- * Transforms [this] list of arguments to a suspend signature. For a [suspend] functional type, we
- * need to transform it to be a FunctionX with a [Continuation] with the correct return type. A
- * transformed SuspendFunction looks like this:
- *
- * FunctionX<[? super $params], ? super Continuation<? super $ReturnType>, ?>
- */
-private fun List<JTypeName>.convertToSuspendSignature(): List<JTypeName> {
- val args = this
-
- // The last arg is the return type, so take everything except the last arg
- val actualArgs = args.subList(0, args.size - 1)
- val continuationReturnType = JWildcardTypeName.supertypeOf(args.last())
- val continuationType = JParameterizedTypeName.get(
- JClassName.get(Continuation::class.java),
- continuationReturnType
- )
- return actualArgs + listOf(
- JWildcardTypeName.supertypeOf(continuationType),
- JWildcardTypeName.subtypeOf(JTypeName.OBJECT)
- )
-}
-
-/**
* The private constructor of [JTypeVariableName] which receives a list.
* We use this in [createModifiableTypeVariableName] to create a [JTypeVariableName] whose bounds
* can be modified afterwards.
diff --git a/room/room-compiler-processing/src/main/java/androidx/room/compiler/processing/ksp/KSTypeVarianceResolver.kt b/room/room-compiler-processing/src/main/java/androidx/room/compiler/processing/ksp/KSTypeVarianceResolver.kt
index d797d50..56c3455 100644
--- a/room/room-compiler-processing/src/main/java/androidx/room/compiler/processing/ksp/KSTypeVarianceResolver.kt
+++ b/room/room-compiler-processing/src/main/java/androidx/room/compiler/processing/ksp/KSTypeVarianceResolver.kt
@@ -16,6 +16,7 @@
package androidx.room.compiler.processing.ksp
+import androidx.room.compiler.processing.rawTypeName
import com.google.devtools.ksp.KspExperimental
import com.google.devtools.ksp.isOpen
import com.google.devtools.ksp.processing.Resolver
@@ -25,9 +26,9 @@
import com.google.devtools.ksp.symbol.KSTypeAlias
import com.google.devtools.ksp.symbol.KSTypeArgument
import com.google.devtools.ksp.symbol.KSTypeParameter
-import com.google.devtools.ksp.symbol.KSTypeReference
import com.google.devtools.ksp.symbol.Modifier
import com.google.devtools.ksp.symbol.Variance
+import com.squareup.kotlinpoet.javapoet.JClassName
/**
* When kotlin generates java code, it has some interesting rules on how variance is handled.
@@ -51,131 +52,62 @@
* @param scope The [KSTypeVarianceResolverScope] associated with the given type.
*/
@OptIn(KspExperimental::class)
- fun applyTypeVariance(type: KSType, scope: KSTypeVarianceResolverScope): KSType {
+ fun applyTypeVariance(type: KSType, scope: KSTypeVarianceResolverScope?): KSType {
if (type.isError ||
type.arguments.isEmpty() ||
resolver.isJavaRawType(type) ||
- !scope.needsWildcardResolution) {
+ scope?.needsWildcardResolution == false) {
// There's nothing to resolve in this case, so just return the original type.
return type
}
- // First, replace any type aliases in the type with their actual types
- return type.replaceTypeAliases()
+ // First wrap types/arguments in our own wrappers so that we can keep track of the original
+ // type, which is needed to get annotations.
+ return KSTypeWrapper(resolver, type)
// Next, resolve wildcards based on the scope of the type
.resolveWildcards(scope)
// Next, apply any additional variance changes based on the @JvmSuppressWildcards or
// @JvmWildcard annotations on the resolved type.
- .applyJvmWildcardAnnotations()
+ .applyJvmWildcardAnnotations(scope)
// Finally, unwrap any delegate types. (Note: as part of resolving wildcards, we wrap
// types/type arguments in delegates to avoid loosing annotation information. However,
// those delegates may cause issues later if KSP tries to cast the type/argument to a
// particular implementation, so we unwrap them here.
- .removeWrappers()
+ .unwrap()
}
- private fun KSType.replaceTypeAliases(typeStack: ReferenceStack = ReferenceStack()): KSType {
- if (isError || typeStack.queue.contains(this)) {
- return this
- }
- if (declaration is KSTypeAlias) {
- return (declaration as KSTypeAlias).type.resolve().replaceTypeAliases(typeStack)
- }
- return typeStack.withReference(this) {
- createWrapper(arguments.map { it.replaceTypeAliases(typeStack) })
- }
+ private fun KSTypeWrapper.resolveWildcards(
+ scope: KSTypeVarianceResolverScope?
+ ) = if (scope == null) {
+ this
+ } else if (hasTypeVariables(scope.declarationType())) {
+ // If the associated declared type contains type variables that were resolved, e.g.
+ // using "asMemberOf", then it has special rules about how to resolve the types.
+ getJavaWildcardWithTypeVariables(
+ declarationType = KSTypeWrapper(resolver, scope.declarationType())
+ .getJavaWildcard(scope),
+ scope = scope,
+ )
+ } else {
+ getJavaWildcard(scope)
}
- private fun KSTypeArgument.replaceTypeAliases(typeStack: ReferenceStack): KSTypeArgument {
- val type = type?.resolve()
- if (
- type == null ||
- type.isError ||
- variance == Variance.STAR ||
- typeStack.queue.contains(type)
- ) {
- return this
- }
- return createWrapper(type.replaceTypeAliases(typeStack), variance)
- }
-
- private fun KSType.resolveWildcards(scope: KSTypeVarianceResolverScope): KSType {
- return if (hasTypeVariables(scope.declarationType())) {
- // If the associated declared type contains type variables that were resolved, e.g.
- // using "asMemberOf", then it has special rules about how to resolve the types.
- getJavaWildcardWithTypeVariables(
- type = this,
- declarationType = getJavaWildcard(scope.declarationType(), scope),
- scope = scope,
- )
- } else {
- getJavaWildcard(this, scope)
- }
- }
-
- private fun hasTypeVariables(
- type: KSType?,
- stack: ReferenceStack = ReferenceStack()
- ): Boolean {
- if (type == null || type.isError || stack.queue.contains(type)) {
+ private fun hasTypeVariables(type: KSType?, stack: List<KSType> = emptyList()): Boolean {
+ if (type == null || type.isError || stack.contains(type)) {
return false
}
- return stack.withReference(type) {
- type.isTypeParameter() ||
- type.arguments.any { hasTypeVariables(it.type?.resolve(), stack) }
- }
+ return type.isTypeParameter() ||
+ type.arguments.any { hasTypeVariables(it.type?.resolve(), stack + type) }
}
- private fun getJavaWildcard(
- type: KSType,
- scope: KSTypeVarianceResolverScope,
- typeStack: ReferenceStack = ReferenceStack(),
- typeArgStack: List<KSTypeArgument> = emptyList(),
- typeParamStack: List<KSTypeParameter> = emptyList(),
- ): KSType {
- if (type.isError || typeStack.queue.contains(type)) {
- return type
- }
- return typeStack.withReference(type) {
- val resolvedTypeArgs =
- type.arguments.indices.map { i ->
- getJavaWildcard(
- typeArg = type.arguments[i],
- typeParam = type.declaration.typeParameters[i],
- scope = scope,
- typeStack = typeStack,
- typeArgStack = typeArgStack,
- typeParamStack = typeParamStack,
- )
- }
- type.createWrapper(resolvedTypeArgs)
- }
- }
+ private fun KSTypeWrapper.getJavaWildcard(scope: KSTypeVarianceResolverScope) =
+ replace(arguments.map { it.getJavaWildcard(scope) })
- private fun getJavaWildcard(
- typeArg: KSTypeArgument,
- typeParam: KSTypeParameter,
- scope: KSTypeVarianceResolverScope,
- typeStack: ReferenceStack,
- typeArgStack: List<KSTypeArgument>,
- typeParamStack: List<KSTypeParameter>,
- ): KSTypeArgument {
- val type = typeArg.type?.resolve()
- if (
- type == null ||
- type.isError ||
- typeArg.variance == Variance.STAR ||
- typeStack.queue.contains(type)
- ) {
- return typeArg
- }
- val resolvedType = getJavaWildcard(
- type = type,
- scope = scope,
- typeStack = typeStack,
- typeArgStack = typeArgStack + typeArg,
- typeParamStack = typeParamStack + typeParam
- )
+ private fun KSTypeArgumentWrapper.getJavaWildcard(
+ scope: KSTypeVarianceResolverScope
+ ): KSTypeArgumentWrapper {
+ val type = type ?: return this
+ val resolvedType = type.getJavaWildcard(scope)
fun inheritDeclarationSiteVariance(): Boolean {
// Before we check the current variance, we need to check the previous variance in the
// stack to see if they allow us to inherit the current variance, and that logic differs
@@ -186,8 +118,8 @@
if (typeParamStack.indices.none { i ->
(typeParamStack[i].variance == Variance.CONTRAVARIANT ||
typeArgStack[i].variance == Variance.CONTRAVARIANT) &&
- // The declaration and use site variance is ignored when using @JvmWildcard
- // explicitly on a type.
+ // The declaration and use site variance is ignored when using
+ // @JvmWildcard explicitly on a type.
!typeArgStack[i].hasJvmWildcardAnnotation()
}) {
return false
@@ -237,74 +169,48 @@
}
val resolvedVariance = if (inheritDeclarationSiteVariance()) {
typeParam.variance
- } else if (typeParam.variance == typeArg.variance) {
+ } else if (typeParam.variance == variance) {
// If we're not applying the declaration-site variance, and the use-site variance is the
// same as the declaration-site variance then we don't include the use-site variance in
// the jvm type either.
Variance.INVARIANT
} else {
- typeArg.variance
+ variance
}
- return typeArg.createWrapper(resolvedType, resolvedVariance)
+ return replace(resolvedType, resolvedVariance)
}
- private fun getJavaWildcardWithTypeVariables(
- type: KSType,
- declarationType: KSType? = null,
+ private fun KSTypeWrapper.getJavaWildcardWithTypeVariables(
scope: KSTypeVarianceResolverScope,
- typeStack: ReferenceStack = ReferenceStack(),
+ declarationType: KSTypeWrapper?,
+ ) = if (declarationType?.isTypeParameter() == false) {
+ replace(
+ declarationType.arguments.indices.map { i ->
+ arguments[i].getJavaWildcardWithTypeVariablesForOuterType(
+ declarationTypeArg = declarationType.arguments[i],
+ scope = scope,
+ )
+ }
+ )
+ } else {
+ getJavaWildcardWithTypeVariablesForInnerType(scope)
+ }
+
+ private fun KSTypeWrapper.getJavaWildcardWithTypeVariablesForInnerType(
+ scope: KSTypeVarianceResolverScope,
typeParamStack: List<KSTypeParameter> = emptyList(),
- ): KSType {
- if (type.isError || typeStack.queue.contains(type)) {
- return type
- }
- return typeStack.withReference(type) {
- val resolvedTypeArgs =
- if (declarationType != null && !declarationType.isTypeParameter()) {
- declarationType.arguments.indices.map { i ->
- getJavaWildcardWithTypeVariablesForOuterType(
- typeArg = type.arguments[i],
- declarationTypeArg = declarationType.arguments[i],
- scope = scope,
- typeStack = typeStack,
- )
- }
- } else {
- type.arguments.indices.map { i ->
- getJavaWildcardWithTypeVariablesForInnerType(
- typeArg = type.arguments[i],
- typeParam = type.declaration.typeParameters[i],
- scope = scope,
- typeStack = typeStack,
- typeParamStack = typeParamStack
- )
- }
- }
- type.createWrapper(resolvedTypeArgs)
- }
- }
+ ) = replace(
+ arguments.map { it.getJavaWildcardWithTypeVariablesForInnerType(scope, typeParamStack) }
+ )
- private fun getJavaWildcardWithTypeVariablesForInnerType(
- typeArg: KSTypeArgument,
- typeParam: KSTypeParameter,
+ private fun KSTypeArgumentWrapper.getJavaWildcardWithTypeVariablesForInnerType(
scope: KSTypeVarianceResolverScope,
- typeStack: ReferenceStack,
typeParamStack: List<KSTypeParameter>,
- ): KSTypeArgument {
- val type = typeArg.type?.resolve()
- if (
- type == null ||
- type.isError ||
- typeArg.variance == Variance.STAR ||
- typeStack.queue.contains(type)
- ) {
- return typeArg
- }
- val resolvedType = getJavaWildcardWithTypeVariables(
- type = type,
+ ): KSTypeArgumentWrapper {
+ val type = type ?: return this
+ val resolvedType = type.getJavaWildcardWithTypeVariablesForInnerType(
scope = scope,
- typeStack = typeStack,
- typeParamStack = typeParamStack + typeParam,
+ typeParamStack = typeParamStack + typeParam
)
val resolvedVariance = if (
typeParam.variance != Variance.INVARIANT &&
@@ -319,137 +225,52 @@
) {
typeParam.variance
} else {
- typeArg.variance
+ variance
}
- return typeArg.createWrapper(resolvedType, resolvedVariance)
+ return replace(resolvedType, resolvedVariance)
}
- private fun getJavaWildcardWithTypeVariablesForOuterType(
- typeArg: KSTypeArgument,
- declarationTypeArg: KSTypeArgument,
+ private fun KSTypeArgumentWrapper.getJavaWildcardWithTypeVariablesForOuterType(
+ declarationTypeArg: KSTypeArgumentWrapper,
scope: KSTypeVarianceResolverScope,
- typeStack: ReferenceStack,
- ): KSTypeArgument {
- val type = typeArg.type?.resolve()
- if (
- type == null ||
- type.isError ||
- typeArg.variance == Variance.STAR ||
- typeStack.queue.contains(type)
- ) {
- return typeArg
- }
- val resolvedType = getJavaWildcardWithTypeVariables(
- type = type,
- declarationType = declarationTypeArg.type?.resolve(),
+ ): KSTypeArgumentWrapper {
+ val type = type ?: return this
+ val resolvedType = type.getJavaWildcardWithTypeVariables(
+ declarationType = declarationTypeArg.type,
scope = scope,
- typeStack = typeStack
)
val resolvedVariance = if (declarationTypeArg.variance != Variance.INVARIANT) {
declarationTypeArg.variance
} else {
- typeArg.variance
- }
- return typeArg.createWrapper(resolvedType, resolvedVariance)
- }
-
- private fun KSType.applyJvmWildcardAnnotations(
- typeStack: ReferenceStack = ReferenceStack(),
- typeArgStack: List<KSTypeArgument> = emptyList(),
- ): KSType {
- if (isError || typeStack.queue.contains(this)) {
- return this
- }
- return typeStack.withReference(this) {
- val resolvedTypeArgs =
- arguments.indices.map { i ->
- applyJvmWildcardAnnotations(
- typeArg = arguments[i],
- typeParameter = declaration.typeParameters[i],
- typeArgStack = typeArgStack,
- typeStack = typeStack,
- )
- }
- createWrapper(resolvedTypeArgs)
- }
- }
-
- private fun applyJvmWildcardAnnotations(
- typeArg: KSTypeArgument,
- typeParameter: KSTypeParameter,
- typeStack: ReferenceStack,
- typeArgStack: List<KSTypeArgument>,
- ): KSTypeArgument {
- val type = typeArg.type?.resolve()
- if (
- type == null ||
- type.isError ||
- typeArg.variance == Variance.STAR ||
- typeStack.queue.contains(type)
- ) {
- return typeArg
- }
- val resolvedType = type.applyJvmWildcardAnnotations(typeStack, typeArgStack + typeArg)
- val resolvedVariance = when {
- typeParameter.variance == Variance.INVARIANT &&
- typeArg.variance != Variance.INVARIANT -> typeArg.variance
- typeArg.hasJvmWildcardAnnotation() -> typeParameter.variance
- // We only need to check the first type in the stack for @JvmSuppressWildcards.
- // Any other @JvmSuppressWildcards usages will be placed on the type arguments rather
- // than the types, so no need to check the rest of the types.
- typeStack.queue.first().hasSuppressJvmWildcardAnnotation() ||
- typeArg.hasSuppressWildcardsAnnotationInHierarchy() ||
- typeArgStack.any { it.hasSuppressJvmWildcardAnnotation() } ||
- typeParameter.hasSuppressWildcardsAnnotationInHierarchy() -> Variance.INVARIANT
- else -> typeArg.variance
- }
- return typeArg.createWrapper(resolvedType, resolvedVariance)
- }
-
- private fun KSTypeArgument.createWrapper(
- newType: KSType,
- newVariance: Variance
- ): KSTypeArgument {
- return KSTypeArgumentWrapper(
- delegate = (this as? KSTypeArgumentWrapper)?.delegate ?: this,
- type = newType.createTypeReference(),
- variance = newVariance
- )
- }
-
- private fun KSType.createWrapper(newArguments: List<KSTypeArgument>): KSType {
- return KSTypeWrapper(
- delegate = (this as? KSTypeWrapper)?.delegate ?: this,
- arguments = newArguments
- )
- }
-
- private fun KSType.removeWrappers(typeStack: ReferenceStack = ReferenceStack()): KSType {
- if (isError || typeStack.queue.contains(this)) {
- return this
- }
- return typeStack.withReference(this) {
- val delegateType = (this as? KSTypeWrapper)?.delegate ?: this
- delegateType.replace(arguments.map { it.removeWrappers(typeStack) })
- }
- }
-
- private fun KSTypeArgument.removeWrappers(
- typeStack: ReferenceStack = ReferenceStack()
- ): KSTypeArgument {
- val type = type?.resolve()
- if (
- type == null ||
- type.isError ||
- variance == Variance.STAR ||
- typeStack.queue.contains(type)
- ) {
- return this
- }
- return resolver.getTypeArgument(
- type.removeWrappers(typeStack).createTypeReference(),
variance
- )
+ }
+ return replace(resolvedType, resolvedVariance)
+ }
+
+ private fun KSTypeWrapper.applyJvmWildcardAnnotations(
+ scope: KSTypeVarianceResolverScope?
+ ) =
+ replace(arguments.map { it.applyJvmWildcardAnnotations(scope) })
+
+ private fun KSTypeArgumentWrapper.applyJvmWildcardAnnotations(
+ scope: KSTypeVarianceResolverScope?
+ ): KSTypeArgumentWrapper {
+ val type = type ?: return this
+ val resolvedType = type.applyJvmWildcardAnnotations(scope)
+ val resolvedVariance = when {
+ typeParam.variance == Variance.INVARIANT && variance != Variance.INVARIANT -> variance
+ hasJvmWildcardAnnotation() -> typeParam.variance
+ scope?.hasSuppressWildcards == true ||
+ // We only need to check the first type in the stack for @JvmSuppressWildcards.
+ // Any other @JvmSuppressWildcards usages will be placed on the type arguments
+ // rather than the types, so no need to check the rest of the types.
+ typeStack.first().hasSuppressJvmWildcardAnnotation() ||
+ this.hasSuppressWildcardsAnnotationInHierarchy() ||
+ typeArgStack.any { it.hasSuppressJvmWildcardAnnotation() } ||
+ typeParam.hasSuppressWildcardsAnnotationInHierarchy() -> Variance.INVARIANT
+ else -> variance
+ }
+ return replace(resolvedType, resolvedVariance)
}
}
@@ -460,14 +281,80 @@
* [KSType#replace(KSTypeArgument)] directly when using [KSTypeArgumentWrapper] or we'll get an
* [IllegalStateException] since KSP tries to cast to its own implementation of [KSTypeArgument].
*/
-private class KSTypeWrapper(
- val delegate: KSType,
- override val arguments: List<KSTypeArgument>
-) : KSType by delegate {
- override fun toString() = if (arguments.isNotEmpty()) {
- "${delegate.toString().substringBefore("<")}<${arguments.joinToString(",")}>"
- } else {
- delegate.toString()
+private class KSTypeWrapper constructor(
+ private val resolver: Resolver,
+ private val originalType: KSType,
+ private val newType: KSType =
+ originalType.replaceTypeAliases().replaceSuspendFunctionTypes(resolver),
+ newTypeArguments: List<KSTypeArgumentWrapper>? = null,
+ private val typeStack: List<KSTypeWrapper> = emptyList(),
+ private val typeArgStack: List<KSTypeArgumentWrapper> = emptyList(),
+ private val typeParamStack: List<KSTypeParameter> = emptyList(),
+) {
+ val declaration = originalType.declaration
+
+ val arguments: List<KSTypeArgumentWrapper> by lazy {
+ newTypeArguments ?: newType.arguments.indices.map { i ->
+ KSTypeArgumentWrapper(
+ originalTypeArg = newType.arguments[i],
+ typeParam = newType.declaration.typeParameters[i],
+ resolver = resolver,
+ typeStack = typeStack + this,
+ typeArgStack = typeArgStack,
+ typeParamStack = typeParamStack,
+ )
+ }
+ }
+
+ fun replace(newTypeArguments: List<KSTypeArgumentWrapper>) = KSTypeWrapper(
+ originalType = originalType,
+ newType = newType,
+ newTypeArguments = newTypeArguments,
+ resolver = resolver,
+ typeStack = typeStack,
+ typeArgStack = typeArgStack,
+ typeParamStack = typeParamStack,
+ )
+
+ fun hasSuppressJvmWildcardAnnotation() = originalType.hasSuppressJvmWildcardAnnotation()
+
+ fun isTypeParameter() = originalType.isTypeParameter()
+
+ fun unwrap() = newType.replace(arguments.map { it.unwrap() })
+
+ override fun toString() = buildString {
+ if (originalType.annotations.toList().isNotEmpty()) {
+ append("${originalType.annotations.toList()} ")
+ }
+ append(newType.declaration.simpleName.asString())
+ if (arguments.isNotEmpty()) {
+ append("$arguments")
+ }
+ }
+
+ private companion object {
+ fun KSType.replaceTypeAliases() = (declaration as? KSTypeAlias)?.type?.resolve() ?: this
+
+ fun KSType.replaceSuspendFunctionTypes(resolver: Resolver) = if (!isSuspendFunctionType) {
+ this
+ } else {
+ // Find the JVM FunctionN type that will replace the suspend function and use that.
+ val functionN = resolver.requireType(
+ (declaration.asJTypeName(resolver).rawTypeName() as JClassName).canonicalName()
+ )
+ functionN.replace(
+ buildList {
+ addAll(arguments.dropLast(1))
+ val continuationArgs = arguments.takeLast(1)
+ val continuationTypeRef = resolver.requireType("kotlin.coroutines.Continuation")
+ .replace(continuationArgs)
+ .createTypeReference()
+ val objTypeRef = resolver.requireType("java.lang.Object").createTypeReference()
+ add(resolver.getTypeArgument(continuationTypeRef, Variance.INVARIANT))
+ add(resolver.getTypeArgument(objTypeRef, Variance.INVARIANT))
+ }
+ )
+ }
}
}
@@ -480,36 +367,69 @@
* we'll lose information about annotations (e.g. `@JvmSuppressWildcards`) that were on the original
* type argument.
*/
-private class KSTypeArgumentWrapper(
- val delegate: KSTypeArgument,
- override val type: KSTypeReference,
- override val variance: Variance,
-) : KSTypeArgument by delegate {
- override fun toString() = when (variance) {
- Variance.INVARIANT -> "${type.resolve()}"
- Variance.CONTRAVARIANT -> "in ${type.resolve()}"
- Variance.COVARIANT -> "out ${type.resolve()}"
- Variance.STAR -> "*"
- }
-}
-
-/**
- * Inheriting variance for self referencing types (e.g. Foo<T : Foo>) could go into an infinite
- * loop. To avoid that issue, every time we visit a type, we keep it in the reference stack and
- * if a type argument resolves to it, it will stop recursion.
- */
-private class ReferenceStack {
- val queue = ArrayDeque<KSType>()
-
- inline fun <T> withReference(
- ksType: KSType,
- crossinline block: () -> T
- ): T {
- return try {
- queue.addLast(ksType)
- block()
- } finally {
- queue.removeLast()
+private class KSTypeArgumentWrapper constructor(
+ private val originalTypeArg: KSTypeArgument,
+ private val newType: KSTypeWrapper? = null,
+ private val resolver: Resolver,
+ val typeParam: KSTypeParameter,
+ val variance: Variance = originalTypeArg.variance,
+ val typeStack: List<KSTypeWrapper>,
+ val typeArgStack: List<KSTypeArgumentWrapper>,
+ val typeParamStack: List<KSTypeParameter>,
+) {
+ val type: KSTypeWrapper? by lazy {
+ if (variance == Variance.STAR || originalTypeArg.type == null) {
+ // Return null for star projections, otherwise we'll end up in an infinite loop.
+ null
+ } else {
+ newType ?: KSTypeWrapper(
+ originalType = originalTypeArg.type!!.resolve(),
+ resolver = resolver,
+ typeStack = typeStack,
+ typeArgStack = typeArgStack + this,
+ typeParamStack = typeParamStack + typeParam,
+ )
}
}
+
+ fun replace(newType: KSTypeWrapper, newVariance: Variance) = KSTypeArgumentWrapper(
+ originalTypeArg = originalTypeArg,
+ typeParam = typeParam,
+ newType = newType,
+ variance = newVariance,
+ resolver = resolver,
+ typeStack = typeStack,
+ typeArgStack = typeArgStack,
+ typeParamStack = typeParamStack,
+ )
+
+ fun hasJvmWildcardAnnotation() = originalTypeArg.hasJvmWildcardAnnotation()
+
+ fun hasSuppressJvmWildcardAnnotation() = originalTypeArg.hasSuppressJvmWildcardAnnotation()
+
+ fun hasSuppressWildcardsAnnotationInHierarchy() =
+ originalTypeArg.hasSuppressWildcardsAnnotationInHierarchy()
+
+ fun unwrap(): KSTypeArgument {
+ val unwrappedType = type?.unwrap()
+ return if (unwrappedType == null || unwrappedType.isError) {
+ originalTypeArg
+ } else {
+ resolver.getTypeArgument(unwrappedType.createTypeReference(), variance)
+ }
+ }
+
+ override fun toString() = buildString {
+ if (originalTypeArg.annotations.toList().isNotEmpty()) {
+ append("${originalTypeArg.annotations.toList()} ")
+ }
+ append(
+ when (variance) {
+ Variance.INVARIANT -> "$type"
+ Variance.CONTRAVARIANT -> "in $type"
+ Variance.COVARIANT -> "out $type"
+ Variance.STAR -> "*"
+ }
+ )
+ }
}
diff --git a/room/room-compiler-processing/src/main/java/androidx/room/compiler/processing/ksp/KSTypeVarianceResolverScope.kt b/room/room-compiler-processing/src/main/java/androidx/room/compiler/processing/ksp/KSTypeVarianceResolverScope.kt
index 19f546a..a124660 100644
--- a/room/room-compiler-processing/src/main/java/androidx/room/compiler/processing/ksp/KSTypeVarianceResolverScope.kt
+++ b/room/room-compiler-processing/src/main/java/androidx/room/compiler/processing/ksp/KSTypeVarianceResolverScope.kt
@@ -36,15 +36,18 @@
* parameter is in kotlin or the containing class, which inherited the method, is in kotlin.
*/
val needsWildcardResolution: Boolean by lazy {
- fun nodeForSuppressionCheck(): KSAnnotated? = when (this) {
+ annotated.isInKotlinCode() || container?.isInKotlinCode() == true
+ }
+
+ val hasSuppressWildcards: Boolean by lazy {
+ val nodeForSuppressionCheck = when (this) {
// For property setter and getter methods skip to the enclosing class to check for
// suppression annotations to match KAPT.
is PropertySetterParameterType,
is PropertyGetterMethodReturnType -> annotated.parent?.parent as? KSAnnotated
else -> annotated
}
- (annotated.isInKotlinCode() || container?.isInKotlinCode() == true) &&
- nodeForSuppressionCheck()?.hasSuppressWildcardsAnnotationInHierarchy() != true
+ nodeForSuppressionCheck?.hasSuppressWildcardsAnnotationInHierarchy() == true
}
private fun KSAnnotated.isInKotlinCode(): Boolean {
@@ -67,7 +70,7 @@
abstract fun isValOrReturnType(): Boolean
/** Returns the scope of the `asMemberOf` container type. */
- fun asMemberOfScopeOrSelf(): KSTypeVarianceResolverScope? {
+ fun asMemberOfScopeOrSelf(): KSTypeVarianceResolverScope {
return asMemberOf?.scope ?: this
}
diff --git a/room/room-compiler-processing/src/main/java/androidx/room/compiler/processing/ksp/KspProcessingEnv.kt b/room/room-compiler-processing/src/main/java/androidx/room/compiler/processing/ksp/KspProcessingEnv.kt
index acf2615..ae5a43cb 100644
--- a/room/room-compiler-processing/src/main/java/androidx/room/compiler/processing/ksp/KspProcessingEnv.kt
+++ b/room/room-compiler-processing/src/main/java/androidx/room/compiler/processing/ksp/KspProcessingEnv.kt
@@ -295,7 +295,7 @@
/**
* Resolves the wildcards for the given ksType. See [KSTypeVarianceResolver] for details.
*/
- internal fun resolveWildcards(ksType: KSType, scope: KSTypeVarianceResolverScope) =
+ internal fun resolveWildcards(ksType: KSType, scope: KSTypeVarianceResolverScope?) =
ksTypeVarianceResolver.applyTypeVariance(ksType, scope)
internal fun clearCache() {
diff --git a/room/room-compiler-processing/src/main/java/androidx/room/compiler/processing/ksp/KspType.kt b/room/room-compiler-processing/src/main/java/androidx/room/compiler/processing/ksp/KspType.kt
index 74709b2..dc5cf7c 100644
--- a/room/room-compiler-processing/src/main/java/androidx/room/compiler/processing/ksp/KspType.kt
+++ b/room/room-compiler-processing/src/main/java/androidx/room/compiler/processing/ksp/KspType.kt
@@ -69,23 +69,19 @@
* The [XTypeName] represents those differences as [JTypeName] and [KTypeName], respectively.
*/
private val xTypeName: XTypeName by lazy {
- val jvmWildcardType = if (scope == null) {
- this
- } else {
- env.resolveWildcards(ksType, scope).let {
- if (it == ksType) {
- this
- } else {
- env.wrap(
- ksType = it,
- allowPrimitives = this is KspPrimitiveType
- ).copyWithScope(scope)
- }
+ val jvmWildcardType = env.resolveWildcards(ksType, scope).let {
+ if (it == ksType) {
+ this
+ } else {
+ env.wrap(
+ ksType = it,
+ allowPrimitives = this is KspPrimitiveType
+ )
}
}
XTypeName(
jvmWildcardType.resolveJTypeName(),
- jvmWildcardType.resolveKTypeName(),
+ resolveKTypeName(),
nullability
)
}
@@ -141,15 +137,12 @@
if (argDeclaration is KSTypeParameter) {
// If this is a type parameter, replace it with the resolved type argument.
resolvedTypeArguments[argDeclaration.name.asString()] ?: argument
- } else if (
- argument.type != null && argument.type?.resolve()?.arguments?.isEmpty() == false
- ) {
+ } else if (argument.type?.resolve()?.arguments?.isEmpty() == false) {
// If this is a type with arguments, the arguments may contain a type parameter,
// e.g. Foo<T>, so try to resolve the type and then convert to a type argument.
env.resolver.getTypeArgument(
- env.resolver.createKSTypeReferenceFromKSType(
- resolveTypeArguments(argument.type!!.resolve(), resolvedTypeArguments)
- ),
+ resolveTypeArguments(argument.type!!.resolve(), resolvedTypeArguments)
+ .createTypeReference(),
variance = Variance.INVARIANT
)
} else {
diff --git a/room/room-compiler-processing/src/main/java/androidx/room/compiler/processing/ksp/KspTypeArgumentType.kt b/room/room-compiler-processing/src/main/java/androidx/room/compiler/processing/ksp/KspTypeArgumentType.kt
index 7593b7f..589244d 100644
--- a/room/room-compiler-processing/src/main/java/androidx/room/compiler/processing/ksp/KspTypeArgumentType.kt
+++ b/room/room-compiler-processing/src/main/java/androidx/room/compiler/processing/ksp/KspTypeArgumentType.kt
@@ -21,6 +21,7 @@
import com.google.devtools.ksp.symbol.KSTypeArgument
import com.google.devtools.ksp.symbol.KSTypeParameter
import com.google.devtools.ksp.symbol.KSTypeReference
+import com.google.devtools.ksp.symbol.Variance
import com.squareup.kotlinpoet.javapoet.JTypeName
import com.squareup.kotlinpoet.javapoet.KTypeName
@@ -47,7 +48,8 @@
ksType = ksType,
allowPrimitives = false
)
- if (this.ksType.declaration is KSTypeParameter && this == extendBound) {
+ if (typeArg.variance == Variance.STAR ||
+ (this.ksType.declaration is KSTypeParameter && this == extendBound)) {
null
} else {
extendBound
diff --git a/room/room-compiler-processing/src/test/java/androidx/room/compiler/processing/TypeAliasTest.kt b/room/room-compiler-processing/src/test/java/androidx/room/compiler/processing/TypeAliasTest.kt
index ba7cb80..f09dcbd 100644
--- a/room/room-compiler-processing/src/test/java/androidx/room/compiler/processing/TypeAliasTest.kt
+++ b/room/room-compiler-processing/src/test/java/androidx/room/compiler/processing/TypeAliasTest.kt
@@ -32,7 +32,6 @@
import com.squareup.kotlinpoet.javapoet.JParameterizedTypeName
import com.squareup.kotlinpoet.javapoet.JTypeName
import com.squareup.kotlinpoet.javapoet.JWildcardTypeName
-import com.squareup.kotlinpoet.javapoet.KWildcardTypeName
import kotlin.coroutines.Continuation
import org.junit.Test
import org.junit.runner.RunWith
@@ -94,8 +93,7 @@
)
if (invocation.isKsp) {
assertThat(it.asTypeName().kotlin).isEqualTo(
- Continuation::class.asKClassName()
- .parameterizedBy(KWildcardTypeName.consumerOf(LONG))
+ Continuation::class.asKClassName().parameterizedBy(LONG)
)
}
}
diff --git a/room/room-compiler-processing/src/test/java/androidx/room/compiler/processing/TypeInheritanceTest.kt b/room/room-compiler-processing/src/test/java/androidx/room/compiler/processing/TypeInheritanceTest.kt
index f337713..e9b693c 100644
--- a/room/room-compiler-processing/src/test/java/androidx/room/compiler/processing/TypeInheritanceTest.kt
+++ b/room/room-compiler-processing/src/test/java/androidx/room/compiler/processing/TypeInheritanceTest.kt
@@ -64,20 +64,13 @@
fieldName: String,
expectedJTypeName: String,
) {
- val expectedKTypeName = expectedJTypeName.replace("? extends", "out")
val sub = processingEnv.requireTypeElement("SubClass")
val subField = sub.getField(fieldName).asMemberOf(sub.type)
assertThat(subField.asTypeName().java.toString()).isEqualTo(expectedJTypeName)
- if (isKsp) {
- assertThat(subField.asTypeName().kotlin.toString()).isEqualTo(expectedKTypeName)
- }
val base = processingEnv.requireTypeElement("BaseClass")
val baseField = base.getField(fieldName).asMemberOf(sub.type)
assertThat(baseField.asTypeName().java.toString()).isEqualTo(expectedJTypeName)
- if (isKsp) {
- assertThat(baseField.asTypeName().kotlin.toString()).isEqualTo(expectedKTypeName)
- }
}
private fun XTestInvocation.assertParamType(
@@ -85,23 +78,16 @@
paramName: String,
expectedJTypeName: String,
) {
- val expectedKTypeName = expectedJTypeName.replace("? extends", "out")
val sub = processingEnv.requireTypeElement("SubClass")
val subMethod = sub.getMethodByJvmName(methodName)
val paramIndex = subMethod.parameters.indexOf(subMethod.getParameter(paramName))
val subMethodParam = subMethod.asMemberOf(sub.type).parameterTypes[paramIndex]
assertThat(subMethodParam.asTypeName().java.toString()).isEqualTo(expectedJTypeName)
- if (isKsp) {
- assertThat(subMethodParam.asTypeName().kotlin.toString()).isEqualTo(expectedKTypeName)
- }
val base = processingEnv.requireTypeElement("BaseClass")
val baseMethod = base.getMethodByJvmName(methodName)
val baseMethodParam = baseMethod.asMemberOf(sub.type).parameterTypes[paramIndex]
assertThat(baseMethodParam.asTypeName().java.toString()).isEqualTo(expectedJTypeName)
- if (isKsp) {
- assertThat(baseMethodParam.asTypeName().kotlin.toString()).isEqualTo(expectedKTypeName)
- }
}
private fun XTestInvocation.assertReturnType(methodName: String, expectedTypeName: String) {
diff --git a/room/room-compiler-processing/src/test/java/androidx/room/compiler/processing/XTypeTest.kt b/room/room-compiler-processing/src/test/java/androidx/room/compiler/processing/XTypeTest.kt
index 724c037..12b61d7 100644
--- a/room/room-compiler-processing/src/test/java/androidx/room/compiler/processing/XTypeTest.kt
+++ b/room/room-compiler-processing/src/test/java/androidx/room/compiler/processing/XTypeTest.kt
@@ -933,7 +933,7 @@
assertThat(actual["starList"]?.kotlin.toString())
.isEqualTo("kotlin.collections.List<*>")
assertThat(actual["rList"]?.kotlin.toString())
- .isEqualTo("kotlin.collections.List<out R>")
+ .isEqualTo("kotlin.collections.List<R>")
}
}
}
@@ -1637,4 +1637,56 @@
}
)
}
+
+ @Test
+ fun selfReferenceTypesDoesNotInfinitelyRecurse() {
+ fun runTest(src: Source) {
+ runProcessorTest(
+ sources = listOf(src),
+ ) { invocation ->
+ val fooTypeElement = invocation.processingEnv.requireTypeElement("test.Usage")
+ val fooType = fooTypeElement.getDeclaredField("foo").type
+
+ assertThat(fooType.asTypeName().java)
+ .isEqualTo(
+ JParameterizedTypeName.get(
+ JClassName.get("test", "Foo"),
+ JWildcardTypeName.subtypeOf(JClassName.OBJECT)
+ )
+ )
+
+ val typeParam = fooType.typeArguments.single()
+ assertThat(typeParam.asTypeName().java)
+ .isEqualTo(JWildcardTypeName.subtypeOf(JClassName.OBJECT))
+
+ assertThat(typeParam.extendsBound()).isNull()
+ }
+ }
+ runTest(
+ Source.java(
+ "test.Usage",
+ """
+ package test;
+ public final class Usage {
+ private final Foo<?> foo = null;
+ private final Foo<? extends Foo<?>> fooExtendsFoo = null;
+ }
+ abstract class Foo<T extends Foo<T>> {}
+ """.trimIndent()
+ ),
+ )
+ runTest(
+ Source.kotlin(
+ "test.Foo.kt",
+ """
+ package test
+ class Usage {
+ val foo: Foo<*> = TODO()
+ val fooExtendsFoo: Foo<out Foo<*>> = TODO()
+ }
+ abstract class Foo<T: Foo<T>>
+ """.trimIndent()
+ )
+ )
+ }
}
diff --git a/room/room-compiler-processing/src/test/java/androidx/room/compiler/processing/ksp/KSTypeVarianceResolverWithTypeParametersTest.kt b/room/room-compiler-processing/src/test/java/androidx/room/compiler/processing/ksp/KSTypeVarianceResolverWithTypeParametersTest.kt
index 16b8f8c..0fb042c 100644
--- a/room/room-compiler-processing/src/test/java/androidx/room/compiler/processing/ksp/KSTypeVarianceResolverWithTypeParametersTest.kt
+++ b/room/room-compiler-processing/src/test/java/androidx/room/compiler/processing/ksp/KSTypeVarianceResolverWithTypeParametersTest.kt
@@ -91,17 +91,13 @@
""".trimIndent()
)
val kaptSignaturesMap = buildMap(sourcesMap.size) {
- runKaptTest(sources) {
- sourcesMap.keys.forEach { key ->
- put(key, IntRange(0, 5).flatMap { i -> collectSignatures(it, key, i) })
- }
+ runKaptTest(sources) { invocation ->
+ sourcesMap.keys.forEach { key -> put(key, invocation.collectSignatures(key)) }
}
}
val kspSignaturesMap = buildMap(sourcesMap.size) {
- runKspTest(sources) {
- sourcesMap.keys.forEach { key ->
- put(key, IntRange(0, 5).flatMap { i -> collectSignatures(it, key, i) })
- }
+ runKspTest(sources) { invocation ->
+ sourcesMap.keys.forEach { key -> put(key, invocation.collectSignatures(key)) }
}
}
CompilationResults(kaptSignaturesMap, kspSignaturesMap)
@@ -123,48 +119,47 @@
)
}
- private fun collectSignatures(
- invocation: XTestInvocation,
- key: String,
- configuration: Int,
- ): List<String> {
- val subName = "Sub$key$configuration"
- val baseName = "Base$key$configuration"
- val sub = invocation.processingEnv.requireTypeElement(subName)
- val subMethod = sub.getDeclaredMethodByJvmName("subMethod")
- val subSuperclassType = sub.superClass!!
- val subMethodParamType = subMethod.parameters.single().type
- val subMethodReturnType = subMethod.returnType
- val base = invocation.processingEnv.requireTypeElement(baseName)
- // Note: For each method/field we test its signature when resolved asMemberOf from a
- // subtype, super class, param type, and return type, as we may get different signatures
- // depending on the scope of the type used with asMemberOf.
+ private fun XTestInvocation.collectSignatures(key: String): List<String> {
return buildList {
- base.getDeclaredMethods().forEach { method ->
- fun XMethodType.signature(): String {
- val returnType = returnType.typeName
- val parameters = parameterTypes.map { it.typeName }
- return "${method.name} : $returnType : $parameters"
+ IntRange(0, 5).forEach { configuration ->
+ val subName = "Sub$key$configuration"
+ val baseName = "Base$key$configuration"
+ val sub = processingEnv.requireTypeElement(subName)
+ val subMethod = sub.getDeclaredMethodByJvmName("subMethod")
+ val subSuperclassType = sub.superClass!!
+ val subMethodParamType = subMethod.parameters.single().type
+ val subMethodReturnType = subMethod.returnType
+ val base = processingEnv.requireTypeElement(baseName)
+ // Note: For each method/field we test its signature when resolved asMemberOf from a
+ // subtype, super class, param type, and return type, as we may get different signatures
+ // depending on the scope of the type used with asMemberOf.
+ base.getDeclaredMethods().forEach { method ->
+ fun XMethodType.signature(): String {
+ val returnType = returnType.typeName
+ val parameters = parameterTypes.map { it.typeName }
+ return "${method.name} : $returnType : $parameters"
+ }
+
+ val fromSubType = method.asMemberOf(sub.type)
+ val fromSuperClassType = method.asMemberOf(subSuperclassType)
+ val fromParamType = method.asMemberOf(subMethodParamType)
+ val fromReturnType = method.asMemberOf(subMethodReturnType)
+ add("$configuration-fromSub-${fromSubType.signature()}")
+ add("$configuration-fromSuperClass-${fromSuperClassType.signature()}")
+ add("$configuration-fromParam-${fromParamType.signature()}")
+ add("$configuration-fromReturnType-${fromReturnType.signature()}")
}
- val fromSubType = method.asMemberOf(sub.type)
- val fromSuperClassType = method.asMemberOf(subSuperclassType)
- val fromParamType = method.asMemberOf(subMethodParamType)
- val fromReturnType = method.asMemberOf(subMethodReturnType)
- add("$configuration-fromSub-${fromSubType.signature()}")
- add("$configuration-fromSuperClass-${fromSuperClassType.signature()}")
- add("$configuration-fromParam-${fromParamType.signature()}")
- add("$configuration-fromReturnType-${fromReturnType.signature()}")
- }
- base.getDeclaredFields().forEach { field ->
- fun XType.signature() = "${field.name} : $typeName"
- val fromSubType = field.asMemberOf(sub.type)
- val fromSuperClassType = field.asMemberOf(subSuperclassType)
- val fromParamType = field.asMemberOf(subMethodParamType)
- val fromReturnType = field.asMemberOf(subMethodReturnType)
- add("$configuration-fromSub-${fromSubType.signature()}")
- add("$configuration-fromSuperClass-${fromSuperClassType.signature()}")
- add("$configuration-fromParam-${fromParamType.signature()}")
- add("$configuration-fromReturnType-${fromReturnType.signature()}")
+ base.getDeclaredFields().forEach { field ->
+ fun XType.signature() = "${field.name} : $typeName"
+ val fromSubType = field.asMemberOf(sub.type)
+ val fromSuperClassType = field.asMemberOf(subSuperclassType)
+ val fromParamType = field.asMemberOf(subMethodParamType)
+ val fromReturnType = field.asMemberOf(subMethodReturnType)
+ add("$configuration-fromSub-${fromSubType.signature()}")
+ add("$configuration-fromSuperClass-${fromSuperClassType.signature()}")
+ add("$configuration-fromParam-${fromParamType.signature()}")
+ add("$configuration-fromReturnType-${fromReturnType.signature()}")
+ }
}
}
}
diff --git a/room/room-compiler-processing/src/test/java/androidx/room/compiler/processing/ksp/KspTypeNamesGoldenTest.kt b/room/room-compiler-processing/src/test/java/androidx/room/compiler/processing/ksp/KspTypeNamesGoldenTest.kt
index be3f4bf..35f0b23 100644
--- a/room/room-compiler-processing/src/test/java/androidx/room/compiler/processing/ksp/KspTypeNamesGoldenTest.kt
+++ b/room/room-compiler-processing/src/test/java/androidx/room/compiler/processing/ksp/KspTypeNamesGoldenTest.kt
@@ -162,6 +162,20 @@
interface MyInterface
typealias MyInterfaceAlias = MyInterface
typealias MyGenericAlias = MyGenericIn<MyGenericOut<MyGenericOut<MyType>>>
+ typealias MyLambdaAlias1 = (List<MyGenericIn<MyGenericOut<MyGenericOut<MyType>>>>) -> List<MyGenericIn<MyGenericOut<MyGenericOut<MyType>>>>
+ typealias MyLambdaAlias2 = @JSW (List<MyGenericIn<MyGenericOut<MyGenericOut<MyType>>>>) -> List<MyGenericIn<MyGenericOut<MyGenericOut<MyType>>>>
+ typealias MyLambdaAlias3 = (@JSW List<MyGenericIn<MyGenericOut<MyGenericOut<MyType>>>>) -> @JSW List<MyGenericIn<MyGenericOut<MyGenericOut<MyType>>>>
+ typealias MyLambdaAlias4 = (List<@JSW MyGenericIn<MyGenericOut<MyGenericOut<MyType>>>>) -> List<@JSW MyGenericIn<MyGenericOut<MyGenericOut<MyType>>>>
+ typealias MyLambdaAlias5 = (List<MyGenericIn<@JSW MyGenericOut<MyGenericOut<MyType>>>>) -> List<MyGenericIn<@JSW MyGenericOut<MyGenericOut<MyType>>>>
+ typealias MyLambdaAlias6 = (List<MyGenericIn<MyGenericOut<@JSW MyGenericOut<MyType>>>>) -> List<MyGenericIn<MyGenericOut<@JSW MyGenericOut<MyType>>>>
+ typealias MyLambdaAlias7 = (List<MyGenericIn<MyGenericOut<MyGenericOut<@JSW MyType>>>>) -> List<MyGenericIn<MyGenericOut<MyGenericOut<@JSW MyType>>>>
+ typealias MySuspendLambdaAlias1 = suspend (List<MyGenericIn<MyGenericOut<MyGenericOut<MyType>>>>) -> List<MyGenericIn<MyGenericOut<MyGenericOut<MyType>>>>
+ typealias MySuspendLambdaAlias2 = @JSW suspend (List<MyGenericIn<MyGenericOut<MyGenericOut<MyType>>>>) -> List<MyGenericIn<MyGenericOut<MyGenericOut<MyType>>>>
+ typealias MySuspendLambdaAlias3 = suspend (@JSW List<MyGenericIn<MyGenericOut<MyGenericOut<MyType>>>>) -> @JSW List<MyGenericIn<MyGenericOut<MyGenericOut<MyType>>>>
+ typealias MySuspendLambdaAlias4 = suspend (List<@JSW MyGenericIn<MyGenericOut<MyGenericOut<MyType>>>>) -> List<@JSW MyGenericIn<MyGenericOut<MyGenericOut<MyType>>>>
+ typealias MySuspendLambdaAlias5 = suspend (List<MyGenericIn<@JSW MyGenericOut<MyGenericOut<MyType>>>>) -> List<MyGenericIn<@JSW MyGenericOut<MyGenericOut<MyType>>>>
+ typealias MySuspendLambdaAlias6 = suspend (List<MyGenericIn<MyGenericOut<@JSW MyGenericOut<MyType>>>>) -> List<MyGenericIn<MyGenericOut<@JSW MyGenericOut<MyType>>>>
+ typealias MySuspendLambdaAlias7 = suspend (List<MyGenericIn<MyGenericOut<MyGenericOut<@JSW MyType>>>>) -> List<MyGenericIn<MyGenericOut<MyGenericOut<@JSW MyType>>>>
typealias JSW = JvmSuppressWildcards
typealias JW = JvmWildcard
typealias MyLambdaTypeAlias = (@JvmWildcard MyType) -> @JvmWildcard MyType
@@ -453,6 +467,34 @@
fun explicitJvmSuppressWildcardTypeAlias_OnType2(
list: @JSW List<Number>
): @JSW List<Number> { TODO() }
+ fun lambda1(param: MyLambdaAlias1): MyLambdaAlias1 = TODO()
+ fun lambda2(param: MyLambdaAlias2): MyLambdaAlias2 = TODO()
+ fun lambda3(param: MyLambdaAlias3): MyLambdaAlias3 = TODO()
+ fun lambda4(param: MyLambdaAlias4): MyLambdaAlias4 = TODO()
+ fun lambda5(param: MyLambdaAlias5): MyLambdaAlias5 = TODO()
+ fun lambda6(param: MyLambdaAlias6): MyLambdaAlias6 = TODO()
+ fun lambda7(param: MyLambdaAlias7): MyLambdaAlias7 = TODO()
+ @JSW fun lambda1WithJSW(param: MyLambdaAlias1): MyLambdaAlias1 = TODO()
+ @JSW fun lambda2WithJSW(param: MyLambdaAlias2): MyLambdaAlias2 = TODO()
+ @JSW fun lambda3WithJSW(param: MyLambdaAlias3): MyLambdaAlias3 = TODO()
+ @JSW fun lambda4WithJSW(param: MyLambdaAlias4): MyLambdaAlias4 = TODO()
+ @JSW fun lambda5WithJSW(param: MyLambdaAlias5): MyLambdaAlias5 = TODO()
+ @JSW fun lambda6WithJSW(param: MyLambdaAlias6): MyLambdaAlias6 = TODO()
+ @JSW fun lambda7WithJSW(param: MyLambdaAlias7): MyLambdaAlias7 = TODO()
+ fun suspendLambda1(param: MySuspendLambdaAlias1): MySuspendLambdaAlias1 = TODO()
+ fun suspendLambda2(param: MySuspendLambdaAlias2): MySuspendLambdaAlias2 = TODO()
+ fun suspendLambda3(param: MySuspendLambdaAlias3): MySuspendLambdaAlias3 = TODO()
+ fun suspendLambda4(param: MySuspendLambdaAlias4): MySuspendLambdaAlias4 = TODO()
+ fun suspendLambda5(param: MySuspendLambdaAlias5): MySuspendLambdaAlias5 = TODO()
+ fun suspendLambda6(param: MySuspendLambdaAlias6): MySuspendLambdaAlias6 = TODO()
+ fun suspendLambda7(param: MySuspendLambdaAlias7): MySuspendLambdaAlias7 = TODO()
+ @JSW fun suspendLambda1WithJSW(param: MySuspendLambdaAlias1): MySuspendLambdaAlias1 = TODO()
+ @JSW fun suspendLambda2WithJSW(param: MySuspendLambdaAlias2): MySuspendLambdaAlias2 = TODO()
+ @JSW fun suspendLambda3WithJSW(param: MySuspendLambdaAlias3): MySuspendLambdaAlias3 = TODO()
+ @JSW fun suspendLambda4WithJSW(param: MySuspendLambdaAlias4): MySuspendLambdaAlias4 = TODO()
+ @JSW fun suspendLambda5WithJSW(param: MySuspendLambdaAlias5): MySuspendLambdaAlias5 = TODO()
+ @JSW fun suspendLambda6WithJSW(param: MySuspendLambdaAlias6): MySuspendLambdaAlias6 = TODO()
+ @JSW fun suspendLambda7WithJSW(param: MySuspendLambdaAlias7): MySuspendLambdaAlias7 = TODO()
}
""".trimIndent()
), listOf(className)
diff --git a/room/room-gradle-plugin/src/test/test-data/flavored-project/src/main/AndroidManifest.xml b/room/room-gradle-plugin/src/test/test-data/flavored-project/src/main/AndroidManifest.xml
deleted file mode 100644
index 1e3e702..0000000
--- a/room/room-gradle-plugin/src/test/test-data/flavored-project/src/main/AndroidManifest.xml
+++ /dev/null
@@ -1,17 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
- Copyright 2023 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.
- -->
-<manifest/>
\ No newline at end of file
diff --git a/room/room-gradle-plugin/src/test/test-data/simple-project/src/main/AndroidManifest.xml b/room/room-gradle-plugin/src/test/test-data/simple-project/src/main/AndroidManifest.xml
deleted file mode 100644
index 1e3e702..0000000
--- a/room/room-gradle-plugin/src/test/test-data/simple-project/src/main/AndroidManifest.xml
+++ /dev/null
@@ -1,17 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
- Copyright 2023 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.
- -->
-<manifest/>
\ No newline at end of file
diff --git a/savedstate/savedstate-ktx/src/main/AndroidManifest.xml b/savedstate/savedstate-ktx/src/main/AndroidManifest.xml
deleted file mode 100644
index ee19b21..0000000
--- a/savedstate/savedstate-ktx/src/main/AndroidManifest.xml
+++ /dev/null
@@ -1,16 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 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.
--->
-<manifest />
diff --git a/slice/slice-builders-ktx/src/main/AndroidManifest.xml b/slice/slice-builders-ktx/src/main/AndroidManifest.xml
deleted file mode 100644
index dd3d3a3..0000000
--- a/slice/slice-builders-ktx/src/main/AndroidManifest.xml
+++ /dev/null
@@ -1,16 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2018 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.
--->
-<manifest />
diff --git a/slice/slice-builders/src/main/AndroidManifest.xml b/slice/slice-builders/src/main/AndroidManifest.xml
deleted file mode 100644
index 95c4426..0000000
--- a/slice/slice-builders/src/main/AndroidManifest.xml
+++ /dev/null
@@ -1,16 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2017 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.
--->
-<manifest />
diff --git a/slice/slice-remotecallback/src/main/AndroidManifest.xml b/slice/slice-remotecallback/src/main/AndroidManifest.xml
deleted file mode 100644
index dcf3758..0000000
--- a/slice/slice-remotecallback/src/main/AndroidManifest.xml
+++ /dev/null
@@ -1,17 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
- <!-- Copyright (C) 2019 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.
- -->
- <manifest />
-
diff --git a/slice/slice-view/src/main/AndroidManifest.xml b/slice/slice-view/src/main/AndroidManifest.xml
deleted file mode 100644
index 6f49e23..0000000
--- a/slice/slice-view/src/main/AndroidManifest.xml
+++ /dev/null
@@ -1,16 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2014 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.
--->
-<manifest />
diff --git a/slidingpanelayout/slidingpanelayout/src/main/AndroidManifest.xml b/slidingpanelayout/slidingpanelayout/src/main/AndroidManifest.xml
deleted file mode 100644
index 6f49e23..0000000
--- a/slidingpanelayout/slidingpanelayout/src/main/AndroidManifest.xml
+++ /dev/null
@@ -1,16 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2014 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.
--->
-<manifest />
diff --git a/sqlite/sqlite-inspection/src/androidTest/AndroidManifest.xml b/sqlite/sqlite-inspection/src/androidTest/AndroidManifest.xml
deleted file mode 100644
index e95a361..0000000
--- a/sqlite/sqlite-inspection/src/androidTest/AndroidManifest.xml
+++ /dev/null
@@ -1,17 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright 2019 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.
--->
-
-<manifest />
diff --git a/sqlite/sqlite-inspection/src/main/AndroidManifest.xml b/sqlite/sqlite-inspection/src/main/AndroidManifest.xml
deleted file mode 100644
index e95a361..0000000
--- a/sqlite/sqlite-inspection/src/main/AndroidManifest.xml
+++ /dev/null
@@ -1,17 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright 2019 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.
--->
-
-<manifest />
diff --git a/sqlite/sqlite-ktx/src/main/AndroidManifest.xml b/sqlite/sqlite-ktx/src/main/AndroidManifest.xml
deleted file mode 100644
index 29b496b..0000000
--- a/sqlite/sqlite-ktx/src/main/AndroidManifest.xml
+++ /dev/null
@@ -1,17 +0,0 @@
-<!--
- ~ Copyright (C) 2018 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.
- -->
-
-<manifest />
diff --git a/swiperefreshlayout/swiperefreshlayout/src/main/AndroidManifest.xml b/swiperefreshlayout/swiperefreshlayout/src/main/AndroidManifest.xml
deleted file mode 100644
index 6f49e23..0000000
--- a/swiperefreshlayout/swiperefreshlayout/src/main/AndroidManifest.xml
+++ /dev/null
@@ -1,16 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2014 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.
--->
-<manifest />
diff --git a/test/screenshot/screenshot/src/main/AndroidManifest.xml b/test/screenshot/screenshot/src/main/AndroidManifest.xml
deleted file mode 100644
index 61b6811..0000000
--- a/test/screenshot/screenshot/src/main/AndroidManifest.xml
+++ /dev/null
@@ -1,17 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
- Copyright 2019 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.
- -->
-<manifest />
diff --git a/test/uiautomator/integration-tests/testapp/src/androidTest/java/androidx/test/uiautomator/testapp/UiDeviceTest.java b/test/uiautomator/integration-tests/testapp/src/androidTest/java/androidx/test/uiautomator/testapp/UiDeviceTest.java
index aa246e1..0e7dd93 100644
--- a/test/uiautomator/integration-tests/testapp/src/androidTest/java/androidx/test/uiautomator/testapp/UiDeviceTest.java
+++ b/test/uiautomator/integration-tests/testapp/src/androidTest/java/androidx/test/uiautomator/testapp/UiDeviceTest.java
@@ -354,6 +354,7 @@
}
@Test
+ @Ignore("b/280669851")
public void testSetOrientationLeft() throws Exception {
launchTestActivity(KeycodeTestActivity.class);
try {
@@ -372,6 +373,7 @@
}
@Test
+ @Ignore("b/280669851")
public void testSetOrientationRight() throws Exception {
launchTestActivity(KeycodeTestActivity.class);
try {
@@ -401,6 +403,7 @@
}
@Test
+ @Ignore("b/280669851")
public void testSetOrientationLandscape() throws Exception {
launchTestActivity(KeycodeTestActivity.class);
try {
diff --git a/test/uiautomator/uiautomator/src/main/AndroidManifest.xml b/test/uiautomator/uiautomator/src/main/AndroidManifest.xml
deleted file mode 100644
index 6f49e23..0000000
--- a/test/uiautomator/uiautomator/src/main/AndroidManifest.xml
+++ /dev/null
@@ -1,16 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2014 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.
--->
-<manifest />
diff --git a/testutils/testutils-appcompat/src/main/AndroidManifest.xml b/testutils/testutils-appcompat/src/main/AndroidManifest.xml
deleted file mode 100644
index 61b6811..0000000
--- a/testutils/testutils-appcompat/src/main/AndroidManifest.xml
+++ /dev/null
@@ -1,17 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
- Copyright 2019 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.
- -->
-<manifest />
diff --git a/testutils/testutils-espresso/src/main/AndroidManifest.xml b/testutils/testutils-espresso/src/main/AndroidManifest.xml
deleted file mode 100644
index 61b6811..0000000
--- a/testutils/testutils-espresso/src/main/AndroidManifest.xml
+++ /dev/null
@@ -1,17 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
- Copyright 2019 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.
- -->
-<manifest />
diff --git a/testutils/testutils-fonts/src/androidMain/AndroidManifest.xml b/testutils/testutils-fonts/src/androidMain/AndroidManifest.xml
deleted file mode 100644
index ee19b21..0000000
--- a/testutils/testutils-fonts/src/androidMain/AndroidManifest.xml
+++ /dev/null
@@ -1,16 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 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.
--->
-<manifest />
diff --git a/testutils/testutils-macrobenchmark/src/main/AndroidManifest.xml b/testutils/testutils-macrobenchmark/src/main/AndroidManifest.xml
deleted file mode 100644
index 3c3c224..0000000
--- a/testutils/testutils-macrobenchmark/src/main/AndroidManifest.xml
+++ /dev/null
@@ -1,17 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
- Copyright 2021 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.
- -->
-<manifest />
diff --git a/testutils/testutils-mockito/src/main/AndroidManifest.xml b/testutils/testutils-mockito/src/main/AndroidManifest.xml
deleted file mode 100644
index 9cd4123..0000000
--- a/testutils/testutils-mockito/src/main/AndroidManifest.xml
+++ /dev/null
@@ -1,17 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
- 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.
- -->
-<manifest />
diff --git a/testutils/testutils-runtime/src/main/AndroidManifest.xml b/testutils/testutils-runtime/src/main/AndroidManifest.xml
deleted file mode 100644
index c7003d8..0000000
--- a/testutils/testutils-runtime/src/main/AndroidManifest.xml
+++ /dev/null
@@ -1,17 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
- ~ Copyright (C) 2017 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.
- -->
-<manifest />
diff --git a/text/text/src/androidTest/AndroidManifest.xml b/text/text/src/androidTest/AndroidManifest.xml
deleted file mode 100644
index 7535bfb..0000000
--- a/text/text/src/androidTest/AndroidManifest.xml
+++ /dev/null
@@ -1,17 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
- ~ Copyright 2018 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.
- -->
-<manifest />
diff --git a/text/text/src/main/AndroidManifest.xml b/text/text/src/main/AndroidManifest.xml
deleted file mode 100644
index 7535bfb..0000000
--- a/text/text/src/main/AndroidManifest.xml
+++ /dev/null
@@ -1,17 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
- ~ Copyright 2018 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.
- -->
-<manifest />
diff --git a/tracing/tracing/src/androidTest/java/androidx/tracing/TraceTest.java b/tracing/tracing/src/androidTest/java/androidx/tracing/TraceTest.java
index 1e55554..08ea852 100644
--- a/tracing/tracing/src/androidTest/java/androidx/tracing/TraceTest.java
+++ b/tracing/tracing/src/androidTest/java/androidx/tracing/TraceTest.java
@@ -37,6 +37,7 @@
import org.junit.After;
import org.junit.Before;
+import org.junit.Ignore;
import org.junit.Test;
import java.io.ByteArrayOutputStream;
@@ -68,6 +69,7 @@
}
@Test
+ @Ignore("b/280041271")
public void beginAndEndSection() throws IOException {
startTrace();
Trace.beginSection("beginAndEndSection");
@@ -79,6 +81,7 @@
}
@Test
+ @Ignore("b/280041271")
public void beginAndEndTraceSectionLongLabel() throws IOException {
StringBuilder builder = new StringBuilder();
for (int i = 0; i < 20; i++) {
@@ -120,6 +123,7 @@
}
@Test
+ @Ignore("b/280041271")
public void isEnabledDuringTrace() throws IOException {
startTrace();
boolean enabled = Trace.isEnabled();
diff --git a/transition/transition-ktx/src/main/AndroidManifest.xml b/transition/transition-ktx/src/main/AndroidManifest.xml
deleted file mode 100644
index 61b6811..0000000
--- a/transition/transition-ktx/src/main/AndroidManifest.xml
+++ /dev/null
@@ -1,17 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
- Copyright 2019 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.
- -->
-<manifest />
diff --git a/transition/transition/src/main/AndroidManifest.xml b/transition/transition/src/main/AndroidManifest.xml
deleted file mode 100644
index 6136621..0000000
--- a/transition/transition/src/main/AndroidManifest.xml
+++ /dev/null
@@ -1,16 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2016 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.
--->
-<manifest />
diff --git a/tv/tv-foundation/src/main/java/androidx/tv/foundation/lazy/grid/LazyGridItemProvider.kt b/tv/tv-foundation/src/main/java/androidx/tv/foundation/lazy/grid/LazyGridItemProvider.kt
index b9589a3..c310814 100644
--- a/tv/tv-foundation/src/main/java/androidx/tv/foundation/lazy/grid/LazyGridItemProvider.kt
+++ b/tv/tv-foundation/src/main/java/androidx/tv/foundation/lazy/grid/LazyGridItemProvider.kt
@@ -18,7 +18,7 @@
import androidx.compose.foundation.ExperimentalFoundationApi
import androidx.compose.foundation.lazy.layout.LazyLayoutItemProvider
-import androidx.compose.foundation.lazy.layout.PinnableItem
+import androidx.compose.foundation.lazy.layout.LazyLayoutPinnableItem
import androidx.compose.runtime.Composable
import androidx.compose.runtime.derivedStateOf
import androidx.compose.runtime.getValue
@@ -66,10 +66,10 @@
override fun getContentType(index: Int): Any? = gridContent.getContentType(index)
@Composable
- override fun Item(index: Int) {
- gridContent.PinnableItem(index, state.pinnedItems) { localIndex ->
- with(TvLazyGridItemScopeImpl) {
- item(localIndex)
+ override fun Item(index: Int, key: Any) {
+ LazyLayoutPinnableItem(key, index, state.pinnedItems) {
+ gridContent.withInterval(index) { localIndex, content ->
+ content.item(TvLazyGridItemScopeImpl, localIndex)
}
}
}
diff --git a/tv/tv-foundation/src/main/java/androidx/tv/foundation/lazy/grid/LazyGridScrollPosition.kt b/tv/tv-foundation/src/main/java/androidx/tv/foundation/lazy/grid/LazyGridScrollPosition.kt
index b787f26..f713db2 100644
--- a/tv/tv-foundation/src/main/java/androidx/tv/foundation/lazy/grid/LazyGridScrollPosition.kt
+++ b/tv/tv-foundation/src/main/java/androidx/tv/foundation/lazy/grid/LazyGridScrollPosition.kt
@@ -18,6 +18,7 @@
import androidx.compose.foundation.ExperimentalFoundationApi
import androidx.compose.runtime.getValue
+import androidx.compose.runtime.mutableIntStateOf
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.setValue
import androidx.compose.runtime.snapshots.Snapshot
@@ -35,7 +36,7 @@
var index by mutableStateOf(ItemIndex(initialIndex))
private set
- var scrollOffset by mutableStateOf(initialScrollOffset)
+ var scrollOffset by mutableIntStateOf(initialScrollOffset)
private set
private var hadFirstNotEmptyLayout = false
diff --git a/tv/tv-foundation/src/main/java/androidx/tv/foundation/lazy/grid/TvLazyGridState.kt b/tv/tv-foundation/src/main/java/androidx/tv/foundation/lazy/grid/TvLazyGridState.kt
index 3d9873f..037afba 100644
--- a/tv/tv-foundation/src/main/java/androidx/tv/foundation/lazy/grid/TvLazyGridState.kt
+++ b/tv/tv-foundation/src/main/java/androidx/tv/foundation/lazy/grid/TvLazyGridState.kt
@@ -29,6 +29,7 @@
import androidx.compose.runtime.Stable
import androidx.compose.runtime.collection.mutableVectorOf
import androidx.compose.runtime.getValue
+import androidx.compose.runtime.mutableIntStateOf
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.saveable.Saver
import androidx.compose.runtime.saveable.listSaver
@@ -135,7 +136,7 @@
/**
* Needed for [animateScrollToItem]. Updated on every measure.
*/
- internal var slotsPerLine: Int by mutableStateOf(0)
+ internal var slotsPerLine: Int by mutableIntStateOf(0)
/**
* Needed for [animateScrollToItem]. Updated on every measure.
diff --git a/tv/tv-foundation/src/main/java/androidx/tv/foundation/lazy/list/LazyListItemProvider.kt b/tv/tv-foundation/src/main/java/androidx/tv/foundation/lazy/list/LazyListItemProvider.kt
index 2780fac..d50cd62 100644
--- a/tv/tv-foundation/src/main/java/androidx/tv/foundation/lazy/list/LazyListItemProvider.kt
+++ b/tv/tv-foundation/src/main/java/androidx/tv/foundation/lazy/list/LazyListItemProvider.kt
@@ -18,7 +18,7 @@
import androidx.compose.foundation.ExperimentalFoundationApi
import androidx.compose.foundation.lazy.layout.LazyLayoutItemProvider
-import androidx.compose.foundation.lazy.layout.PinnableItem
+import androidx.compose.foundation.lazy.layout.LazyLayoutPinnableItem
import androidx.compose.runtime.Composable
import androidx.compose.runtime.derivedStateOf
import androidx.compose.runtime.getValue
@@ -67,9 +67,11 @@
override val itemCount: Int get() = listContent.itemCount
@Composable
- override fun Item(index: Int) {
- listContent.PinnableItem(index, state.pinnedItems) { localIndex ->
- with(itemScope) { item(localIndex) }
+ override fun Item(index: Int, key: Any) {
+ LazyLayoutPinnableItem(key, index, state.pinnedItems) {
+ listContent.withInterval(index) { localIndex, content ->
+ content.item(itemScope, localIndex)
+ }
}
}
diff --git a/tv/tv-foundation/src/main/java/androidx/tv/foundation/lazy/list/LazyListScrollPosition.kt b/tv/tv-foundation/src/main/java/androidx/tv/foundation/lazy/list/LazyListScrollPosition.kt
index 20eb9e9..f1c7352 100644
--- a/tv/tv-foundation/src/main/java/androidx/tv/foundation/lazy/list/LazyListScrollPosition.kt
+++ b/tv/tv-foundation/src/main/java/androidx/tv/foundation/lazy/list/LazyListScrollPosition.kt
@@ -19,6 +19,7 @@
import androidx.compose.foundation.ExperimentalFoundationApi
import androidx.compose.foundation.lazy.layout.LazyLayoutItemProvider
import androidx.compose.runtime.getValue
+import androidx.compose.runtime.mutableIntStateOf
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.setValue
import androidx.compose.runtime.snapshots.Snapshot
@@ -34,7 +35,7 @@
) {
var index by mutableStateOf(DataIndex(initialIndex))
- var scrollOffset by mutableStateOf(initialScrollOffset)
+ var scrollOffset by mutableIntStateOf(initialScrollOffset)
private set
private var hadFirstNotEmptyLayout = false
diff --git a/tv/tv-material/src/main/java/androidx/tv/material3/Carousel.kt b/tv/tv-material/src/main/java/androidx/tv/material3/Carousel.kt
index 001aed4..5fbfc80c 100644
--- a/tv/tv-material/src/main/java/androidx/tv/material3/Carousel.kt
+++ b/tv/tv-material/src/main/java/androidx/tv/material3/Carousel.kt
@@ -38,6 +38,7 @@
import androidx.compose.runtime.LaunchedEffect
import androidx.compose.runtime.Stable
import androidx.compose.runtime.getValue
+import androidx.compose.runtime.mutableIntStateOf
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
import androidx.compose.runtime.rememberUpdatedState
@@ -339,12 +340,12 @@
@Stable
@ExperimentalTvMaterial3Api
class CarouselState(initialActiveItemIndex: Int = 0) {
- internal var activePauseHandlesCount by mutableStateOf(0)
+ internal var activePauseHandlesCount by mutableIntStateOf(0)
/**
* The index of the item that is currently displayed by the carousel
*/
- var activeItemIndex by mutableStateOf(initialActiveItemIndex)
+ var activeItemIndex by mutableIntStateOf(initialActiveItemIndex)
internal set
/**
diff --git a/tv/tv-material/src/main/java/androidx/tv/material3/ImmersiveList.kt b/tv/tv-material/src/main/java/androidx/tv/material3/ImmersiveList.kt
index f55c49d..e10af5a 100644
--- a/tv/tv-material/src/main/java/androidx/tv/material3/ImmersiveList.kt
+++ b/tv/tv-material/src/main/java/androidx/tv/material3/ImmersiveList.kt
@@ -30,6 +30,7 @@
import androidx.compose.runtime.Composable
import androidx.compose.runtime.Immutable
import androidx.compose.runtime.getValue
+import androidx.compose.runtime.mutableIntStateOf
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
import androidx.compose.runtime.setValue
@@ -66,7 +67,7 @@
listAlignment: Alignment = Alignment.BottomEnd,
list: @Composable ImmersiveListScope.() -> Unit,
) {
- var currentItemIndex by remember { mutableStateOf(0) }
+ var currentItemIndex by remember { mutableIntStateOf(0) }
var listHasFocus by remember { mutableStateOf(false) }
Box(modifier.bringIntoViewIfChildrenAreFocused()) {
diff --git a/vectordrawable/vectordrawable-animated/src/main/AndroidManifest.xml b/vectordrawable/vectordrawable-animated/src/main/AndroidManifest.xml
deleted file mode 100644
index 3bae3b9..0000000
--- a/vectordrawable/vectordrawable-animated/src/main/AndroidManifest.xml
+++ /dev/null
@@ -1,17 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
- Copyright (C) 2015 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.
- -->
-<manifest />
diff --git a/vectordrawable/vectordrawable-seekable/src/androidTest/AndroidManifest.xml b/vectordrawable/vectordrawable-seekable/src/androidTest/AndroidManifest.xml
deleted file mode 100644
index 4de3d50..0000000
--- a/vectordrawable/vectordrawable-seekable/src/androidTest/AndroidManifest.xml
+++ /dev/null
@@ -1,17 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
- ~ Copyright (C) 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.
--->
-<manifest />
diff --git a/vectordrawable/vectordrawable-seekable/src/main/AndroidManifest.xml b/vectordrawable/vectordrawable-seekable/src/main/AndroidManifest.xml
deleted file mode 100644
index 4de3d50..0000000
--- a/vectordrawable/vectordrawable-seekable/src/main/AndroidManifest.xml
+++ /dev/null
@@ -1,17 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
- ~ Copyright (C) 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.
--->
-<manifest />
diff --git a/vectordrawable/vectordrawable/src/main/AndroidManifest.xml b/vectordrawable/vectordrawable/src/main/AndroidManifest.xml
deleted file mode 100644
index 3bae3b9..0000000
--- a/vectordrawable/vectordrawable/src/main/AndroidManifest.xml
+++ /dev/null
@@ -1,17 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
- Copyright (C) 2015 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.
- -->
-<manifest />
diff --git a/viewpager/viewpager/src/main/AndroidManifest.xml b/viewpager/viewpager/src/main/AndroidManifest.xml
deleted file mode 100644
index dd3d3a3..0000000
--- a/viewpager/viewpager/src/main/AndroidManifest.xml
+++ /dev/null
@@ -1,16 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2018 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.
--->
-<manifest />
diff --git a/viewpager2/integration-tests/targetsdk-tests/src/main/AndroidManifest.xml b/viewpager2/integration-tests/targetsdk-tests/src/main/AndroidManifest.xml
deleted file mode 100644
index a270226..0000000
--- a/viewpager2/integration-tests/targetsdk-tests/src/main/AndroidManifest.xml
+++ /dev/null
@@ -1,17 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright 2021 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.
--->
-
-<manifest />
\ No newline at end of file
diff --git a/viewpager2/viewpager2/src/androidTest/java/androidx/viewpager2/widget/FakeDragTest.kt b/viewpager2/viewpager2/src/androidTest/java/androidx/viewpager2/widget/FakeDragTest.kt
index 79e4f0d..b3e2d09 100644
--- a/viewpager2/viewpager2/src/androidTest/java/androidx/viewpager2/widget/FakeDragTest.kt
+++ b/viewpager2/viewpager2/src/androidTest/java/androidx/viewpager2/widget/FakeDragTest.kt
@@ -42,6 +42,7 @@
import org.hamcrest.Matchers.greaterThan
import org.hamcrest.MatcherAssert.assertThat
import org.junit.Assume.assumeThat
+import org.junit.Ignore
import org.junit.Test
import org.junit.runner.RunWith
import org.junit.runners.Parameterized
@@ -128,6 +129,7 @@
}
@Test
+ @Ignore("b/280670752")
fun test_peekNextAndMoveBack() {
// Roughly interpolates like this:
// |
diff --git a/viewpager2/viewpager2/src/main/AndroidManifest.xml b/viewpager2/viewpager2/src/main/AndroidManifest.xml
deleted file mode 100644
index b6d5627..0000000
--- a/viewpager2/viewpager2/src/main/AndroidManifest.xml
+++ /dev/null
@@ -1,17 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright 2017 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.
--->
-
-<manifest />
\ No newline at end of file
diff --git a/wear/benchmark/integration-tests/macrobenchmark/src/androidTest/AndroidManifest.xml b/wear/benchmark/integration-tests/macrobenchmark/src/androidTest/AndroidManifest.xml
deleted file mode 100644
index e0788d6..0000000
--- a/wear/benchmark/integration-tests/macrobenchmark/src/androidTest/AndroidManifest.xml
+++ /dev/null
@@ -1,18 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
- Copyright 2021 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.
- -->
-
-<manifest />
diff --git a/wear/benchmark/integration-tests/macrobenchmark/src/main/AndroidManifest.xml b/wear/benchmark/integration-tests/macrobenchmark/src/main/AndroidManifest.xml
deleted file mode 100644
index f734545..0000000
--- a/wear/benchmark/integration-tests/macrobenchmark/src/main/AndroidManifest.xml
+++ /dev/null
@@ -1,18 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
- Copyright 2021 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.
- -->
-
-<manifest />
\ No newline at end of file
diff --git a/wear/compose/compose-foundation/benchmark/src/androidTest/AndroidManifest.xml b/wear/compose/compose-foundation/benchmark/src/androidTest/AndroidManifest.xml
deleted file mode 100644
index 39f7fc3..0000000
--- a/wear/compose/compose-foundation/benchmark/src/androidTest/AndroidManifest.xml
+++ /dev/null
@@ -1,17 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
- Copyright 2021 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.
- -->
-<manifest />
\ No newline at end of file
diff --git a/wear/compose/compose-foundation/src/androidMain/AndroidManifest.xml b/wear/compose/compose-foundation/src/androidMain/AndroidManifest.xml
deleted file mode 100644
index e0788d6..0000000
--- a/wear/compose/compose-foundation/src/androidMain/AndroidManifest.xml
+++ /dev/null
@@ -1,18 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
- Copyright 2021 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.
- -->
-
-<manifest />
diff --git a/wear/compose/compose-foundation/src/androidMain/kotlin/androidx/wear/compose/foundation/CurvedTextDelegate.android.kt b/wear/compose/compose-foundation/src/androidMain/kotlin/androidx/wear/compose/foundation/CurvedTextDelegate.android.kt
index d781ba1..fcc21e2 100644
--- a/wear/compose/compose-foundation/src/androidMain/kotlin/androidx/wear/compose/foundation/CurvedTextDelegate.android.kt
+++ b/wear/compose/compose-foundation/src/androidMain/kotlin/androidx/wear/compose/foundation/CurvedTextDelegate.android.kt
@@ -24,6 +24,7 @@
import androidx.compose.runtime.State
import androidx.compose.runtime.derivedStateOf
import androidx.compose.runtime.getValue
+import androidx.compose.runtime.mutableFloatStateOf
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
import androidx.compose.runtime.setValue
@@ -50,8 +51,8 @@
private var clockwise: Boolean = true
private var fontSizePx: Float = 0f
- actual var textWidth by mutableStateOf(0f)
- actual var textHeight by mutableStateOf(0f)
+ actual var textWidth by mutableFloatStateOf(0f)
+ actual var textHeight by mutableFloatStateOf(0f)
actual var baseLinePosition = 0f
private var typeFace: State<Typeface?> = mutableStateOf(null)
diff --git a/wear/compose/compose-foundation/src/commonMain/kotlin/androidx/wear/compose/foundation/SwipeToReveal.kt b/wear/compose/compose-foundation/src/commonMain/kotlin/androidx/wear/compose/foundation/SwipeToReveal.kt
index 50764ab..724c367 100644
--- a/wear/compose/compose-foundation/src/commonMain/kotlin/androidx/wear/compose/foundation/SwipeToReveal.kt
+++ b/wear/compose/compose-foundation/src/commonMain/kotlin/androidx/wear/compose/foundation/SwipeToReveal.kt
@@ -32,7 +32,7 @@
import androidx.compose.runtime.LaunchedEffect
import androidx.compose.runtime.derivedStateOf
import androidx.compose.runtime.getValue
-import androidx.compose.runtime.mutableStateOf
+import androidx.compose.runtime.mutableFloatStateOf
import androidx.compose.runtime.remember
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
@@ -360,7 +360,7 @@
/**
* The total width of the overlay content in float.
*/
- val width = mutableStateOf(0.0f)
+ val width = mutableFloatStateOf(0.0f)
override val revealOffset: Float
get() = width.value * (revealState.swipeAnchors[RevealValue.Revealing] ?: 0.0f)
diff --git a/wear/compose/compose-foundation/src/commonMain/kotlin/androidx/wear/compose/foundation/SwipeableV2.kt b/wear/compose/compose-foundation/src/commonMain/kotlin/androidx/wear/compose/foundation/SwipeableV2.kt
index 788ff21..273c59b 100644
--- a/wear/compose/compose-foundation/src/commonMain/kotlin/androidx/wear/compose/foundation/SwipeableV2.kt
+++ b/wear/compose/compose-foundation/src/commonMain/kotlin/androidx/wear/compose/foundation/SwipeableV2.kt
@@ -32,6 +32,7 @@
import androidx.compose.runtime.Stable
import androidx.compose.runtime.derivedStateOf
import androidx.compose.runtime.getValue
+import androidx.compose.runtime.mutableFloatStateOf
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.saveable.Saver
import androidx.compose.runtime.saveable.rememberSaveable
@@ -273,7 +274,7 @@
* You can use this value to provide smooth reconciliation behavior when re-targeting an
* animation.
*/
- var lastVelocity: Float by mutableStateOf(0f)
+ var lastVelocity: Float by mutableFloatStateOf(0f)
private set
/**
diff --git a/wear/compose/compose-material-core/src/androidMain/AndroidManifest.xml b/wear/compose/compose-material-core/src/androidMain/AndroidManifest.xml
deleted file mode 100644
index e0788d6..0000000
--- a/wear/compose/compose-material-core/src/androidMain/AndroidManifest.xml
+++ /dev/null
@@ -1,18 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
- Copyright 2021 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.
- -->
-
-<manifest />
diff --git a/wear/compose/compose-material/benchmark/src/androidTest/AndroidManifest.xml b/wear/compose/compose-material/benchmark/src/androidTest/AndroidManifest.xml
deleted file mode 100644
index 39f7fc3..0000000
--- a/wear/compose/compose-material/benchmark/src/androidTest/AndroidManifest.xml
+++ /dev/null
@@ -1,17 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
- Copyright 2021 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.
- -->
-<manifest />
\ No newline at end of file
diff --git a/wear/compose/compose-material/samples/src/androidTest/AndroidManifest.xml b/wear/compose/compose-material/samples/src/androidTest/AndroidManifest.xml
deleted file mode 100644
index 8e90956..0000000
--- a/wear/compose/compose-material/samples/src/androidTest/AndroidManifest.xml
+++ /dev/null
@@ -1,17 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
- Copyright 2022 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.
- -->
-<manifest />
diff --git a/wear/compose/compose-material/src/androidMain/AndroidManifest.xml b/wear/compose/compose-material/src/androidMain/AndroidManifest.xml
deleted file mode 100644
index e0788d6..0000000
--- a/wear/compose/compose-material/src/androidMain/AndroidManifest.xml
+++ /dev/null
@@ -1,18 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
- Copyright 2021 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.
- -->
-
-<manifest />
diff --git a/wear/compose/compose-material/src/androidMain/kotlin/androidx/wear/compose/material/DefaultTimeSource.kt b/wear/compose/compose-material/src/androidMain/kotlin/androidx/wear/compose/material/DefaultTimeSource.kt
index 5f3393d..9ee204f 100644
--- a/wear/compose/compose-material/src/androidMain/kotlin/androidx/wear/compose/material/DefaultTimeSource.kt
+++ b/wear/compose/compose-material/src/androidMain/kotlin/androidx/wear/compose/material/DefaultTimeSource.kt
@@ -27,6 +27,7 @@
import androidx.compose.runtime.State
import androidx.compose.runtime.derivedStateOf
import androidx.compose.runtime.getValue
+import androidx.compose.runtime.mutableLongStateOf
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
import androidx.compose.runtime.rememberUpdatedState
@@ -50,7 +51,7 @@
): State<String> {
var calendar by remember { mutableStateOf(Calendar.getInstance()) }
- var currentTime by remember { mutableStateOf(time()) }
+ var currentTime by remember { mutableLongStateOf(time()) }
val timeText = remember {
derivedStateOf { formatTime(calendar, currentTime, timeFormat) }
diff --git a/wear/compose/compose-material/src/commonMain/kotlin/androidx/wear/compose/material/Picker.kt b/wear/compose/compose-material/src/commonMain/kotlin/androidx/wear/compose/material/Picker.kt
index 963051d..1615159 100644
--- a/wear/compose/compose-material/src/commonMain/kotlin/androidx/wear/compose/material/Picker.kt
+++ b/wear/compose/compose-material/src/commonMain/kotlin/androidx/wear/compose/material/Picker.kt
@@ -38,6 +38,7 @@
import androidx.compose.runtime.SideEffect
import androidx.compose.runtime.Stable
import androidx.compose.runtime.getValue
+import androidx.compose.runtime.mutableIntStateOf
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
import androidx.compose.runtime.rememberCoroutineScope
@@ -486,7 +487,7 @@
verifyNumberOfOptions(initialNumberOfOptions)
}
- private var _numberOfOptions by mutableStateOf(initialNumberOfOptions)
+ private var _numberOfOptions by mutableIntStateOf(initialNumberOfOptions)
var numberOfOptions
get() = _numberOfOptions
diff --git a/wear/compose/compose-material/src/commonMain/kotlin/androidx/wear/compose/material/PickerGroup.kt b/wear/compose/compose-material/src/commonMain/kotlin/androidx/wear/compose/material/PickerGroup.kt
index d31497f..6ddae0d4 100644
--- a/wear/compose/compose-material/src/commonMain/kotlin/androidx/wear/compose/material/PickerGroup.kt
+++ b/wear/compose/compose-material/src/commonMain/kotlin/androidx/wear/compose/material/PickerGroup.kt
@@ -25,7 +25,7 @@
import androidx.compose.foundation.layout.BoxScope
import androidx.compose.runtime.Composable
import androidx.compose.runtime.getValue
-import androidx.compose.runtime.mutableStateOf
+import androidx.compose.runtime.mutableIntStateOf
import androidx.compose.runtime.saveable.listSaver
import androidx.compose.runtime.saveable.rememberSaveable
import androidx.compose.runtime.setValue
@@ -199,7 +199,7 @@
/**
* The current selected [Picker] index.
*/
- var selectedIndex by mutableStateOf(initiallySelectedIndex)
+ var selectedIndex by mutableIntStateOf(initiallySelectedIndex)
public companion object {
val Saver = listSaver<PickerGroupState, Any?>(
diff --git a/wear/compose/compose-material/src/commonMain/kotlin/androidx/wear/compose/material/SwipeToDismissBox.kt b/wear/compose/compose-material/src/commonMain/kotlin/androidx/wear/compose/material/SwipeToDismissBox.kt
index ed29bf9..5430358 100644
--- a/wear/compose/compose-material/src/commonMain/kotlin/androidx/wear/compose/material/SwipeToDismissBox.kt
+++ b/wear/compose/compose-material/src/commonMain/kotlin/androidx/wear/compose/material/SwipeToDismissBox.kt
@@ -32,6 +32,7 @@
import androidx.compose.runtime.derivedStateOf
import androidx.compose.runtime.getValue
import androidx.compose.runtime.key
+import androidx.compose.runtime.mutableFloatStateOf
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
import androidx.compose.runtime.setValue
@@ -108,7 +109,7 @@
) {
// Will be updated in onSizeChanged, initialise to any value other than zero
// so that it is different to the other anchor used for the swipe gesture.
- var maxWidth by remember { mutableStateOf(1f) }
+ var maxWidth by remember { mutableFloatStateOf(1f) }
Box(
modifier = modifier
.fillMaxSize()
diff --git a/wear/compose/compose-material/src/commonMain/kotlin/androidx/wear/compose/material/Swipeable.kt b/wear/compose/compose-material/src/commonMain/kotlin/androidx/wear/compose/material/Swipeable.kt
index 52ed98b..9a6fda0 100644
--- a/wear/compose/compose-material/src/commonMain/kotlin/androidx/wear/compose/material/Swipeable.kt
+++ b/wear/compose/compose-material/src/commonMain/kotlin/androidx/wear/compose/material/Swipeable.kt
@@ -203,7 +203,7 @@
internal var thresholds: (Float, Float) -> Float by mutableStateOf({ _, _ -> 0f })
- internal var velocityThreshold by mutableStateOf(0f)
+ internal var velocityThreshold by mutableFloatStateOf(0f)
internal var resistance: ResistanceConfig? by mutableStateOf(null)
diff --git a/wear/compose/compose-material3/src/androidMain/AndroidManifest.xml b/wear/compose/compose-material3/src/androidMain/AndroidManifest.xml
deleted file mode 100644
index e0788d6..0000000
--- a/wear/compose/compose-material3/src/androidMain/AndroidManifest.xml
+++ /dev/null
@@ -1,18 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
- Copyright 2021 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.
- -->
-
-<manifest />
diff --git a/wear/compose/compose-navigation/src/androidTest/AndroidManifest.xml b/wear/compose/compose-navigation/src/androidTest/AndroidManifest.xml
deleted file mode 100644
index 3c3c224..0000000
--- a/wear/compose/compose-navigation/src/androidTest/AndroidManifest.xml
+++ /dev/null
@@ -1,17 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
- Copyright 2021 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.
- -->
-<manifest />
diff --git a/wear/compose/compose-navigation/src/main/AndroidManifest.xml b/wear/compose/compose-navigation/src/main/AndroidManifest.xml
deleted file mode 100644
index e0788d6..0000000
--- a/wear/compose/compose-navigation/src/main/AndroidManifest.xml
+++ /dev/null
@@ -1,18 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
- Copyright 2021 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.
- -->
-
-<manifest />
diff --git a/wear/compose/integration-tests/demos/src/androidTest/AndroidManifest.xml b/wear/compose/integration-tests/demos/src/androidTest/AndroidManifest.xml
deleted file mode 100644
index e865f27..0000000
--- a/wear/compose/integration-tests/demos/src/androidTest/AndroidManifest.xml
+++ /dev/null
@@ -1,17 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
- ~ Copyright 2021 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.
- -->
-<manifest />
diff --git a/wear/compose/integration-tests/demos/src/main/java/androidx/wear/compose/integration/demos/HorizontalPageIndicatorDemo.kt b/wear/compose/integration-tests/demos/src/main/java/androidx/wear/compose/integration/demos/HorizontalPageIndicatorDemo.kt
index 24fa8b8..163277e 100644
--- a/wear/compose/integration-tests/demos/src/main/java/androidx/wear/compose/integration/demos/HorizontalPageIndicatorDemo.kt
+++ b/wear/compose/integration-tests/demos/src/main/java/androidx/wear/compose/integration/demos/HorizontalPageIndicatorDemo.kt
@@ -24,7 +24,7 @@
import androidx.compose.foundation.shape.GenericShape
import androidx.compose.runtime.Composable
import androidx.compose.runtime.getValue
-import androidx.compose.runtime.mutableStateOf
+import androidx.compose.runtime.mutableIntStateOf
import androidx.compose.runtime.remember
import androidx.compose.runtime.setValue
import androidx.compose.ui.Alignment
@@ -37,7 +37,7 @@
@Composable
fun CustomizedHorizontalPageIndicator() {
val maxPages = 6
- var selectedPage by remember { mutableStateOf(0) }
+ var selectedPage by remember { mutableIntStateOf(0) }
val animatedSelectedPage by animateFloatAsState(
targetValue = selectedPage.toFloat(),
animationSpec = TweenSpec(durationMillis = 500)
diff --git a/wear/compose/integration-tests/demos/src/main/java/androidx/wear/compose/integration/demos/PositionIndicatorDemos.kt b/wear/compose/integration-tests/demos/src/main/java/androidx/wear/compose/integration/demos/PositionIndicatorDemos.kt
index d8f3599..27633f6 100644
--- a/wear/compose/integration-tests/demos/src/main/java/androidx/wear/compose/integration/demos/PositionIndicatorDemos.kt
+++ b/wear/compose/integration-tests/demos/src/main/java/androidx/wear/compose/integration/demos/PositionIndicatorDemos.kt
@@ -32,6 +32,8 @@
import androidx.compose.runtime.CompositionLocalProvider
import androidx.compose.runtime.State
import androidx.compose.runtime.getValue
+import androidx.compose.runtime.mutableFloatStateOf
+import androidx.compose.runtime.mutableIntStateOf
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
import androidx.compose.runtime.setValue
@@ -109,9 +111,9 @@
@Composable
fun ControllablePositionIndicator() {
- val position = remember { mutableStateOf(0.2f) }
- val size = remember { mutableStateOf(0.5f) }
- var alignment by remember { mutableStateOf(0) }
+ val position = remember { mutableFloatStateOf(0.2f) }
+ val size = remember { mutableFloatStateOf(0.5f) }
+ var alignment by remember { mutableIntStateOf(0) }
var reverseDirection by remember { mutableStateOf(false) }
var layoutDirection by remember { mutableStateOf(false) }
val actualLayoutDirection =
@@ -148,17 +150,17 @@
Text("Position")
DefaultInlineSlider(
modifier = Modifier.height(40.dp),
- value = position.value,
+ value = position.floatValue,
valueRange = 0f..1f,
steps = 9,
- onValueChange = { position.value = it })
+ onValueChange = { position.floatValue = it })
Text("Size")
DefaultInlineSlider(
modifier = Modifier.height(40.dp),
- value = size.value,
+ value = size.floatValue,
valueRange = 0f..1f,
steps = 9,
- onValueChange = { size.value = it })
+ onValueChange = { size.floatValue = it })
Row(modifier = Modifier.align(Alignment.CenterHorizontally)) {
Button(onClick = { alignment = (alignment + 1) % 3 }) {
Text(alignmentNames[alignment])
@@ -186,10 +188,10 @@
@Composable
fun SharedPositionIndicator() {
val listStates = listOf(rememberScrollState(), rememberScrollState())
- val selected = remember { mutableStateOf(0) }
+ val selected = remember { mutableIntStateOf(0) }
Scaffold(
positionIndicator = {
- PositionIndicator(listStates[selected.value])
+ PositionIndicator(listStates[selected.intValue])
}
) {
Row(modifier = Modifier.fillMaxSize()) {
@@ -203,7 +205,7 @@
) {
repeat(10) {
Chip(
- onClick = { selected.value = listIndex },
+ onClick = { selected.intValue = listIndex },
label = { Text("#$it") }
)
}
diff --git a/wear/compose/integration-tests/demos/src/main/java/androidx/wear/compose/integration/demos/ProgressIndicatorDemo.kt b/wear/compose/integration-tests/demos/src/main/java/androidx/wear/compose/integration/demos/ProgressIndicatorDemo.kt
index 93789b3..23056f3 100644
--- a/wear/compose/integration-tests/demos/src/main/java/androidx/wear/compose/integration/demos/ProgressIndicatorDemo.kt
+++ b/wear/compose/integration-tests/demos/src/main/java/androidx/wear/compose/integration/demos/ProgressIndicatorDemo.kt
@@ -23,6 +23,7 @@
import androidx.compose.foundation.layout.wrapContentSize
import androidx.compose.runtime.Composable
import androidx.compose.runtime.getValue
+import androidx.compose.runtime.mutableFloatStateOf
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
import androidx.compose.runtime.rememberCoroutineScope
@@ -50,9 +51,9 @@
@Composable
public fun ProgressWithCustomAngles() {
- var startAngle by remember { mutableStateOf(292.5f) }
- var endAngle by remember { mutableStateOf(247.5f) }
- var progress by remember { mutableStateOf(0.5f) }
+ var startAngle by remember { mutableFloatStateOf(292.5f) }
+ var endAngle by remember { mutableFloatStateOf(247.5f) }
+ var progress by remember { mutableFloatStateOf(0.5f) }
val animatedProgress: Float by animateFloatAsState(targetValue = progress)
Box(modifier = Modifier.fillMaxSize(), contentAlignment = Alignment.Center) {
diff --git a/wear/compose/integration-tests/demos/src/main/java/androidx/wear/compose/integration/demos/SliderDemo.kt b/wear/compose/integration-tests/demos/src/main/java/androidx/wear/compose/integration/demos/SliderDemo.kt
index df5330a..8e038f0 100644
--- a/wear/compose/integration-tests/demos/src/main/java/androidx/wear/compose/integration/demos/SliderDemo.kt
+++ b/wear/compose/integration-tests/demos/src/main/java/androidx/wear/compose/integration/demos/SliderDemo.kt
@@ -23,6 +23,8 @@
import androidx.compose.runtime.Composable
import androidx.compose.runtime.CompositionLocalProvider
import androidx.compose.runtime.getValue
+import androidx.compose.runtime.mutableFloatStateOf
+import androidx.compose.runtime.mutableIntStateOf
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
import androidx.compose.runtime.setValue
@@ -42,8 +44,8 @@
@Composable
fun InlineSliderDemo() {
- var valueWithoutSegments by remember { mutableStateOf(5f) }
- var valueWithSegments by remember { mutableStateOf(2f) }
+ var valueWithoutSegments by remember { mutableFloatStateOf(5f) }
+ var valueWithSegments by remember { mutableFloatStateOf(2f) }
var enabled by remember { mutableStateOf(true) }
ScalingLazyColumnWithRSB(
@@ -99,8 +101,8 @@
@Composable
fun InlineSliderWithIntegersDemo() {
- var valueWithoutSegments by remember { mutableStateOf(5) }
- var valueWithSegments by remember { mutableStateOf(2) }
+ var valueWithoutSegments by remember { mutableIntStateOf(5) }
+ var valueWithSegments by remember { mutableIntStateOf(2) }
ScalingLazyColumnWithRSB(
horizontalAlignment = Alignment.CenterHorizontally,
@@ -140,7 +142,7 @@
@Composable
fun InlineSliderCustomColorsDemo() {
- var value by remember { mutableStateOf(4.5f) }
+ var value by remember { mutableFloatStateOf(4.5f) }
Box(
contentAlignment = Alignment.Center,
modifier = Modifier.fillMaxSize()
@@ -161,8 +163,8 @@
@Composable
fun InlineSliderSegmented() {
- var numberOfSegments by remember { mutableStateOf(5f) }
- var progress by remember { mutableStateOf(10f) }
+ var numberOfSegments by remember { mutableFloatStateOf(5f) }
+ var progress by remember { mutableFloatStateOf(10f) }
ScalingLazyColumnWithRSB(
horizontalAlignment = Alignment.CenterHorizontally,
diff --git a/wear/compose/integration-tests/demos/src/main/java/androidx/wear/compose/integration/demos/StepperDemo.kt b/wear/compose/integration-tests/demos/src/main/java/androidx/wear/compose/integration/demos/StepperDemo.kt
index 8b3db7e..3f6af0a 100644
--- a/wear/compose/integration-tests/demos/src/main/java/androidx/wear/compose/integration/demos/StepperDemo.kt
+++ b/wear/compose/integration-tests/demos/src/main/java/androidx/wear/compose/integration/demos/StepperDemo.kt
@@ -19,7 +19,8 @@
import androidx.compose.foundation.layout.width
import androidx.compose.runtime.Composable
import androidx.compose.runtime.getValue
-import androidx.compose.runtime.mutableStateOf
+import androidx.compose.runtime.mutableFloatStateOf
+import androidx.compose.runtime.mutableIntStateOf
import androidx.compose.runtime.remember
import androidx.compose.runtime.setValue
import androidx.compose.ui.Modifier
@@ -35,7 +36,7 @@
@Composable
fun StepperDemo() {
- var value by remember { mutableStateOf(2f) }
+ var value by remember { mutableFloatStateOf(2f) }
Stepper(
value = value,
onValueChange = { value = it },
@@ -48,7 +49,7 @@
@Composable
fun StepperWithIntegerDemo() {
- var value by remember { mutableStateOf(2) }
+ var value by remember { mutableIntStateOf(2) }
Stepper(
value = value,
onValueChange = { value = it },
@@ -60,26 +61,26 @@
@Composable
fun StepperWithScrollBarDemo() {
- val valueState = remember { mutableStateOf(4f) }
+ var valueState by remember { mutableFloatStateOf(4f) }
val range = 0f..10f
Stepper(
- value = valueState.value,
- onValueChange = { valueState.value = it },
+ value = valueState,
+ onValueChange = { valueState = it },
increaseIcon = { Icon(StepperDefaults.Increase, "Increase") },
decreaseIcon = { Icon(StepperDefaults.Decrease, "Decrease") },
valueRange = range,
steps = 9
) {
Chip(
- onClick = { valueState.value = if (valueState.value == 0f) 4f else 0f },
+ onClick = { valueState = if (valueState == 0f) 4f else 0f },
modifier = Modifier.width(146.dp),
colors = ChipDefaults.secondaryChipColors(),
- label = { Text("Volume : ${valueState.value}") },
+ label = { Text("Volume : $valueState") },
icon = {
Icon(
painter = painterResource(
- id = if (valueState.value > 0)
+ id = if (valueState > 0)
R.drawable.ic_volume_up_24px
else R.drawable.ic_volume_off_24px
),
@@ -90,30 +91,30 @@
}
PositionIndicator(
- value = { valueState.value },
+ value = { valueState },
range = range
)
}
@Composable
fun StepperWithCustomColors() {
- val valueState = remember { mutableStateOf(4f) }
+ var valueState by remember { mutableFloatStateOf(4f) }
val range = 0f..10f
Stepper(
- value = valueState.value,
- onValueChange = { valueState.value = it },
+ value = valueState,
+ onValueChange = { valueState = it },
valueRange = range,
increaseIcon = { Icon(StepperDefaults.Increase, "Increase") },
decreaseIcon = { Icon(StepperDefaults.Decrease, "Decrease") },
steps = 9,
contentColor = AlternatePrimaryColor2,
) {
- Text("Volume : ${valueState.value}")
+ Text("Volume : $valueState")
}
PositionIndicator(
- value = { valueState.value },
+ value = { valueState },
range = range
)
}
diff --git a/wear/compose/integration-tests/demos/src/main/java/androidx/wear/compose/integration/demos/SwipeToDismissDemoWithState.kt b/wear/compose/integration-tests/demos/src/main/java/androidx/wear/compose/integration/demos/SwipeToDismissDemoWithState.kt
index 56e01fb..1f4bef8 100644
--- a/wear/compose/integration-tests/demos/src/main/java/androidx/wear/compose/integration/demos/SwipeToDismissDemoWithState.kt
+++ b/wear/compose/integration-tests/demos/src/main/java/androidx/wear/compose/integration/demos/SwipeToDismissDemoWithState.kt
@@ -23,6 +23,7 @@
import androidx.compose.runtime.Composable
import androidx.compose.runtime.LaunchedEffect
import androidx.compose.runtime.getValue
+import androidx.compose.runtime.mutableIntStateOf
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
import androidx.compose.runtime.saveable.rememberSaveable
@@ -66,7 +67,7 @@
content = { isBackground ->
if (showCounterForContent.value xor isBackground)
saveableStateHolder.SaveableStateProvider(counterKey) {
- var counter by rememberSaveable { mutableStateOf(0) }
+ var counter by rememberSaveable { mutableIntStateOf(0) }
Column(
modifier = Modifier.fillMaxSize().background(MaterialTheme.colors.primary),
horizontalAlignment = Alignment.CenterHorizontally,
diff --git a/wear/compose/integration-tests/macrobenchmark-target/src/main/java/androidx/wear/compose/integration/macrobenchmark/target/BaselineActivity.kt b/wear/compose/integration-tests/macrobenchmark-target/src/main/java/androidx/wear/compose/integration/macrobenchmark/target/BaselineActivity.kt
index 6d3441f..7c60533 100644
--- a/wear/compose/integration-tests/macrobenchmark-target/src/main/java/androidx/wear/compose/integration/macrobenchmark/target/BaselineActivity.kt
+++ b/wear/compose/integration-tests/macrobenchmark-target/src/main/java/androidx/wear/compose/integration/macrobenchmark/target/BaselineActivity.kt
@@ -37,6 +37,7 @@
import androidx.compose.runtime.LaunchedEffect
import androidx.compose.runtime.derivedStateOf
import androidx.compose.runtime.getValue
+import androidx.compose.runtime.mutableFloatStateOf
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
import androidx.compose.runtime.setValue
@@ -527,7 +528,7 @@
horizontalAlignment = Alignment.CenterHorizontally
) {
ListHeader { Text("Sliders") }
- var value by remember { mutableStateOf(4.5f) }
+ var value by remember { mutableFloatStateOf(4.5f) }
InlineSlider(
value = value,
onValueChange = { value = it },
@@ -552,7 +553,7 @@
@Composable
fun Stepper() {
- var value by remember { mutableStateOf(2f) }
+ var value by remember { mutableFloatStateOf(2f) }
Stepper(
value = value,
onValueChange = { value = it },
diff --git a/wear/compose/integration-tests/macrobenchmark/src/androidTest/AndroidManifest.xml b/wear/compose/integration-tests/macrobenchmark/src/androidTest/AndroidManifest.xml
deleted file mode 100644
index e0788d6..0000000
--- a/wear/compose/integration-tests/macrobenchmark/src/androidTest/AndroidManifest.xml
+++ /dev/null
@@ -1,18 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
- Copyright 2021 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.
- -->
-
-<manifest />
diff --git a/wear/compose/integration-tests/macrobenchmark/src/main/AndroidManifest.xml b/wear/compose/integration-tests/macrobenchmark/src/main/AndroidManifest.xml
deleted file mode 100644
index f734545..0000000
--- a/wear/compose/integration-tests/macrobenchmark/src/main/AndroidManifest.xml
+++ /dev/null
@@ -1,18 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
- Copyright 2021 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.
- -->
-
-<manifest />
\ No newline at end of file
diff --git a/wear/watchface/watchface-editor/src/androidTest/java/androidx/wear/watchface/editor/EditorSessionGuavaTest.kt b/wear/watchface/watchface-editor/src/androidTest/java/androidx/wear/watchface/editor/EditorSessionGuavaTest.kt
index 57efd34..0b32c3e 100644
--- a/wear/watchface/watchface-editor/src/androidTest/java/androidx/wear/watchface/editor/EditorSessionGuavaTest.kt
+++ b/wear/watchface/watchface-editor/src/androidTest/java/androidx/wear/watchface/editor/EditorSessionGuavaTest.kt
@@ -57,6 +57,7 @@
import kotlinx.coroutines.CompletableDeferred
import org.junit.After
import org.junit.Assert
+import org.junit.Ignore
import org.junit.Test
import org.junit.runner.RunWith
import org.mockito.Mockito
@@ -191,6 +192,7 @@
}
@Test
+ @Ignore("b/281083901")
public fun listenableOpenComplicationDataSourceChooser() {
ComplicationDataSourceChooserContract.useTestComplicationHelperActivity = true
val chosenComplicationDataSourceInfo =
diff --git a/wear/watchface/watchface/src/androidTest/java/androidx/wear/watchface/test/WatchFaceServiceImageTest.kt b/wear/watchface/watchface/src/androidTest/java/androidx/wear/watchface/test/WatchFaceServiceImageTest.kt
index d8d78fc..53dddff 100644
--- a/wear/watchface/watchface/src/androidTest/java/androidx/wear/watchface/test/WatchFaceServiceImageTest.kt
+++ b/wear/watchface/watchface/src/androidTest/java/androidx/wear/watchface/test/WatchFaceServiceImageTest.kt
@@ -86,6 +86,7 @@
import org.junit.Assert.fail
import org.junit.Assume
import org.junit.Before
+import org.junit.Ignore
import org.junit.Rule
import org.junit.Test
import org.junit.runner.RunWith
@@ -378,6 +379,7 @@
@SuppressLint("NewApi")
@Test
+ @Ignore("b/274981990")
public fun testCommandTakeOpenGLScreenShot() {
val latch = CountDownLatch(1)
diff --git a/wear/wear-input-testing/src/main/AndroidManifest.xml b/wear/wear-input-testing/src/main/AndroidManifest.xml
deleted file mode 100644
index 9cd4123..0000000
--- a/wear/wear-input-testing/src/main/AndroidManifest.xml
+++ /dev/null
@@ -1,17 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
- 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.
- -->
-<manifest />
diff --git a/wear/wear-input/src/main/AndroidManifest.xml b/wear/wear-input/src/main/AndroidManifest.xml
deleted file mode 100644
index 9cd4123..0000000
--- a/wear/wear-input/src/main/AndroidManifest.xml
+++ /dev/null
@@ -1,17 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
- 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.
- -->
-<manifest />
diff --git a/wear/wear-ongoing/src/main/AndroidManifest.xml b/wear/wear-ongoing/src/main/AndroidManifest.xml
deleted file mode 100644
index 9e46016..0000000
--- a/wear/wear-ongoing/src/main/AndroidManifest.xml
+++ /dev/null
@@ -1,17 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2016 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.
--->
-<manifest />
-
diff --git a/wear/wear/src/androidTest/java/androidx/wear/activity/ConfirmationActivityTest.java b/wear/wear/src/androidTest/java/androidx/wear/activity/ConfirmationActivityTest.java
index 2e2720a..36e4a604 100644
--- a/wear/wear/src/androidTest/java/androidx/wear/activity/ConfirmationActivityTest.java
+++ b/wear/wear/src/androidTest/java/androidx/wear/activity/ConfirmationActivityTest.java
@@ -20,6 +20,7 @@
import static org.junit.Assert.assertTrue;
import android.widget.Button;
+import org.junit.Ignore;
import androidx.annotation.Nullable;
import androidx.test.ext.junit.runners.AndroidJUnit4;
@@ -56,6 +57,7 @@
new ActivityTestRule<>(ConfirmationActivityTestActivity.class, true, true);
@Test
+ @Ignore("b/272346886")
public void testConfirmationDialogShownForDefaultDuration() throws Throwable {
int testDuration = ConfirmationActivity.DEFAULT_ANIMATION_DURATION_MILLIS;
// Check that the structure of the test is still valid
@@ -66,12 +68,14 @@
}
@Test
+ @Ignore("b/272346886")
public void testConfirmationDialogShownForLongerDuration() throws Throwable {
testConfirmationDialogShownForConfiguredDuration(
ConfirmationActivity.DEFAULT_ANIMATION_DURATION_MILLIS * 2, "A message");
}
@Test
+ @Ignore("b/272346886")
public void testConfirmationDialogWithMissingMessage() throws Throwable {
testConfirmationDialogShownForConfiguredDuration(
ConfirmationActivity.DEFAULT_ANIMATION_DURATION_MILLIS * 2, /* message= */null);
diff --git a/wear/wear/src/androidTest/java/androidx/wear/widget/ArcLayoutTest.kt b/wear/wear/src/androidTest/java/androidx/wear/widget/ArcLayoutTest.kt
index b03ecf3..3409862 100644
--- a/wear/wear/src/androidTest/java/androidx/wear/widget/ArcLayoutTest.kt
+++ b/wear/wear/src/androidTest/java/androidx/wear/widget/ArcLayoutTest.kt
@@ -58,6 +58,7 @@
import org.hamcrest.CoreMatchers.any
import org.hamcrest.Matcher
import org.junit.Before
+import org.junit.Ignore
import org.junit.Rule
import org.junit.Test
import org.junit.runner.RunWith
@@ -830,6 +831,7 @@
}
@Test(timeout = 5000)
+ @Ignore("b/280671279")
fun testBasicTouch() {
val context: Context = ApplicationProvider.getApplicationContext()
// This views are the same as the test testTouchEvents()
@@ -873,6 +875,7 @@
}
@Test(timeout = 10000)
+ @Ignore("b/280671279")
fun testMarginTouch() {
val views = createTwoArcsWithMargin()
testEventsFast("touch_fast_margin_screenshot", views)
diff --git a/webkit/integration-tests/testapp/src/androidTest/java/com/example/androidx/webkit/ProcessGlobalConfigActivityTestAppTest.java b/webkit/integration-tests/testapp/src/androidTest/java/com/example/androidx/webkit/ProcessGlobalConfigActivityTestAppTest.java
index 913e8b5..64b80a7 100644
--- a/webkit/integration-tests/testapp/src/androidTest/java/com/example/androidx/webkit/ProcessGlobalConfigActivityTestAppTest.java
+++ b/webkit/integration-tests/testapp/src/androidTest/java/com/example/androidx/webkit/ProcessGlobalConfigActivityTestAppTest.java
@@ -24,6 +24,7 @@
import androidx.test.ext.junit.runners.AndroidJUnit4;
import androidx.test.filters.LargeTest;
import androidx.webkit.WebViewFeature;
+import org.junit.Ignore;
import org.junit.Rule;
import org.junit.Test;
@@ -42,6 +43,7 @@
new ActivityScenarioRule<>(ProcessGlobalConfigActivity.class);
@Test
+ @Ignore("b/280671406")
public void testSetDataDirectorySuffix() throws Throwable {
WebkitTestHelpers.assumeStartupFeature(
WebViewFeature.STARTUP_FEATURE_SET_DATA_DIRECTORY_SUFFIX,
diff --git a/webkit/webkit/src/main/AndroidManifest.xml b/webkit/webkit/src/main/AndroidManifest.xml
deleted file mode 100644
index 95c4426..0000000
--- a/webkit/webkit/src/main/AndroidManifest.xml
+++ /dev/null
@@ -1,16 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2017 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.
--->
-<manifest />
diff --git a/window/extensions/extensions/src/main/AndroidManifest.xml b/window/extensions/extensions/src/main/AndroidManifest.xml
deleted file mode 100644
index deac81d..0000000
--- a/window/extensions/extensions/src/main/AndroidManifest.xml
+++ /dev/null
@@ -1,17 +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.
- -->
-
-<manifest />
diff --git a/window/sidecar/sidecar/src/main/AndroidManifest.xml b/window/sidecar/sidecar/src/main/AndroidManifest.xml
deleted file mode 100644
index deac81d..0000000
--- a/window/sidecar/sidecar/src/main/AndroidManifest.xml
+++ /dev/null
@@ -1,17 +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.
- -->
-
-<manifest />
diff --git a/work/work-benchmark/src/main/AndroidManifest.xml b/work/work-benchmark/src/main/AndroidManifest.xml
deleted file mode 100644
index 4d64e1c..0000000
--- a/work/work-benchmark/src/main/AndroidManifest.xml
+++ /dev/null
@@ -1,16 +0,0 @@
-<!--
- ~ Copyright (C) 2019 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.
- -->
-<manifest />