Merge "Update how common sources are computed" into androidx-main
diff --git a/appcompat/appcompat/src/androidTest/java/androidx/appcompat/app/DrawerLayoutTest.java b/appcompat/appcompat/src/androidTest/java/androidx/appcompat/app/DrawerLayoutTest.java
index 4ce752e..3b86f6e 100644
--- a/appcompat/appcompat/src/androidTest/java/androidx/appcompat/app/DrawerLayoutTest.java
+++ b/appcompat/appcompat/src/androidTest/java/androidx/appcompat/app/DrawerLayoutTest.java
@@ -259,6 +259,7 @@
@Test
@MediumTest
+ @SdkSuppress(maxSdkVersion = 34) // b/384972471: Failing on SDK 35
public void testDrawerHeight() {
// Open the drawer so it becomes visible
onView(withId(R.id.drawer_layout)).perform(openDrawer(GravityCompat.START));
diff --git a/appfunctions/appfunctions-common/api/current.txt b/appfunctions/appfunctions-common/api/current.txt
index e6f50d0..724d892f 100644
--- a/appfunctions/appfunctions-common/api/current.txt
+++ b/appfunctions/appfunctions-common/api/current.txt
@@ -1 +1,60 @@
// Signature format: 4.0
+package androidx.appfunctions {
+
+ public interface AppFunctionContext {
+ method public String getCallingPackageName();
+ method public android.content.pm.SigningInfo getCallingPackageSigningInfo();
+ method public android.content.Context getContext();
+ property public abstract String callingPackageName;
+ property public abstract android.content.pm.SigningInfo callingPackageSigningInfo;
+ property public abstract android.content.Context context;
+ }
+
+ public final class AppFunctionException {
+ ctor public AppFunctionException(int errorCode, optional String? errorMessage);
+ method public int getErrorCategory();
+ method public int getErrorCode();
+ method public String? getErrorMessage();
+ property public final int errorCategory;
+ property public final int errorCode;
+ property public final String? errorMessage;
+ field public static final androidx.appfunctions.AppFunctionException.Companion Companion;
+ field public static final int ERROR_APP_UNKNOWN_ERROR = 3000; // 0xbb8
+ field public static final int ERROR_CANCELLED = 2001; // 0x7d1
+ field public static final int ERROR_CATEGORY_APP = 3; // 0x3
+ field public static final int ERROR_CATEGORY_REQUEST_ERROR = 1; // 0x1
+ field public static final int ERROR_CATEGORY_SYSTEM = 2; // 0x2
+ field public static final int ERROR_CATEGORY_UNKNOWN = 0; // 0x0
+ field public static final int ERROR_DENIED = 1000; // 0x3e8
+ field public static final int ERROR_DISABLED = 1002; // 0x3ea
+ field public static final int ERROR_FUNCTION_NOT_FOUND = 1003; // 0x3eb
+ field public static final int ERROR_INVALID_ARGUMENT = 1001; // 0x3e9
+ field public static final int ERROR_LIMIT_EXCEEDED = 1501; // 0x5dd
+ field public static final int ERROR_NOT_SUPPORTED = 3501; // 0xdad
+ field public static final int ERROR_PERMISSION_REQUIRED = 3500; // 0xdac
+ field public static final int ERROR_RESOURCE_ALREADY_EXISTS = 1502; // 0x5de
+ field public static final int ERROR_RESOURCE_NOT_FOUND = 1500; // 0x5dc
+ field public static final int ERROR_SYSTEM_ERROR = 2000; // 0x7d0
+ }
+
+ public static final class AppFunctionException.Companion {
+ property public static final int ERROR_APP_UNKNOWN_ERROR;
+ property public static final int ERROR_CANCELLED;
+ property public static final int ERROR_CATEGORY_APP;
+ property public static final int ERROR_CATEGORY_REQUEST_ERROR;
+ property public static final int ERROR_CATEGORY_SYSTEM;
+ property public static final int ERROR_CATEGORY_UNKNOWN;
+ property public static final int ERROR_DENIED;
+ property public static final int ERROR_DISABLED;
+ property public static final int ERROR_FUNCTION_NOT_FOUND;
+ property public static final int ERROR_INVALID_ARGUMENT;
+ property public static final int ERROR_LIMIT_EXCEEDED;
+ property public static final int ERROR_NOT_SUPPORTED;
+ property public static final int ERROR_PERMISSION_REQUIRED;
+ property public static final int ERROR_RESOURCE_ALREADY_EXISTS;
+ property public static final int ERROR_RESOURCE_NOT_FOUND;
+ property public static final int ERROR_SYSTEM_ERROR;
+ }
+
+}
+
diff --git a/appfunctions/appfunctions-common/api/restricted_current.txt b/appfunctions/appfunctions-common/api/restricted_current.txt
index e6f50d0..724d892f 100644
--- a/appfunctions/appfunctions-common/api/restricted_current.txt
+++ b/appfunctions/appfunctions-common/api/restricted_current.txt
@@ -1 +1,60 @@
// Signature format: 4.0
+package androidx.appfunctions {
+
+ public interface AppFunctionContext {
+ method public String getCallingPackageName();
+ method public android.content.pm.SigningInfo getCallingPackageSigningInfo();
+ method public android.content.Context getContext();
+ property public abstract String callingPackageName;
+ property public abstract android.content.pm.SigningInfo callingPackageSigningInfo;
+ property public abstract android.content.Context context;
+ }
+
+ public final class AppFunctionException {
+ ctor public AppFunctionException(int errorCode, optional String? errorMessage);
+ method public int getErrorCategory();
+ method public int getErrorCode();
+ method public String? getErrorMessage();
+ property public final int errorCategory;
+ property public final int errorCode;
+ property public final String? errorMessage;
+ field public static final androidx.appfunctions.AppFunctionException.Companion Companion;
+ field public static final int ERROR_APP_UNKNOWN_ERROR = 3000; // 0xbb8
+ field public static final int ERROR_CANCELLED = 2001; // 0x7d1
+ field public static final int ERROR_CATEGORY_APP = 3; // 0x3
+ field public static final int ERROR_CATEGORY_REQUEST_ERROR = 1; // 0x1
+ field public static final int ERROR_CATEGORY_SYSTEM = 2; // 0x2
+ field public static final int ERROR_CATEGORY_UNKNOWN = 0; // 0x0
+ field public static final int ERROR_DENIED = 1000; // 0x3e8
+ field public static final int ERROR_DISABLED = 1002; // 0x3ea
+ field public static final int ERROR_FUNCTION_NOT_FOUND = 1003; // 0x3eb
+ field public static final int ERROR_INVALID_ARGUMENT = 1001; // 0x3e9
+ field public static final int ERROR_LIMIT_EXCEEDED = 1501; // 0x5dd
+ field public static final int ERROR_NOT_SUPPORTED = 3501; // 0xdad
+ field public static final int ERROR_PERMISSION_REQUIRED = 3500; // 0xdac
+ field public static final int ERROR_RESOURCE_ALREADY_EXISTS = 1502; // 0x5de
+ field public static final int ERROR_RESOURCE_NOT_FOUND = 1500; // 0x5dc
+ field public static final int ERROR_SYSTEM_ERROR = 2000; // 0x7d0
+ }
+
+ public static final class AppFunctionException.Companion {
+ property public static final int ERROR_APP_UNKNOWN_ERROR;
+ property public static final int ERROR_CANCELLED;
+ property public static final int ERROR_CATEGORY_APP;
+ property public static final int ERROR_CATEGORY_REQUEST_ERROR;
+ property public static final int ERROR_CATEGORY_SYSTEM;
+ property public static final int ERROR_CATEGORY_UNKNOWN;
+ property public static final int ERROR_DENIED;
+ property public static final int ERROR_DISABLED;
+ property public static final int ERROR_FUNCTION_NOT_FOUND;
+ property public static final int ERROR_INVALID_ARGUMENT;
+ property public static final int ERROR_LIMIT_EXCEEDED;
+ property public static final int ERROR_NOT_SUPPORTED;
+ property public static final int ERROR_PERMISSION_REQUIRED;
+ property public static final int ERROR_RESOURCE_ALREADY_EXISTS;
+ property public static final int ERROR_RESOURCE_NOT_FOUND;
+ property public static final int ERROR_SYSTEM_ERROR;
+ }
+
+}
+
diff --git a/appfunctions/appfunctions-common/src/androidTest/java/androidx/appfunctions/AppFunctionExceptionTest.kt b/appfunctions/appfunctions-common/src/androidTest/java/androidx/appfunctions/AppFunctionExceptionTest.kt
new file mode 100644
index 0000000..7652f91
--- /dev/null
+++ b/appfunctions/appfunctions-common/src/androidTest/java/androidx/appfunctions/AppFunctionExceptionTest.kt
@@ -0,0 +1,148 @@
+/*
+ * Copyright 2025 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT 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.appfunctions
+
+import android.os.Bundle
+import com.google.common.truth.Truth
+import org.junit.AssumptionViolatedException
+import org.junit.Test
+
+class AppFunctionExceptionTest {
+ @Test
+ fun testConstructor_withoutMessageAndExtras() {
+ val exception = AppFunctionException(AppFunctionException.ERROR_DENIED)
+
+ Truth.assertThat(exception.errorCode).isEqualTo(AppFunctionException.ERROR_DENIED)
+ Truth.assertThat(exception.errorMessage).isNull()
+ Truth.assertThat(exception.extras).isEqualTo(Bundle.EMPTY)
+ }
+
+ @Test
+ fun testConstructor_withoutExtras() {
+ val exception = AppFunctionException(AppFunctionException.ERROR_DENIED, "testMessage")
+
+ Truth.assertThat(exception.errorCode).isEqualTo(AppFunctionException.ERROR_DENIED)
+ Truth.assertThat(exception.errorMessage).isEqualTo("testMessage")
+ Truth.assertThat(exception.extras).isEqualTo(Bundle.EMPTY)
+ }
+
+ @Test
+ fun testConstructor() {
+ val extras = Bundle().apply { putString("testKey", "testValue") }
+ val exception =
+ AppFunctionException(AppFunctionException.ERROR_DENIED, "testMessage", extras)
+
+ Truth.assertThat(exception.errorCode).isEqualTo(AppFunctionException.ERROR_DENIED)
+ Truth.assertThat(exception.errorMessage).isEqualTo("testMessage")
+ Truth.assertThat(exception.extras.getString("testKey")).isEqualTo("testValue")
+ }
+
+ @Test
+ fun testErrorCategory_RequestError() {
+ Truth.assertThat(AppFunctionException(AppFunctionException.ERROR_DENIED).errorCategory)
+ .isEqualTo(AppFunctionException.ERROR_CATEGORY_REQUEST_ERROR)
+ Truth.assertThat(
+ AppFunctionException(AppFunctionException.ERROR_INVALID_ARGUMENT).errorCategory
+ )
+ .isEqualTo(AppFunctionException.ERROR_CATEGORY_REQUEST_ERROR)
+ Truth.assertThat(AppFunctionException(AppFunctionException.ERROR_DISABLED).errorCategory)
+ .isEqualTo(AppFunctionException.ERROR_CATEGORY_REQUEST_ERROR)
+ Truth.assertThat(
+ AppFunctionException(AppFunctionException.ERROR_FUNCTION_NOT_FOUND).errorCategory
+ )
+ .isEqualTo(AppFunctionException.ERROR_CATEGORY_REQUEST_ERROR)
+ Truth.assertThat(
+ AppFunctionException(AppFunctionException.ERROR_RESOURCE_NOT_FOUND).errorCategory
+ )
+ .isEqualTo(AppFunctionException.ERROR_CATEGORY_REQUEST_ERROR)
+ Truth.assertThat(
+ AppFunctionException(AppFunctionException.ERROR_LIMIT_EXCEEDED).errorCategory
+ )
+ .isEqualTo(AppFunctionException.ERROR_CATEGORY_REQUEST_ERROR)
+ Truth.assertThat(
+ AppFunctionException(AppFunctionException.ERROR_RESOURCE_ALREADY_EXISTS)
+ .errorCategory
+ )
+ .isEqualTo(AppFunctionException.ERROR_CATEGORY_REQUEST_ERROR)
+ }
+
+ @Test
+ fun testErrorCategory_SystemError() {
+ Truth.assertThat(
+ AppFunctionException(AppFunctionException.ERROR_SYSTEM_ERROR).errorCategory
+ )
+ .isEqualTo(AppFunctionException.ERROR_CATEGORY_SYSTEM)
+ Truth.assertThat(AppFunctionException(AppFunctionException.ERROR_CANCELLED).errorCategory)
+ .isEqualTo(AppFunctionException.ERROR_CATEGORY_SYSTEM)
+ }
+
+ @Test
+ fun testErrorCategory_AppError() {
+ Truth.assertThat(
+ AppFunctionException(AppFunctionException.ERROR_APP_UNKNOWN_ERROR).errorCategory
+ )
+ .isEqualTo(AppFunctionException.ERROR_CATEGORY_APP)
+ Truth.assertThat(
+ AppFunctionException(AppFunctionException.ERROR_PERMISSION_REQUIRED).errorCategory
+ )
+ .isEqualTo(AppFunctionException.ERROR_CATEGORY_APP)
+ Truth.assertThat(
+ AppFunctionException(AppFunctionException.ERROR_NOT_SUPPORTED).errorCategory
+ )
+ .isEqualTo(AppFunctionException.ERROR_CATEGORY_APP)
+ }
+
+ @Test
+ fun testTransformToPlatformExtensionsClass() {
+ assumeAppFunctionExtensionLibraryAvailable()
+ val extras = Bundle().apply { putString("testKey", "testValue") }
+ val exception =
+ AppFunctionException(AppFunctionException.ERROR_DENIED, "testMessage", extras)
+
+ val platformException = exception.toPlatformExtensionsClass()
+
+ Truth.assertThat(platformException.errorCode).isEqualTo(AppFunctionException.ERROR_DENIED)
+ Truth.assertThat(platformException.errorMessage).isEqualTo("testMessage")
+ Truth.assertThat(platformException.extras.getString("testKey")).isEqualTo("testValue")
+ }
+
+ @Test
+ fun testCreateFromPlatformExtensionsClass() {
+ assumeAppFunctionExtensionLibraryAvailable()
+ val extras = Bundle().apply { putString("testKey", "testValue") }
+ val platformException =
+ com.android.extensions.appfunctions.AppFunctionException(
+ AppFunctionException.ERROR_DENIED,
+ "testMessage",
+ extras
+ )
+
+ val exception = AppFunctionException.fromPlatformExtensionsClass(platformException)
+ Truth.assertThat(exception.errorCode).isEqualTo(AppFunctionException.ERROR_DENIED)
+ Truth.assertThat(exception.errorMessage).isEqualTo("testMessage")
+ Truth.assertThat(exception.extras.getString("testKey")).isEqualTo("testValue")
+ }
+
+ private fun assumeAppFunctionExtensionLibraryAvailable(): Boolean {
+ try {
+ Class.forName("com.android.extensions.appfunctions.AppFunctionManager")
+ return true
+ } catch (e: ClassNotFoundException) {
+ throw AssumptionViolatedException("Unable to find AppFunction extension library", e)
+ }
+ }
+}
diff --git a/appfunctions/appfunctions-common/src/main/AndroidManifest.xml b/appfunctions/appfunctions-common/src/main/AndroidManifest.xml
new file mode 100644
index 0000000..d290837
--- /dev/null
+++ b/appfunctions/appfunctions-common/src/main/AndroidManifest.xml
@@ -0,0 +1,23 @@
+<!--
+ Copyright 2024 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ -->
+<manifest
+ xmlns:android="http://schemas.android.com/apk/res/android">
+ <application>
+ <uses-library
+ android:name="com.android.extensions.appfunctions"
+ android:required="false" />
+ </application>
+</manifest>
\ No newline at end of file
diff --git a/appfunctions/appfunctions-common/src/main/java/androidx/appfunctions/AppFunctionContext.kt b/appfunctions/appfunctions-common/src/main/java/androidx/appfunctions/AppFunctionContext.kt
new file mode 100644
index 0000000..250690e
--- /dev/null
+++ b/appfunctions/appfunctions-common/src/main/java/androidx/appfunctions/AppFunctionContext.kt
@@ -0,0 +1,38 @@
+/*
+ * Copyright 2025 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT 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.appfunctions
+
+import android.content.Context
+import android.content.pm.SigningInfo
+
+/** The execution context of app function. */
+public interface AppFunctionContext {
+ /** The Android context. */
+ public val context: Context
+
+ /**
+ * Return the name of the package that invoked this AppFunction. You can use this information to
+ * validate the caller.
+ */
+ public val callingPackageName: String
+
+ /**
+ * Return the [android.content.pm.SigningInfo] of the package that invoked this AppFunction. You
+ * can use this information to validate the caller.
+ */
+ public val callingPackageSigningInfo: SigningInfo
+}
diff --git a/appfunctions/appfunctions-common/src/main/java/androidx/appfunctions/AppFunctionException.kt b/appfunctions/appfunctions-common/src/main/java/androidx/appfunctions/AppFunctionException.kt
new file mode 100644
index 0000000..35dbf20
--- /dev/null
+++ b/appfunctions/appfunctions-common/src/main/java/androidx/appfunctions/AppFunctionException.kt
@@ -0,0 +1,253 @@
+/*
+ * Copyright 2025 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT 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.appfunctions
+
+import android.os.Bundle
+import androidx.annotation.IntDef
+import androidx.annotation.RestrictTo
+
+/**
+ * An exception that is thrown when an error occurs during an app function execution.
+ *
+ * This exception can be used by the app to report errors to the caller.
+ */
+public class AppFunctionException
+internal constructor(
+ /** The error code. */
+ @ErrorCode public val errorCode: Int,
+ /** The error message. */
+ public val errorMessage: String?,
+ internal val extras: Bundle
+) {
+ /**
+ * Create an [AppFunctionException].
+ *
+ * @param errorCode The error code.
+ * @param errorMessage The error message.
+ */
+ public constructor(
+ @ErrorCode errorCode: Int,
+ errorMessage: String? = null,
+ ) : this(errorCode, errorMessage, Bundle.EMPTY)
+
+ @RestrictTo(RestrictTo.Scope.LIBRARY_GROUP)
+ public fun toPlatformExtensionsClass():
+ com.android.extensions.appfunctions.AppFunctionException {
+ return com.android.extensions.appfunctions.AppFunctionException(
+ errorCode,
+ errorMessage,
+ extras
+ )
+ }
+
+ /**
+ * Returns the error category.
+ *
+ * <p> This method categorizes errors based on their underlying cause, allowing developers to
+ * implement targeted error handling and provide more informative error messages to users. It
+ * maps ranges of error codes to specific error categories.
+ *
+ * <p> This method returns [ERROR_CATEGORY_UNKNOWN] if the error code does not belong to any
+ * error category.
+ */
+ @ErrorCategory
+ public val errorCategory: Int =
+ when (errorCode) {
+ in 1000..1999 -> ERROR_CATEGORY_REQUEST_ERROR
+ in 2000..2999 -> ERROR_CATEGORY_SYSTEM
+ in 3000..3999 -> ERROR_CATEGORY_APP
+ else -> ERROR_CATEGORY_UNKNOWN
+ }
+
+ @IntDef(
+ value =
+ [
+ ERROR_CATEGORY_UNKNOWN,
+ ERROR_CATEGORY_REQUEST_ERROR,
+ ERROR_CATEGORY_APP,
+ ERROR_CATEGORY_SYSTEM,
+ ]
+ )
+ internal annotation class ErrorCategory
+
+ @IntDef(
+ value =
+ [
+ ERROR_DENIED,
+ ERROR_INVALID_ARGUMENT,
+ ERROR_DISABLED,
+ ERROR_FUNCTION_NOT_FOUND,
+ ERROR_RESOURCE_NOT_FOUND,
+ ERROR_LIMIT_EXCEEDED,
+ ERROR_RESOURCE_ALREADY_EXISTS,
+ ERROR_SYSTEM_ERROR,
+ ERROR_CANCELLED,
+ ERROR_APP_UNKNOWN_ERROR,
+ ERROR_PERMISSION_REQUIRED,
+ ERROR_NOT_SUPPORTED,
+ ]
+ )
+ internal annotation class ErrorCode
+
+ public companion object {
+ @RestrictTo(RestrictTo.Scope.LIBRARY_GROUP)
+ public fun fromPlatformExtensionsClass(
+ exception: com.android.extensions.appfunctions.AppFunctionException
+ ): AppFunctionException {
+ return AppFunctionException(
+ exception.errorCode,
+ exception.errorMessage,
+ exception.extras
+ )
+ }
+
+ // Error categories
+ /** The error category is unknown. */
+ public const val ERROR_CATEGORY_UNKNOWN: Int = 0
+
+ /**
+ * The error is caused by the app requesting a function execution.
+ *
+ * <p>For example, the caller provided invalid parameters in the execution request e.g. an
+ * invalid function ID.
+ *
+ * <p>Errors in the category fall in the range 1000-1999 inclusive.
+ */
+ public const val ERROR_CATEGORY_REQUEST_ERROR: Int = 1
+
+ /**
+ * The error is caused by an issue in the system.
+ *
+ * <p>For example, the AppFunctionService implementation is not found by the system.
+ *
+ * <p>Errors in the category fall in the range 2000-2999 inclusive.
+ */
+ public const val ERROR_CATEGORY_SYSTEM: Int = 2
+
+ /**
+ * The error is caused by the app providing the function.
+ *
+ * <p>For example, the app crashed when the system is executing the request.
+ *
+ * <p>Errors in the category fall in the range 3000-3999 inclusive.
+ */
+ public const val ERROR_CATEGORY_APP: Int = 3
+
+ // Error codes
+ /**
+ * The caller does not have the permission to execute an app function.
+ *
+ * <p>This error is in the [ERROR_CATEGORY_REQUEST_ERROR] category.
+ */
+ public const val ERROR_DENIED: Int = 1000
+
+ /**
+ * The caller supplied invalid arguments to the execution request.
+ *
+ * <p>This error may be considered similar to [IllegalArgumentException].
+ *
+ * <p>This error is in the [ERROR_CATEGORY_REQUEST_ERROR] category.
+ */
+ public const val ERROR_INVALID_ARGUMENT: Int = 1001
+
+ /**
+ * The caller tried to execute a disabled app function.
+ *
+ * <p>This error is in the [ERROR_CATEGORY_REQUEST_ERROR] category.
+ */
+ public const val ERROR_DISABLED: Int = 1002
+
+ /**
+ * The caller tried to execute a function that does not exist.
+ *
+ * <p>This error is in the [ERROR_CATEGORY_REQUEST_ERROR] category.
+ */
+ public const val ERROR_FUNCTION_NOT_FOUND: Int = 1003
+
+ // SDK-defined error codes in the [ERROR_CATEGORY_REQUEST_ERROR] category start from 1500.
+ /**
+ * The caller tried to request a resource/entity that does not exist.
+ *
+ * <p>This error is in the [ERROR_CATEGORY_REQUEST_ERROR] category.
+ */
+ public const val ERROR_RESOURCE_NOT_FOUND: Int = 1500
+
+ /**
+ * The caller exceeded the allowed request rate.
+ *
+ * <p>This error is in the [ERROR_CATEGORY_REQUEST_ERROR] category.
+ */
+ public const val ERROR_LIMIT_EXCEEDED: Int = 1501
+
+ /**
+ * The caller tried to create a resource/entity that already exists or has conflicts with
+ * existing resource/entity.
+ *
+ * <p>This error is in the [ERROR_CATEGORY_REQUEST_ERROR] category.
+ */
+ public const val ERROR_RESOURCE_ALREADY_EXISTS: Int = 1502
+
+ /**
+ * An internal unexpected error coming from the system.
+ *
+ * <p>This error is in the [ERROR_CATEGORY_SYSTEM] category.
+ */
+ public const val ERROR_SYSTEM_ERROR: Int = 2000
+
+ /**
+ * The operation was cancelled. Use this error code to report that a cancellation is done
+ * after receiving a cancellation signal.
+ *
+ * <p>This error is in the [ERROR_CATEGORY_SYSTEM] category.
+ */
+ public const val ERROR_CANCELLED: Int = 2001
+
+ /**
+ * An unknown error occurred while processing the call in the AppFunctionService.
+ *
+ * <p>This error is thrown when the service is connected in the remote application but an
+ * unexpected error is thrown from the bound application.
+ *
+ * <p>This error is in the [ERROR_CATEGORY_APP] category.
+ */
+ public const val ERROR_APP_UNKNOWN_ERROR: Int = 3000
+
+ // SDK-defined error codes in the [ERROR_CATEGORY_APP] category start from 3500.
+ /**
+ * Indicates the app lacks the necessary permission to fulfill the request.
+ *
+ * <p>This occurs when the app attempts an operation requiring user-granted permission that
+ * has not been provided. For example, creating a calendar event requires access to the
+ * calendar content. If the user hasn't granted this permission, this error should be
+ * thrown.
+ *
+ * <p>This error is in the [ERROR_CATEGORY_APP] category.
+ */
+ public const val ERROR_PERMISSION_REQUIRED: Int = 3500
+
+ /**
+ * Indicates the action is not supported by the app.
+ *
+ * <p>This error occurs when an app receives a request to perform an unsupported action. For
+ * example, a clock app might support updating timer properties such as label but may not
+ * allow updating the timer's duration once the timer has already started.
+ *
+ * <p>This error is in the [ERROR_CATEGORY_APP] category.
+ */
+ public const val ERROR_NOT_SUPPORTED: Int = 3501
+ }
+}
diff --git a/benchmark/benchmark-macro/src/androidTest/java/androidx/benchmark/macro/ProfileInstallBroadcastTest.kt b/benchmark/benchmark-macro/src/androidTest/java/androidx/benchmark/macro/ProfileInstallBroadcastTest.kt
index a856ba4..7184c9b 100644
--- a/benchmark/benchmark-macro/src/androidTest/java/androidx/benchmark/macro/ProfileInstallBroadcastTest.kt
+++ b/benchmark/benchmark-macro/src/androidTest/java/androidx/benchmark/macro/ProfileInstallBroadcastTest.kt
@@ -73,7 +73,7 @@
fun saveProfile_missing() {
val errorString = ProfileInstallBroadcast.saveProfile(Packages.MISSING)
assertNotNull(errorString)
- assertContains(errorString!!, "The save profile broadcast event was not received")
+ assertContains(errorString!!, "The save profile broadcast was not received")
}
@Test
@@ -133,6 +133,6 @@
val result = ProfileInstallBroadcast.saveProfilesForAllProcesses(Packages.TEST)
assertEquals(1, result.processCount)
assertNotNull(result.error)
- assertContains(result.error!!, "The save profile broadcast event was not received.")
+ assertContains(result.error!!, "The save profile broadcast was not received.")
}
}
diff --git a/benchmark/benchmark-macro/src/main/java/androidx/benchmark/macro/ProfileInstallBroadcast.kt b/benchmark/benchmark-macro/src/main/java/androidx/benchmark/macro/ProfileInstallBroadcast.kt
index 0340c07..d2e49aa 100644
--- a/benchmark/benchmark-macro/src/main/java/androidx/benchmark/macro/ProfileInstallBroadcast.kt
+++ b/benchmark/benchmark-macro/src/main/java/androidx/benchmark/macro/ProfileInstallBroadcast.kt
@@ -98,6 +98,13 @@
}
}
+ private fun nullResultErrorMessage(broadcastLabel: String, versionAdded: String): String =
+ "The $broadcastLabel broadcast was not received. " +
+ "This most likely means that the `androidx.profileinstaller` library is " +
+ "missing from the target app, or is too old. Please use `$versionAdded` or " +
+ "newer. For more information refer to the release notes at " +
+ "https://developer.android.com/jetpack/androidx/releases/profileinstaller."
+
/**
* Uses skip files for avoiding interference from ProfileInstaller when using
* [CompilationMode.None].
@@ -122,12 +129,10 @@
result == null || result == 0 -> {
// 0 is returned by the platform by default, and also if no broadcast receiver
// receives the broadcast.
-
- "The baseline profile skip file broadcast was not received. " +
- "This most likely means that the `androidx.profileinstaller` library " +
- "used by the target apk is old. Please use `1.2.0-alpha03` or newer. " +
- "For more information refer to the release notes at " +
- "https://developer.android.com/jetpack/androidx/releases/profileinstaller."
+ nullResultErrorMessage(
+ broadcastLabel = "baseline profile skip file",
+ versionAdded = "1.2.0-alpha03",
+ )
}
operation == "WRITE_SKIP_FILE" && result == 10 -> { // RESULT_INSTALL_SKIP_FILE_SUCCESS
null // success!
@@ -156,12 +161,10 @@
// 0 is returned by the platform by default, and also if no broadcast receiver
// receives the broadcast. This can be because the package name specified is
// incorrect or an old version of profile installer was used.
-
- "The save profile broadcast event was not received. This can be because the " +
- "specified package name is incorrect or the `androidx.profileinstaller`" +
- " library used by the target apk is old. Please use version `1.3.1` or " +
- "newer. For more information refer to the release notes at " +
- "https://developer.android.com/jetpack/androidx/releases/profileinstaller."
+ nullResultErrorMessage(
+ broadcastLabel = "save profile",
+ versionAdded = "1.3.1",
+ )
}
12 -> { // RESULT_SAVE_PROFILE_SIGNALLED
// While this is observed to be fast for simple/sample apps,
@@ -229,10 +232,10 @@
"used by the target apk is old. Please use `${operation.minimumVersion}`" +
" or newer. For more information refer to the release notes at " +
"https://developer.android.com/jetpack/androidx/releases/profileinstaller. " +
- "If you are already using androidx.profileinstaller library and still seeing " +
+ "If you are already using 'androidx.profileinstaller' library and still seeing " +
"error, verify: 1) androidx.profileinstaller.ProfileInstallReceiver appears " +
"unobfuscated in your APK's AndroidManifest and dex, and 2) the following " +
- "command executes successfully (should print 14): " +
+ "command executes successfully (should print ${operation.successCode}}): " +
"adb shell am broadcast $broadcastArguments"
}
15 -> { // RESULT_BENCHMARK_OPERATION_FAILURE
diff --git a/camera/camera-camera2-pipe-integration/build.gradle b/camera/camera-camera2-pipe-integration/build.gradle
index bb710ed..eccd134 100644
--- a/camera/camera-camera2-pipe-integration/build.gradle
+++ b/camera/camera-camera2-pipe-integration/build.gradle
@@ -85,6 +85,8 @@
}
android {
+ compileSdk 35
+
lintOptions {
enable("CameraXQuirksClassDetector")
}
diff --git a/camera/camera-camera2-pipe-integration/src/test/java/androidx/camera/camera2/pipe/integration/adapter/SupportedSurfaceCombinationTest.kt b/camera/camera-camera2-pipe-integration/src/test/java/androidx/camera/camera2/pipe/integration/adapter/SupportedSurfaceCombinationTest.kt
index 2bac7fd..13a7539 100644
--- a/camera/camera-camera2-pipe-integration/src/test/java/androidx/camera/camera2/pipe/integration/adapter/SupportedSurfaceCombinationTest.kt
+++ b/camera/camera-camera2-pipe-integration/src/test/java/androidx/camera/camera2/pipe/integration/adapter/SupportedSurfaceCombinationTest.kt
@@ -90,7 +90,6 @@
import androidx.camera.core.impl.UseCaseConfigFactory
import androidx.camera.core.impl.UseCaseConfigFactory.CaptureType
import androidx.camera.core.impl.utils.CompareSizesByArea
-import androidx.camera.core.internal.utils.SizeUtil
import androidx.camera.core.internal.utils.SizeUtil.RESOLUTION_1080P
import androidx.camera.core.internal.utils.SizeUtil.RESOLUTION_1440P
import androidx.camera.core.internal.utils.SizeUtil.RESOLUTION_720P
@@ -146,7 +145,6 @@
private val recordSize = Size(3840, 2160)
private val maximumSize = Size(4032, 3024)
private val legacyVideoMaximumSize = Size(1920, 1080)
- private val mod16Size = Size(960, 544)
private val profileUhd =
EncoderProfilesUtil.createFakeEncoderProfilesProxy(recordSize.width, recordSize.height)
private val profileFhd = EncoderProfilesUtil.createFakeEncoderProfilesProxy(1920, 1080)
@@ -319,7 +317,7 @@
@Test
fun checkLimitedSurfaceCombinationSupportedInLimitedDevice() {
- setupCamera(CameraCharacteristics.INFO_SUPPORTED_HARDWARE_LEVEL_LIMITED)
+ setupCamera(INFO_SUPPORTED_HARDWARE_LEVEL_LIMITED)
val supportedSurfaceCombination =
SupportedSurfaceCombination(context, fakeCameraMetadata, mockEncoderProfilesAdapter)
val combinationList = getLimitedSupportedCombinationList()
@@ -338,7 +336,7 @@
@Test
fun checkFullSurfaceCombinationNotSupportedInLimitedDevice() {
- setupCamera(CameraCharacteristics.INFO_SUPPORTED_HARDWARE_LEVEL_LIMITED)
+ setupCamera(INFO_SUPPORTED_HARDWARE_LEVEL_LIMITED)
val supportedSurfaceCombination =
SupportedSurfaceCombination(context, fakeCameraMetadata, mockEncoderProfilesAdapter)
val combinationList = getFullSupportedCombinationList()
@@ -357,7 +355,7 @@
@Test
fun checkLevel3SurfaceCombinationNotSupportedInLimitedDevice() {
- setupCamera(CameraCharacteristics.INFO_SUPPORTED_HARDWARE_LEVEL_LIMITED)
+ setupCamera(INFO_SUPPORTED_HARDWARE_LEVEL_LIMITED)
val supportedSurfaceCombination =
SupportedSurfaceCombination(context, fakeCameraMetadata, mockEncoderProfilesAdapter)
val combinationList = getLevel3SupportedCombinationList()
@@ -648,8 +646,7 @@
ImageFormat.YUV_420_888,
vgaSize
)
- val expectedSurfaceConfig =
- SurfaceConfig.create(SurfaceConfig.ConfigType.YUV, SurfaceConfig.ConfigSize.VGA)
+ val expectedSurfaceConfig = SurfaceConfig.create(ConfigType.YUV, ConfigSize.VGA)
assertThat(surfaceConfig).isEqualTo(expectedSurfaceConfig)
}
@@ -664,8 +661,7 @@
ImageFormat.YUV_420_888,
previewSize
)
- val expectedSurfaceConfig =
- SurfaceConfig.create(SurfaceConfig.ConfigType.YUV, SurfaceConfig.ConfigSize.PREVIEW)
+ val expectedSurfaceConfig = SurfaceConfig.create(ConfigType.YUV, ConfigSize.PREVIEW)
assertThat(surfaceConfig).isEqualTo(expectedSurfaceConfig)
}
@@ -680,8 +676,7 @@
ImageFormat.YUV_420_888,
recordSize
)
- val expectedSurfaceConfig =
- SurfaceConfig.create(SurfaceConfig.ConfigType.YUV, SurfaceConfig.ConfigSize.RECORD)
+ val expectedSurfaceConfig = SurfaceConfig.create(ConfigType.YUV, ConfigSize.RECORD)
assertThat(surfaceConfig).isEqualTo(expectedSurfaceConfig)
}
@@ -696,8 +691,7 @@
ImageFormat.YUV_420_888,
maximumSize
)
- val expectedSurfaceConfig =
- SurfaceConfig.create(SurfaceConfig.ConfigType.YUV, SurfaceConfig.ConfigSize.MAXIMUM)
+ val expectedSurfaceConfig = SurfaceConfig.create(ConfigType.YUV, ConfigSize.MAXIMUM)
assertThat(surfaceConfig).isEqualTo(expectedSurfaceConfig)
}
@@ -712,8 +706,7 @@
ImageFormat.JPEG,
vgaSize
)
- val expectedSurfaceConfig =
- SurfaceConfig.create(SurfaceConfig.ConfigType.JPEG, SurfaceConfig.ConfigSize.VGA)
+ val expectedSurfaceConfig = SurfaceConfig.create(ConfigType.JPEG, ConfigSize.VGA)
assertThat(surfaceConfig).isEqualTo(expectedSurfaceConfig)
}
@@ -728,8 +721,7 @@
ImageFormat.JPEG,
previewSize
)
- val expectedSurfaceConfig =
- SurfaceConfig.create(SurfaceConfig.ConfigType.JPEG, SurfaceConfig.ConfigSize.PREVIEW)
+ val expectedSurfaceConfig = SurfaceConfig.create(ConfigType.JPEG, ConfigSize.PREVIEW)
assertThat(surfaceConfig).isEqualTo(expectedSurfaceConfig)
}
@@ -744,8 +736,7 @@
ImageFormat.JPEG,
recordSize
)
- val expectedSurfaceConfig =
- SurfaceConfig.create(SurfaceConfig.ConfigType.JPEG, SurfaceConfig.ConfigSize.RECORD)
+ val expectedSurfaceConfig = SurfaceConfig.create(ConfigType.JPEG, ConfigSize.RECORD)
assertThat(surfaceConfig).isEqualTo(expectedSurfaceConfig)
}
@@ -760,8 +751,7 @@
ImageFormat.JPEG,
maximumSize
)
- val expectedSurfaceConfig =
- SurfaceConfig.create(SurfaceConfig.ConfigType.JPEG, SurfaceConfig.ConfigSize.MAXIMUM)
+ val expectedSurfaceConfig = SurfaceConfig.create(ConfigType.JPEG, ConfigSize.MAXIMUM)
assertThat(surfaceConfig).isEqualTo(expectedSurfaceConfig)
}
@@ -776,10 +766,9 @@
supportedSurfaceCombination.transformSurfaceConfig(
CameraMode.CONCURRENT_CAMERA,
ImageFormat.PRIVATE,
- SizeUtil.RESOLUTION_720P
+ RESOLUTION_720P
)
- val expectedSurfaceConfig =
- SurfaceConfig.create(SurfaceConfig.ConfigType.PRIV, SurfaceConfig.ConfigSize.s720p)
+ val expectedSurfaceConfig = SurfaceConfig.create(ConfigType.PRIV, ConfigSize.s720p)
assertThat(surfaceConfig).isEqualTo(expectedSurfaceConfig)
}
@@ -794,10 +783,9 @@
supportedSurfaceCombination.transformSurfaceConfig(
CameraMode.CONCURRENT_CAMERA,
ImageFormat.YUV_420_888,
- SizeUtil.RESOLUTION_720P
+ RESOLUTION_720P
)
- val expectedSurfaceConfig =
- SurfaceConfig.create(SurfaceConfig.ConfigType.YUV, SurfaceConfig.ConfigSize.s720p)
+ val expectedSurfaceConfig = SurfaceConfig.create(ConfigType.YUV, ConfigSize.s720p)
assertThat(surfaceConfig).isEqualTo(expectedSurfaceConfig)
}
@@ -812,10 +800,9 @@
supportedSurfaceCombination.transformSurfaceConfig(
CameraMode.CONCURRENT_CAMERA,
ImageFormat.JPEG,
- SizeUtil.RESOLUTION_720P
+ RESOLUTION_720P
)
- val expectedSurfaceConfig =
- SurfaceConfig.create(SurfaceConfig.ConfigType.JPEG, SurfaceConfig.ConfigSize.s720p)
+ val expectedSurfaceConfig = SurfaceConfig.create(ConfigType.JPEG, ConfigSize.s720p)
assertThat(surfaceConfig).isEqualTo(expectedSurfaceConfig)
}
@@ -832,8 +819,7 @@
ImageFormat.PRIVATE,
RESOLUTION_1440P
)
- val expectedSurfaceConfig =
- SurfaceConfig.create(SurfaceConfig.ConfigType.PRIV, SurfaceConfig.ConfigSize.s1440p)
+ val expectedSurfaceConfig = SurfaceConfig.create(ConfigType.PRIV, ConfigSize.s1440p)
assertThat(surfaceConfig).isEqualTo(expectedSurfaceConfig)
}
@@ -850,8 +836,7 @@
ImageFormat.YUV_420_888,
RESOLUTION_1440P
)
- val expectedSurfaceConfig =
- SurfaceConfig.create(SurfaceConfig.ConfigType.YUV, SurfaceConfig.ConfigSize.s1440p)
+ val expectedSurfaceConfig = SurfaceConfig.create(ConfigType.YUV, ConfigSize.s1440p)
assertThat(surfaceConfig).isEqualTo(expectedSurfaceConfig)
}
@@ -868,8 +853,7 @@
ImageFormat.JPEG,
RESOLUTION_1440P
)
- val expectedSurfaceConfig =
- SurfaceConfig.create(SurfaceConfig.ConfigType.JPEG, SurfaceConfig.ConfigSize.s1440p)
+ val expectedSurfaceConfig = SurfaceConfig.create(ConfigType.JPEG, ConfigSize.s1440p)
assertThat(surfaceConfig).isEqualTo(expectedSurfaceConfig)
}
@@ -894,12 +878,7 @@
ultraHighMaximumSize
)
)
- .isEqualTo(
- SurfaceConfig.create(
- SurfaceConfig.ConfigType.PRIV,
- SurfaceConfig.ConfigSize.ULTRA_MAXIMUM
- )
- )
+ .isEqualTo(SurfaceConfig.create(ConfigType.PRIV, ConfigSize.ULTRA_MAXIMUM))
assertThat(
supportedSurfaceCombination.transformSurfaceConfig(
CameraMode.DEFAULT,
@@ -907,12 +886,7 @@
ultraHighMaximumSize
)
)
- .isEqualTo(
- SurfaceConfig.create(
- SurfaceConfig.ConfigType.YUV,
- SurfaceConfig.ConfigSize.ULTRA_MAXIMUM
- )
- )
+ .isEqualTo(SurfaceConfig.create(ConfigType.YUV, ConfigSize.ULTRA_MAXIMUM))
assertThat(
supportedSurfaceCombination.transformSurfaceConfig(
CameraMode.DEFAULT,
@@ -920,12 +894,7 @@
ultraHighMaximumSize
)
)
- .isEqualTo(
- SurfaceConfig.create(
- SurfaceConfig.ConfigType.JPEG,
- SurfaceConfig.ConfigSize.ULTRA_MAXIMUM
- )
- )
+ .isEqualTo(SurfaceConfig.create(ConfigType.JPEG, ConfigSize.ULTRA_MAXIMUM))
}
// //////////////////////////////////////////////////////////////////////////////////////////
@@ -937,7 +906,7 @@
/** PRIV/MAXIMUM */
@Test
fun canSelectCorrectSize_singlePrivStream_inLegacyDevice() {
- val privUseCase = createUseCase(UseCaseConfigFactory.CaptureType.VIDEO_CAPTURE)
+ val privUseCase = createUseCase(CaptureType.VIDEO_CAPTURE)
val useCaseExpectedResultMap =
mutableMapOf<UseCase, Size>().apply { put(privUseCase, maximumSize) }
getSuggestedSpecsAndVerify(useCaseExpectedResultMap)
@@ -946,7 +915,7 @@
/** JPEG/MAXIMUM */
@Test
fun canSelectCorrectSize_singleJpegStream_inLegacyDevice() {
- val jpegUseCase = createUseCase(UseCaseConfigFactory.CaptureType.IMAGE_CAPTURE)
+ val jpegUseCase = createUseCase(CaptureType.IMAGE_CAPTURE)
val useCaseExpectedResultMap =
mutableMapOf<UseCase, Size>().apply { put(jpegUseCase, maximumSize) }
getSuggestedSpecsAndVerify(useCaseExpectedResultMap)
@@ -955,7 +924,7 @@
/** YUV/MAXIMUM */
@Test
fun canSelectCorrectSize_singleYuvStream_inLegacyDevice() {
- val yuvUseCase = createUseCase(UseCaseConfigFactory.CaptureType.IMAGE_ANALYSIS)
+ val yuvUseCase = createUseCase(CaptureType.IMAGE_ANALYSIS)
val useCaseExpectedResultMap =
mutableMapOf<UseCase, Size>().apply { put(yuvUseCase, maximumSize) }
getSuggestedSpecsAndVerify(useCaseExpectedResultMap)
@@ -964,8 +933,8 @@
/** PRIV/PREVIEW + JPEG/MAXIMUM */
@Test
fun canSelectCorrectSizes_privPlusJpeg_inLegacyDevice() {
- val privUseCase = createUseCase(UseCaseConfigFactory.CaptureType.PREVIEW)
- val jpegUseCase = createUseCase(UseCaseConfigFactory.CaptureType.IMAGE_CAPTURE)
+ val privUseCase = createUseCase(CaptureType.PREVIEW)
+ val jpegUseCase = createUseCase(CaptureType.IMAGE_CAPTURE)
val useCaseExpectedResultMap =
mutableMapOf<UseCase, Size>().apply {
put(privUseCase, if (Build.VERSION.SDK_INT == 21) RESOLUTION_VGA else previewSize)
@@ -977,8 +946,8 @@
/** YUV/PREVIEW + JPEG/MAXIMUM */
@Test
fun canSelectCorrectSizes_yuvPlusJpeg_inLegacyDevice() {
- val yuvUseCase = createUseCase(UseCaseConfigFactory.CaptureType.IMAGE_ANALYSIS) // YUV
- val jpegUseCase = createUseCase(UseCaseConfigFactory.CaptureType.IMAGE_CAPTURE) // JPEG
+ val yuvUseCase = createUseCase(CaptureType.IMAGE_ANALYSIS) // YUV
+ val jpegUseCase = createUseCase(CaptureType.IMAGE_CAPTURE) // JPEG
val useCaseExpectedResultMap =
mutableMapOf<UseCase, Size>().apply {
put(yuvUseCase, if (Build.VERSION.SDK_INT == 21) RESOLUTION_VGA else previewSize)
@@ -990,8 +959,8 @@
/** PRIV/PREVIEW + PRIV/PREVIEW */
@Test
fun canSelectCorrectSizes_privPlusPriv_inLegacyDevice() {
- val privUseCase1 = createUseCase(UseCaseConfigFactory.CaptureType.PREVIEW) // PRIV
- val privUseCase2 = createUseCase(UseCaseConfigFactory.CaptureType.VIDEO_CAPTURE) // PRIV
+ val privUseCase1 = createUseCase(CaptureType.PREVIEW) // PRIV
+ val privUseCase2 = createUseCase(CaptureType.VIDEO_CAPTURE) // PRIV
val useCaseExpectedResultMap =
mutableMapOf<UseCase, Size>().apply {
put(privUseCase1, if (Build.VERSION.SDK_INT == 21) RESOLUTION_VGA else previewSize)
@@ -1003,8 +972,8 @@
/** PRIV/PREVIEW + YUV/PREVIEW */
@Test
fun canSelectCorrectSizes_privPlusYuv_inLegacyDevice() {
- val privUseCase = createUseCase(UseCaseConfigFactory.CaptureType.PREVIEW) // PRIV
- val yuvUseCase = createUseCase(UseCaseConfigFactory.CaptureType.IMAGE_ANALYSIS) // YUV
+ val privUseCase = createUseCase(CaptureType.PREVIEW) // PRIV
+ val yuvUseCase = createUseCase(CaptureType.IMAGE_ANALYSIS) // YUV
val useCaseExpectedResultMap =
mutableMapOf<UseCase, Size>().apply {
put(privUseCase, if (Build.VERSION.SDK_INT == 21) RESOLUTION_VGA else previewSize)
@@ -1016,9 +985,9 @@
/** PRIV/PREVIEW + YUV/PREVIEW + JPEG/MAXIMUM */
@Test
fun canSelectCorrectSizes_privPlusYuvPlusJpeg_inLegacyDevice() {
- val privUseCase = createUseCase(UseCaseConfigFactory.CaptureType.PREVIEW) // PRIV
- val yuvUseCase = createUseCase(UseCaseConfigFactory.CaptureType.IMAGE_ANALYSIS) // YUV
- val jpegUseCase = createUseCase(UseCaseConfigFactory.CaptureType.IMAGE_CAPTURE) // JPEG
+ val privUseCase = createUseCase(CaptureType.PREVIEW) // PRIV
+ val yuvUseCase = createUseCase(CaptureType.IMAGE_ANALYSIS) // YUV
+ val jpegUseCase = createUseCase(CaptureType.IMAGE_CAPTURE) // JPEG
val useCaseExpectedResultMap =
mutableMapOf<UseCase, Size>().apply {
put(privUseCase, if (Build.VERSION.SDK_INT == 21) RESOLUTION_VGA else previewSize)
@@ -1031,9 +1000,9 @@
/** Unsupported PRIV + JPEG + PRIV for legacy level devices */
@Test
fun throwsException_unsupportedConfiguration_inLegacyDevice() {
- val privUseCase1 = createUseCase(UseCaseConfigFactory.CaptureType.PREVIEW) // PRIV
- val jpegUseCase = createUseCase(UseCaseConfigFactory.CaptureType.IMAGE_CAPTURE) // JPEG
- val privUseCas2 = createUseCase(UseCaseConfigFactory.CaptureType.VIDEO_CAPTURE) // PRIV
+ val privUseCase1 = createUseCase(CaptureType.PREVIEW) // PRIV
+ val jpegUseCase = createUseCase(CaptureType.IMAGE_CAPTURE) // JPEG
+ val privUseCas2 = createUseCase(CaptureType.VIDEO_CAPTURE) // PRIV
val useCaseExpectedResultMap =
mutableMapOf<UseCase, Size>().apply {
put(privUseCase1, RESOLUTION_VGA)
@@ -1054,8 +1023,8 @@
/** PRIV/PREVIEW + PRIV/RECORD */
@Test
fun canSelectCorrectSizes_privPlusPriv_inLimitedDevice() {
- val privUseCase1 = createUseCase(UseCaseConfigFactory.CaptureType.VIDEO_CAPTURE) // PRIV
- val privUseCas2 = createUseCase(UseCaseConfigFactory.CaptureType.PREVIEW) // PRIV
+ val privUseCase1 = createUseCase(CaptureType.VIDEO_CAPTURE) // PRIV
+ val privUseCas2 = createUseCase(CaptureType.PREVIEW) // PRIV
val useCaseExpectedResultMap =
mutableMapOf<UseCase, Size>().apply {
put(privUseCase1, recordSize)
@@ -1063,15 +1032,15 @@
}
getSuggestedSpecsAndVerify(
useCaseExpectedResultMap,
- hardwareLevel = CameraCharacteristics.INFO_SUPPORTED_HARDWARE_LEVEL_LIMITED
+ hardwareLevel = INFO_SUPPORTED_HARDWARE_LEVEL_LIMITED
)
}
/** PRIV/PREVIEW + YUV/RECORD */
@Test
fun canSelectCorrectSizes_privPlusYuv_inLimitedDevice() {
- val privUseCase = createUseCase(UseCaseConfigFactory.CaptureType.PREVIEW) // PRIV
- val yuvUseCase = createUseCase(UseCaseConfigFactory.CaptureType.IMAGE_ANALYSIS) // YUV
+ val privUseCase = createUseCase(CaptureType.PREVIEW) // PRIV
+ val yuvUseCase = createUseCase(CaptureType.IMAGE_ANALYSIS) // YUV
val useCaseExpectedResultMap =
mutableMapOf<UseCase, Size>().apply {
put(privUseCase, previewSize)
@@ -1079,15 +1048,15 @@
}
getSuggestedSpecsAndVerify(
useCaseExpectedResultMap,
- hardwareLevel = CameraCharacteristics.INFO_SUPPORTED_HARDWARE_LEVEL_LIMITED
+ hardwareLevel = INFO_SUPPORTED_HARDWARE_LEVEL_LIMITED
)
}
/** YUV/PREVIEW + YUV/RECORD */
@Test
fun canSelectCorrectSizes_yuvPlusYuv_inLimitedDevice() {
- val yuvUseCase1 = createUseCase(UseCaseConfigFactory.CaptureType.IMAGE_ANALYSIS) // YUV
- val yuvUseCase2 = createUseCase(UseCaseConfigFactory.CaptureType.IMAGE_ANALYSIS) // YUV
+ val yuvUseCase1 = createUseCase(CaptureType.IMAGE_ANALYSIS) // YUV
+ val yuvUseCase2 = createUseCase(CaptureType.IMAGE_ANALYSIS) // YUV
val useCaseExpectedResultMap =
mutableMapOf<UseCase, Size>().apply {
put(yuvUseCase1, recordSize)
@@ -1095,16 +1064,16 @@
}
getSuggestedSpecsAndVerify(
useCaseExpectedResultMap,
- hardwareLevel = CameraCharacteristics.INFO_SUPPORTED_HARDWARE_LEVEL_LIMITED
+ hardwareLevel = INFO_SUPPORTED_HARDWARE_LEVEL_LIMITED
)
}
/** PRIV/PREVIEW + PRIV/RECORD + JPEG/RECORD */
@Test
fun canSelectCorrectSizes_privPlusPrivPlusJpeg_inLimitedDevice() {
- val privUseCase1 = createUseCase(UseCaseConfigFactory.CaptureType.VIDEO_CAPTURE) // PRIV
- val privUseCase2 = createUseCase(UseCaseConfigFactory.CaptureType.PREVIEW) // PRIV
- val jpegUseCase = createUseCase(UseCaseConfigFactory.CaptureType.IMAGE_CAPTURE) // JPEG
+ val privUseCase1 = createUseCase(CaptureType.VIDEO_CAPTURE) // PRIV
+ val privUseCase2 = createUseCase(CaptureType.PREVIEW) // PRIV
+ val jpegUseCase = createUseCase(CaptureType.IMAGE_CAPTURE) // JPEG
val useCaseExpectedResultMap =
mutableMapOf<UseCase, Size>().apply {
put(privUseCase1, recordSize)
@@ -1113,16 +1082,16 @@
}
getSuggestedSpecsAndVerify(
useCaseExpectedResultMap,
- hardwareLevel = CameraCharacteristics.INFO_SUPPORTED_HARDWARE_LEVEL_LIMITED
+ hardwareLevel = INFO_SUPPORTED_HARDWARE_LEVEL_LIMITED
)
}
/** PRIV/PREVIEW + YUV/RECORD + JPEG/RECORD */
@Test
fun canSelectCorrectSizes_privPlusYuvPlusJpeg_inLimitedDevice() {
- val privUseCase = createUseCase(UseCaseConfigFactory.CaptureType.PREVIEW) // PRIV
- val yuvUseCase = createUseCase(UseCaseConfigFactory.CaptureType.IMAGE_ANALYSIS) // YUV
- val jpegUseCase = createUseCase(UseCaseConfigFactory.CaptureType.IMAGE_CAPTURE) // JPEG
+ val privUseCase = createUseCase(CaptureType.PREVIEW) // PRIV
+ val yuvUseCase = createUseCase(CaptureType.IMAGE_ANALYSIS) // YUV
+ val jpegUseCase = createUseCase(CaptureType.IMAGE_CAPTURE) // JPEG
val useCaseExpectedResultMap =
mutableMapOf<UseCase, Size>().apply {
put(privUseCase, previewSize)
@@ -1131,16 +1100,16 @@
}
getSuggestedSpecsAndVerify(
useCaseExpectedResultMap,
- hardwareLevel = CameraCharacteristics.INFO_SUPPORTED_HARDWARE_LEVEL_LIMITED
+ hardwareLevel = INFO_SUPPORTED_HARDWARE_LEVEL_LIMITED
)
}
/** YUV/PREVIEW + YUV/PREVIEW + JPEG/MAXIMUM */
@Test
fun canSelectCorrectSizes_yuvPlusYuvPlusJpeg_inLimitedDevice() {
- val yuvUseCase1 = createUseCase(UseCaseConfigFactory.CaptureType.IMAGE_ANALYSIS) // YUV
- val yuvUseCase2 = createUseCase(UseCaseConfigFactory.CaptureType.IMAGE_ANALYSIS) // YUV
- val jpegUseCase = createUseCase(UseCaseConfigFactory.CaptureType.IMAGE_CAPTURE) // JPEG
+ val yuvUseCase1 = createUseCase(CaptureType.IMAGE_ANALYSIS) // YUV
+ val yuvUseCase2 = createUseCase(CaptureType.IMAGE_ANALYSIS) // YUV
+ val jpegUseCase = createUseCase(CaptureType.IMAGE_CAPTURE) // JPEG
val useCaseExpectedResultMap =
mutableMapOf<UseCase, Size>().apply {
put(yuvUseCase1, previewSize)
@@ -1149,16 +1118,16 @@
}
getSuggestedSpecsAndVerify(
useCaseExpectedResultMap,
- hardwareLevel = CameraCharacteristics.INFO_SUPPORTED_HARDWARE_LEVEL_LIMITED
+ hardwareLevel = INFO_SUPPORTED_HARDWARE_LEVEL_LIMITED
)
}
/** Unsupported YUV + PRIV + YUV for limited level devices */
@Test
fun throwsException_unsupportedConfiguration_inLimitedDevice() {
- val yuvUseCase1 = createUseCase(UseCaseConfigFactory.CaptureType.IMAGE_ANALYSIS) // YUV
- val privUseCase = createUseCase(UseCaseConfigFactory.CaptureType.PREVIEW) // PRIV
- val yuvUseCase2 = createUseCase(UseCaseConfigFactory.CaptureType.IMAGE_ANALYSIS) // YUV
+ val yuvUseCase1 = createUseCase(CaptureType.IMAGE_ANALYSIS) // YUV
+ val privUseCase = createUseCase(CaptureType.PREVIEW) // PRIV
+ val yuvUseCase2 = createUseCase(CaptureType.IMAGE_ANALYSIS) // YUV
val useCaseExpectedResultMap =
mutableMapOf<UseCase, Size>().apply {
put(yuvUseCase1, RESOLUTION_VGA)
@@ -1168,7 +1137,7 @@
Assert.assertThrows(IllegalArgumentException::class.java) {
getSuggestedSpecsAndVerify(
useCaseExpectedResultMap,
- hardwareLevel = CameraCharacteristics.INFO_SUPPORTED_HARDWARE_LEVEL_LIMITED
+ hardwareLevel = INFO_SUPPORTED_HARDWARE_LEVEL_LIMITED
)
}
}
@@ -1182,8 +1151,8 @@
/** PRIV/PREVIEW + PRIV/MAXIMUM */
@Test
fun canSelectCorrectSizes_privPlusPriv_inFullDevice() {
- val privUseCase1 = createUseCase(UseCaseConfigFactory.CaptureType.VIDEO_CAPTURE) // PRIV
- val privUseCase2 = createUseCase(UseCaseConfigFactory.CaptureType.PREVIEW) // PRIV
+ val privUseCase1 = createUseCase(CaptureType.VIDEO_CAPTURE) // PRIV
+ val privUseCase2 = createUseCase(CaptureType.PREVIEW) // PRIV
val useCaseExpectedResultMap =
mutableMapOf<UseCase, Size>().apply {
put(privUseCase1, maximumSize)
@@ -1198,8 +1167,8 @@
/** PRIV/PREVIEW + YUV/MAXIMUM */
@Test
fun canSelectCorrectSizes_privPlusYuv_inFullDevice() {
- val privUseCase = createUseCase(UseCaseConfigFactory.CaptureType.PREVIEW) // PRIV
- val yuvUseCase = createUseCase(UseCaseConfigFactory.CaptureType.IMAGE_ANALYSIS) // YUV
+ val privUseCase = createUseCase(CaptureType.PREVIEW) // PRIV
+ val yuvUseCase = createUseCase(CaptureType.IMAGE_ANALYSIS) // YUV
val useCaseExpectedResultMap =
mutableMapOf<UseCase, Size>().apply {
put(privUseCase, previewSize)
@@ -1214,8 +1183,8 @@
/** YUV/PREVIEW + YUV/MAXIMUM */
@Test
fun canSelectCorrectSizes_yuvPlusYuv_inFullDevice() {
- val yuvUseCase1 = createUseCase(UseCaseConfigFactory.CaptureType.IMAGE_ANALYSIS) // YUV
- val yuvUseCase2 = createUseCase(UseCaseConfigFactory.CaptureType.IMAGE_ANALYSIS) // YUV
+ val yuvUseCase1 = createUseCase(CaptureType.IMAGE_ANALYSIS) // YUV
+ val yuvUseCase2 = createUseCase(CaptureType.IMAGE_ANALYSIS) // YUV
val useCaseExpectedResultMap =
mutableMapOf<UseCase, Size>().apply {
put(yuvUseCase1, maximumSize)
@@ -1230,9 +1199,9 @@
/** PRIV/PREVIEW + PRIV/PREVIEW + JPEG/MAXIMUM */
@Test
fun canSelectCorrectSizes_privPlusPrivPlusJpeg_inFullDevice() {
- val jpegUseCase = createUseCase(UseCaseConfigFactory.CaptureType.IMAGE_CAPTURE) // JPEG
- val privUseCase1 = createUseCase(UseCaseConfigFactory.CaptureType.VIDEO_CAPTURE) // PRIV
- val privUseCase2 = createUseCase(UseCaseConfigFactory.CaptureType.PREVIEW) // PRIV
+ val jpegUseCase = createUseCase(CaptureType.IMAGE_CAPTURE) // JPEG
+ val privUseCase1 = createUseCase(CaptureType.VIDEO_CAPTURE) // PRIV
+ val privUseCase2 = createUseCase(CaptureType.PREVIEW) // PRIV
val useCaseExpectedResultMap =
mutableMapOf<UseCase, Size>().apply {
put(jpegUseCase, maximumSize)
@@ -1248,9 +1217,9 @@
/** YUV/VGA + PRIV/PREVIEW + YUV/MAXIMUM */
@Test
fun canSelectCorrectSizes_yuvPlusPrivPlusYuv_inFullDevice() {
- val privUseCase = createUseCase(UseCaseConfigFactory.CaptureType.PREVIEW) // PRIV
- val yuvUseCase1 = createUseCase(UseCaseConfigFactory.CaptureType.IMAGE_ANALYSIS) // YUV
- val yuvUseCase2 = createUseCase(UseCaseConfigFactory.CaptureType.IMAGE_ANALYSIS) // YUV
+ val privUseCase = createUseCase(CaptureType.PREVIEW) // PRIV
+ val yuvUseCase1 = createUseCase(CaptureType.IMAGE_ANALYSIS) // YUV
+ val yuvUseCase2 = createUseCase(CaptureType.IMAGE_ANALYSIS) // YUV
val useCaseExpectedResultMap =
mutableMapOf<UseCase, Size>().apply {
put(privUseCase, previewSize)
@@ -1266,9 +1235,9 @@
/** YUV/VGA + YUV/PREVIEW + YUV/MAXIMUM */
@Test
fun canSelectCorrectSizes_yuvPlusYuvPlusYuv_inFullDevice() {
- val yuvUseCase1 = createUseCase(UseCaseConfigFactory.CaptureType.IMAGE_ANALYSIS) // YUV
- val yuvUseCase2 = createUseCase(UseCaseConfigFactory.CaptureType.IMAGE_ANALYSIS) // YUV
- val yuvUseCase3 = createUseCase(UseCaseConfigFactory.CaptureType.IMAGE_ANALYSIS) // YUV
+ val yuvUseCase1 = createUseCase(CaptureType.IMAGE_ANALYSIS) // YUV
+ val yuvUseCase2 = createUseCase(CaptureType.IMAGE_ANALYSIS) // YUV
+ val yuvUseCase3 = createUseCase(CaptureType.IMAGE_ANALYSIS) // YUV
val useCaseExpectedResultMap =
mutableMapOf<UseCase, Size>().apply {
put(yuvUseCase1, maximumSize)
@@ -1284,9 +1253,9 @@
/** Unsupported PRIV + PRIV + YUV + RAW for full level devices */
@Test
fun throwsException_unsupportedConfiguration_inFullDevice() {
- val privUseCase1 = createUseCase(UseCaseConfigFactory.CaptureType.VIDEO_CAPTURE) // PRIV
- val privUseCase2 = createUseCase(UseCaseConfigFactory.CaptureType.PREVIEW) // PRIV
- val yuvUseCase = createUseCase(UseCaseConfigFactory.CaptureType.IMAGE_ANALYSIS) // YUV
+ val privUseCase1 = createUseCase(CaptureType.VIDEO_CAPTURE) // PRIV
+ val privUseCase2 = createUseCase(CaptureType.PREVIEW) // PRIV
+ val yuvUseCase = createUseCase(CaptureType.IMAGE_ANALYSIS) // YUV
val rawUseCase = createRawUseCase() // RAW
val useCaseExpectedResultMap =
mutableMapOf<UseCase, Size>().apply {
@@ -1298,7 +1267,7 @@
assertThrows(IllegalArgumentException::class.java) {
getSuggestedSpecsAndVerify(
useCaseExpectedResultMap,
- hardwareLevel = CameraCharacteristics.INFO_SUPPORTED_HARDWARE_LEVEL_LIMITED
+ hardwareLevel = INFO_SUPPORTED_HARDWARE_LEVEL_LIMITED
)
}
}
@@ -1312,9 +1281,9 @@
/** PRIV/PREVIEW + PRIV/VGA + YUV/MAXIMUM + RAW/MAXIMUM */
@Test
fun canSelectCorrectSizes_privPlusPrivPlusYuvPlusRaw_inLevel3Device() {
- val privUseCase1 = createUseCase(UseCaseConfigFactory.CaptureType.VIDEO_CAPTURE) // PRIV
- val privUseCase2 = createUseCase(UseCaseConfigFactory.CaptureType.PREVIEW) // PRIV
- val yuvUseCase = createUseCase(UseCaseConfigFactory.CaptureType.IMAGE_ANALYSIS) // YUV
+ val privUseCase1 = createUseCase(CaptureType.VIDEO_CAPTURE) // PRIV
+ val privUseCase2 = createUseCase(CaptureType.PREVIEW) // PRIV
+ val yuvUseCase = createUseCase(CaptureType.IMAGE_ANALYSIS) // YUV
val rawUseCase = createRawUseCase() // RAW
val useCaseExpectedResultMap =
mutableMapOf<UseCase, Size>().apply {
@@ -1333,9 +1302,9 @@
/** PRIV/PREVIEW + PRIV/VGA + JPEG/MAXIMUM + RAW/MAXIMUM */
@Test
fun canSelectCorrectSizes_privPlusPrivPlusJpegPlusRaw_inLevel3Device() {
- val privUseCase1 = createUseCase(UseCaseConfigFactory.CaptureType.VIDEO_CAPTURE) // PRIV
- val privUseCase2 = createUseCase(UseCaseConfigFactory.CaptureType.PREVIEW) // PRIV
- val jpegUseCase = createUseCase(UseCaseConfigFactory.CaptureType.IMAGE_CAPTURE) // JPEG
+ val privUseCase1 = createUseCase(CaptureType.VIDEO_CAPTURE) // PRIV
+ val privUseCase2 = createUseCase(CaptureType.PREVIEW) // PRIV
+ val jpegUseCase = createUseCase(CaptureType.IMAGE_CAPTURE) // JPEG
val rawUseCase = createRawUseCase() // RAW
val useCaseExpectedResultMap =
mutableMapOf<UseCase, Size>().apply {
@@ -1354,9 +1323,9 @@
/** Unsupported PRIV + YUV + YUV + RAW for level-3 devices */
@Test
fun throwsException_unsupportedConfiguration_inLevel3Device() {
- val privUseCase = createUseCase(UseCaseConfigFactory.CaptureType.PREVIEW) // PRIV
- val yuvUseCase1 = createUseCase(UseCaseConfigFactory.CaptureType.IMAGE_ANALYSIS) // YUV
- val yuvUseCase2 = createUseCase(UseCaseConfigFactory.CaptureType.IMAGE_ANALYSIS) // YUV
+ val privUseCase = createUseCase(CaptureType.PREVIEW) // PRIV
+ val yuvUseCase1 = createUseCase(CaptureType.IMAGE_ANALYSIS) // YUV
+ val yuvUseCase2 = createUseCase(CaptureType.IMAGE_ANALYSIS) // YUV
val rawUseCase = createRawUseCase() // RAW
val useCaseExpectedResultMap =
mutableMapOf<UseCase, Size>().apply {
@@ -1382,8 +1351,8 @@
/** PRIV/PREVIEW + PRIV/MAXIMUM */
@Test
fun canSelectCorrectSizes_privPlusPriv_inLimitedDevice_withBurstCapability() {
- val privUseCase1 = createUseCase(UseCaseConfigFactory.CaptureType.VIDEO_CAPTURE) // PRIV
- val privUseCase2 = createUseCase(UseCaseConfigFactory.CaptureType.PREVIEW) // PRIV
+ val privUseCase1 = createUseCase(CaptureType.VIDEO_CAPTURE) // PRIV
+ val privUseCase2 = createUseCase(CaptureType.PREVIEW) // PRIV
val useCaseExpectedResultMap =
mutableMapOf<UseCase, Size>().apply {
put(privUseCase1, maximumSize)
@@ -1391,7 +1360,7 @@
}
getSuggestedSpecsAndVerify(
useCaseExpectedResultMap,
- hardwareLevel = CameraCharacteristics.INFO_SUPPORTED_HARDWARE_LEVEL_LIMITED,
+ hardwareLevel = INFO_SUPPORTED_HARDWARE_LEVEL_LIMITED,
capabilities =
intArrayOf(CameraCharacteristics.REQUEST_AVAILABLE_CAPABILITIES_BURST_CAPTURE)
)
@@ -1400,8 +1369,8 @@
/** PRIV/PREVIEW + YUV/MAXIMUM */
@Test
fun canSelectCorrectSizes_privPlusYuv_inLimitedDevice_withBurstCapability() {
- val privUseCase = createUseCase(UseCaseConfigFactory.CaptureType.PREVIEW) // PRIV
- val yuvUseCase = createUseCase(UseCaseConfigFactory.CaptureType.IMAGE_ANALYSIS) // YUV
+ val privUseCase = createUseCase(CaptureType.PREVIEW) // PRIV
+ val yuvUseCase = createUseCase(CaptureType.IMAGE_ANALYSIS) // YUV
val useCaseExpectedResultMap =
mutableMapOf<UseCase, Size>().apply {
put(privUseCase, previewSize)
@@ -1409,7 +1378,7 @@
}
getSuggestedSpecsAndVerify(
useCaseExpectedResultMap,
- hardwareLevel = CameraCharacteristics.INFO_SUPPORTED_HARDWARE_LEVEL_LIMITED,
+ hardwareLevel = INFO_SUPPORTED_HARDWARE_LEVEL_LIMITED,
capabilities =
intArrayOf(CameraCharacteristics.REQUEST_AVAILABLE_CAPABILITIES_BURST_CAPTURE)
)
@@ -1418,8 +1387,8 @@
/** YUV/PREVIEW + YUV/MAXIMUM */
@Test
fun canSelectCorrectSizes_yuvPlusYuv_inLimitedDevice_withBurstCapability() {
- val yuvUseCase1 = createUseCase(UseCaseConfigFactory.CaptureType.IMAGE_ANALYSIS) // YUV
- val yuvUseCase2 = createUseCase(UseCaseConfigFactory.CaptureType.IMAGE_ANALYSIS) // YUV
+ val yuvUseCase1 = createUseCase(CaptureType.IMAGE_ANALYSIS) // YUV
+ val yuvUseCase2 = createUseCase(CaptureType.IMAGE_ANALYSIS) // YUV
val useCaseExpectedResultMap =
mutableMapOf<UseCase, Size>().apply {
put(yuvUseCase1, maximumSize)
@@ -1427,7 +1396,7 @@
}
getSuggestedSpecsAndVerify(
useCaseExpectedResultMap,
- hardwareLevel = CameraCharacteristics.INFO_SUPPORTED_HARDWARE_LEVEL_LIMITED,
+ hardwareLevel = INFO_SUPPORTED_HARDWARE_LEVEL_LIMITED,
capabilities =
intArrayOf(CameraCharacteristics.REQUEST_AVAILABLE_CAPABILITIES_BURST_CAPTURE)
)
@@ -1447,7 +1416,7 @@
mutableMapOf<UseCase, Size>().apply { put(rawUseCase, maximumSize) }
getSuggestedSpecsAndVerify(
useCaseExpectedResultMap,
- hardwareLevel = CameraCharacteristics.INFO_SUPPORTED_HARDWARE_LEVEL_LIMITED,
+ hardwareLevel = INFO_SUPPORTED_HARDWARE_LEVEL_LIMITED,
capabilities = intArrayOf(CameraCharacteristics.REQUEST_AVAILABLE_CAPABILITIES_RAW)
)
}
@@ -1455,7 +1424,7 @@
/** PRIV/PREVIEW + RAW/MAXIMUM */
@Test
fun canSelectCorrectSizes_privPlusRAW_inLimitedDevice_withRawCapability() {
- val privUseCase = createUseCase(UseCaseConfigFactory.CaptureType.PREVIEW) // PRIV
+ val privUseCase = createUseCase(CaptureType.PREVIEW) // PRIV
val rawUseCase = createRawUseCase() // RAW
val useCaseExpectedResultMap =
mutableMapOf<UseCase, Size>().apply {
@@ -1464,7 +1433,7 @@
}
getSuggestedSpecsAndVerify(
useCaseExpectedResultMap,
- hardwareLevel = CameraCharacteristics.INFO_SUPPORTED_HARDWARE_LEVEL_LIMITED,
+ hardwareLevel = INFO_SUPPORTED_HARDWARE_LEVEL_LIMITED,
capabilities = intArrayOf(CameraCharacteristics.REQUEST_AVAILABLE_CAPABILITIES_RAW)
)
}
@@ -1472,8 +1441,8 @@
/** PRIV/PREVIEW + PRIV/PREVIEW + RAW/MAXIMUM */
@Test
fun canSelectCorrectSizes_privPlusPrivPlusRAW_inLimitedDevice_withRawCapability() {
- val privUseCase1 = createUseCase(UseCaseConfigFactory.CaptureType.VIDEO_CAPTURE) // PRIV
- val privUseCase2 = createUseCase(UseCaseConfigFactory.CaptureType.PREVIEW) // PRIV
+ val privUseCase1 = createUseCase(CaptureType.VIDEO_CAPTURE) // PRIV
+ val privUseCase2 = createUseCase(CaptureType.PREVIEW) // PRIV
val rawUseCase = createRawUseCase() // RAW
val useCaseExpectedResultMap =
mutableMapOf<UseCase, Size>().apply {
@@ -1483,7 +1452,7 @@
}
getSuggestedSpecsAndVerify(
useCaseExpectedResultMap,
- hardwareLevel = CameraCharacteristics.INFO_SUPPORTED_HARDWARE_LEVEL_LIMITED,
+ hardwareLevel = INFO_SUPPORTED_HARDWARE_LEVEL_LIMITED,
capabilities = intArrayOf(CameraCharacteristics.REQUEST_AVAILABLE_CAPABILITIES_RAW)
)
}
@@ -1491,8 +1460,8 @@
/** PRIV/PREVIEW + YUV/PREVIEW + RAW/MAXIMUM */
@Test
fun canSelectCorrectSizes_privPlusYuvPlusRAW_inLimitedDevice_withRawCapability() {
- val privUseCase = createUseCase(UseCaseConfigFactory.CaptureType.PREVIEW) // PRIV
- val yuvUseCase = createUseCase(UseCaseConfigFactory.CaptureType.IMAGE_ANALYSIS) // YUV
+ val privUseCase = createUseCase(CaptureType.PREVIEW) // PRIV
+ val yuvUseCase = createUseCase(CaptureType.IMAGE_ANALYSIS) // YUV
val rawUseCase = createRawUseCase() // RAW
val useCaseExpectedResultMap =
mutableMapOf<UseCase, Size>().apply {
@@ -1502,7 +1471,7 @@
}
getSuggestedSpecsAndVerify(
useCaseExpectedResultMap,
- hardwareLevel = CameraCharacteristics.INFO_SUPPORTED_HARDWARE_LEVEL_LIMITED,
+ hardwareLevel = INFO_SUPPORTED_HARDWARE_LEVEL_LIMITED,
capabilities = intArrayOf(CameraCharacteristics.REQUEST_AVAILABLE_CAPABILITIES_RAW)
)
}
@@ -1510,8 +1479,8 @@
/** YUV/PREVIEW + YUV/PREVIEW + RAW/MAXIMUM */
@Test
fun canSelectCorrectSizes_yuvPlusYuvPlusRAW_inLimitedDevice_withRawCapability() {
- val yuvUseCase1 = createUseCase(UseCaseConfigFactory.CaptureType.IMAGE_ANALYSIS) // YUV
- val yuvUseCase2 = createUseCase(UseCaseConfigFactory.CaptureType.IMAGE_ANALYSIS) // YUV
+ val yuvUseCase1 = createUseCase(CaptureType.IMAGE_ANALYSIS) // YUV
+ val yuvUseCase2 = createUseCase(CaptureType.IMAGE_ANALYSIS) // YUV
val rawUseCase = createRawUseCase() // RAW
val useCaseExpectedResultMap =
mutableMapOf<UseCase, Size>().apply {
@@ -1521,7 +1490,7 @@
}
getSuggestedSpecsAndVerify(
useCaseExpectedResultMap,
- hardwareLevel = CameraCharacteristics.INFO_SUPPORTED_HARDWARE_LEVEL_LIMITED,
+ hardwareLevel = INFO_SUPPORTED_HARDWARE_LEVEL_LIMITED,
capabilities = intArrayOf(CameraCharacteristics.REQUEST_AVAILABLE_CAPABILITIES_RAW)
)
}
@@ -1529,8 +1498,8 @@
/** PRIV/PREVIEW + JPEG/MAXIMUM + RAW/MAXIMUM */
@Test
fun canSelectCorrectSizes_privPlusJpegPlusRAW_inLimitedDevice_withRawCapability() {
- val privUseCase = createUseCase(UseCaseConfigFactory.CaptureType.PREVIEW) // PRIV
- val jpegUseCase = createUseCase(UseCaseConfigFactory.CaptureType.IMAGE_CAPTURE) // JPEG
+ val privUseCase = createUseCase(CaptureType.PREVIEW) // PRIV
+ val jpegUseCase = createUseCase(CaptureType.IMAGE_CAPTURE) // JPEG
val rawUseCase = createRawUseCase() // RAW
val useCaseExpectedResultMap =
mutableMapOf<UseCase, Size>().apply {
@@ -1540,7 +1509,7 @@
}
getSuggestedSpecsAndVerify(
useCaseExpectedResultMap,
- hardwareLevel = CameraCharacteristics.INFO_SUPPORTED_HARDWARE_LEVEL_LIMITED,
+ hardwareLevel = INFO_SUPPORTED_HARDWARE_LEVEL_LIMITED,
capabilities = intArrayOf(CameraCharacteristics.REQUEST_AVAILABLE_CAPABILITIES_RAW)
)
}
@@ -1548,8 +1517,8 @@
/** YUV/PREVIEW + JPEG/MAXIMUM + RAW/MAXIMUM */
@Test
fun canSelectCorrectSizes_yuvPlusJpegPlusRAW_inLimitedDevice_withRawCapability() {
- val yuvUseCase = createUseCase(UseCaseConfigFactory.CaptureType.IMAGE_ANALYSIS) // YUV
- val jpegUseCase = createUseCase(UseCaseConfigFactory.CaptureType.IMAGE_CAPTURE) // JPEG
+ val yuvUseCase = createUseCase(CaptureType.IMAGE_ANALYSIS) // YUV
+ val jpegUseCase = createUseCase(CaptureType.IMAGE_CAPTURE) // JPEG
val rawUseCase = createRawUseCase() // RAW
val useCaseExpectedResultMap =
mutableMapOf<UseCase, Size>().apply {
@@ -1559,7 +1528,7 @@
}
getSuggestedSpecsAndVerify(
useCaseExpectedResultMap,
- hardwareLevel = CameraCharacteristics.INFO_SUPPORTED_HARDWARE_LEVEL_LIMITED,
+ hardwareLevel = INFO_SUPPORTED_HARDWARE_LEVEL_LIMITED,
capabilities = intArrayOf(CameraCharacteristics.REQUEST_AVAILABLE_CAPABILITIES_RAW)
)
}
@@ -1861,10 +1830,7 @@
@Config(minSdk = Build.VERSION_CODES.TIRAMISU)
@Test
fun check10BitDynamicRangeCombinationsSupported() {
- setupCamera(
- capabilities =
- intArrayOf(CameraMetadata.REQUEST_AVAILABLE_CAPABILITIES_DYNAMIC_RANGE_TEN_BIT)
- )
+ setupCamera(capabilities = intArrayOf(REQUEST_AVAILABLE_CAPABILITIES_DYNAMIC_RANGE_TEN_BIT))
val supportedSurfaceCombination =
SupportedSurfaceCombination(context, fakeCameraMetadata, mockEncoderProfilesAdapter)
@@ -1873,7 +1839,7 @@
supportedSurfaceCombination.checkSupported(
SupportedSurfaceCombination.FeatureSettings(
CameraMode.DEFAULT,
- DynamicRange.BIT_DEPTH_10_BIT
+ BIT_DEPTH_10_BIT
),
it.surfaceConfigList
)
@@ -1886,10 +1852,7 @@
@Test
fun getSupportedStreamSpecThrows_whenUsingUnsupportedDynamicRange() {
val useCase =
- createUseCase(
- UseCaseConfigFactory.CaptureType.PREVIEW,
- dynamicRange = DynamicRange.HDR_UNSPECIFIED_10_BIT
- )
+ createUseCase(CaptureType.PREVIEW, dynamicRange = DynamicRange.HDR_UNSPECIFIED_10_BIT)
val useCaseExpectedResultMap =
mapOf(
useCase to Size(0, 0) // Should throw before verifying size
@@ -1898,8 +1861,7 @@
Assert.assertThrows(IllegalArgumentException::class.java) {
getSuggestedSpecsAndVerify(
useCaseExpectedResultMap,
- capabilities =
- intArrayOf(CameraMetadata.REQUEST_AVAILABLE_CAPABILITIES_DYNAMIC_RANGE_TEN_BIT)
+ capabilities = intArrayOf(REQUEST_AVAILABLE_CAPABILITIES_DYNAMIC_RANGE_TEN_BIT)
)
}
}
@@ -1910,10 +1872,7 @@
Shadows.shadowOf(context.packageManager)
.setSystemFeature(PackageManager.FEATURE_CAMERA_CONCURRENT, true)
val useCase =
- createUseCase(
- UseCaseConfigFactory.CaptureType.PREVIEW,
- dynamicRange = DynamicRange.HDR_UNSPECIFIED_10_BIT
- )
+ createUseCase(CaptureType.PREVIEW, dynamicRange = DynamicRange.HDR_UNSPECIFIED_10_BIT)
val useCaseExpectedSizeMap =
mapOf(
useCase to Size(0, 0) // Should throw before verifying size
@@ -1934,10 +1893,7 @@
Shadows.shadowOf(context.packageManager)
.setSystemFeature(PackageManager.FEATURE_CAMERA_CONCURRENT, true)
val useCase =
- createUseCase(
- UseCaseConfigFactory.CaptureType.PREVIEW,
- dynamicRange = DynamicRange.HDR_UNSPECIFIED_10_BIT
- )
+ createUseCase(CaptureType.PREVIEW, dynamicRange = DynamicRange.HDR_UNSPECIFIED_10_BIT)
val useCaseExpectedSizeMap =
mapOf(
useCase to Size(0, 0) // Should throw before verifying size
@@ -1956,18 +1912,14 @@
@Test
fun dynamicRangeResolver_returnsHlg_dueToMandatory10Bit() {
val useCase =
- createUseCase(
- UseCaseConfigFactory.CaptureType.PREVIEW,
- dynamicRange = DynamicRange.HDR_UNSPECIFIED_10_BIT
- )
+ createUseCase(CaptureType.PREVIEW, dynamicRange = DynamicRange.HDR_UNSPECIFIED_10_BIT)
val useCaseExpectedSizeMap = mapOf(useCase to maximumSize)
- val useCaseExpectedDynamicRangeMap = mapOf(useCase to DynamicRange.HLG_10_BIT)
+ val useCaseExpectedDynamicRangeMap = mapOf(useCase to HLG_10_BIT)
getSuggestedSpecsAndVerify(
useCaseExpectedSizeMap,
dynamicRangeProfiles = HLG10_CONSTRAINED,
- capabilities =
- intArrayOf(CameraMetadata.REQUEST_AVAILABLE_CAPABILITIES_DYNAMIC_RANGE_TEN_BIT),
+ capabilities = intArrayOf(REQUEST_AVAILABLE_CAPABILITIES_DYNAMIC_RANGE_TEN_BIT),
useCasesExpectedDynamicRangeMap = useCaseExpectedDynamicRangeMap
)
}
@@ -1976,18 +1928,14 @@
@Test
fun dynamicRangeResolver_returnsHdr10_dueToRecommended10BitDynamicRange() {
val useCase =
- createUseCase(
- UseCaseConfigFactory.CaptureType.PREVIEW,
- dynamicRange = DynamicRange.HDR_UNSPECIFIED_10_BIT
- )
+ createUseCase(CaptureType.PREVIEW, dynamicRange = DynamicRange.HDR_UNSPECIFIED_10_BIT)
val useCaseExpectedSizeMap = mapOf(useCase to maximumSize)
val useCaseExpectedDynamicRangeMap = mapOf(useCase to DynamicRange.HDR10_10_BIT)
getSuggestedSpecsAndVerify(
useCaseExpectedSizeMap,
dynamicRangeProfiles = HDR10_UNCONSTRAINED,
- capabilities =
- intArrayOf(CameraMetadata.REQUEST_AVAILABLE_CAPABILITIES_DYNAMIC_RANGE_TEN_BIT),
+ capabilities = intArrayOf(REQUEST_AVAILABLE_CAPABILITIES_DYNAMIC_RANGE_TEN_BIT),
useCasesExpectedDynamicRangeMap = useCaseExpectedDynamicRangeMap,
default10BitProfile = DynamicRangeProfiles.HDR10
)
@@ -1998,7 +1946,7 @@
fun dynamicRangeResolver_returnsDolbyVision8_dueToSupportedDynamicRanges() {
val useCase =
createUseCase(
- UseCaseConfigFactory.CaptureType.PREVIEW,
+ CaptureType.PREVIEW,
dynamicRange =
DynamicRange(
DynamicRange.ENCODING_HDR_UNSPECIFIED,
@@ -2020,7 +1968,7 @@
fun dynamicRangeResolver_returnsDolbyVision8_fromUnspecifiedBitDepth() {
val useCase =
createUseCase(
- UseCaseConfigFactory.CaptureType.PREVIEW,
+ CaptureType.PREVIEW,
dynamicRange =
DynamicRange(
DynamicRange.ENCODING_DOLBY_VISION,
@@ -2042,7 +1990,7 @@
fun dynamicRangeResolver_returnsDolbyVision10_fromUnspecifiedBitDepth() {
val useCase =
createUseCase(
- UseCaseConfigFactory.CaptureType.PREVIEW,
+ CaptureType.PREVIEW,
dynamicRange =
DynamicRange(
DynamicRange.ENCODING_DOLBY_VISION,
@@ -2055,8 +2003,7 @@
getSuggestedSpecsAndVerify(
useCaseExpectedSizeMap,
dynamicRangeProfiles = DOLBY_VISION_10B_UNCONSTRAINED,
- capabilities =
- intArrayOf(CameraMetadata.REQUEST_AVAILABLE_CAPABILITIES_DYNAMIC_RANGE_TEN_BIT),
+ capabilities = intArrayOf(REQUEST_AVAILABLE_CAPABILITIES_DYNAMIC_RANGE_TEN_BIT),
useCasesExpectedDynamicRangeMap = useCaseExpectedDynamicRangeMap
)
}
@@ -2066,7 +2013,7 @@
fun dynamicRangeResolver_returnsDolbyVision8_fromUnspecifiedHdrWithUnspecifiedBitDepth() {
val useCase =
createUseCase(
- UseCaseConfigFactory.CaptureType.PREVIEW,
+ CaptureType.PREVIEW,
dynamicRange =
DynamicRange(
DynamicRange.ENCODING_HDR_UNSPECIFIED,
@@ -2088,7 +2035,7 @@
fun dynamicRangeResolver_returnsDolbyVision10_fromUnspecifiedHdrWithUnspecifiedBitDepth() {
val useCase =
createUseCase(
- UseCaseConfigFactory.CaptureType.PREVIEW,
+ CaptureType.PREVIEW,
dynamicRange =
DynamicRange(
DynamicRange.ENCODING_HDR_UNSPECIFIED,
@@ -2101,8 +2048,7 @@
getSuggestedSpecsAndVerify(
useCaseExpectedSizeMap,
dynamicRangeProfiles = DOLBY_VISION_CONSTRAINED,
- capabilities =
- intArrayOf(CameraMetadata.REQUEST_AVAILABLE_CAPABILITIES_DYNAMIC_RANGE_TEN_BIT),
+ capabilities = intArrayOf(REQUEST_AVAILABLE_CAPABILITIES_DYNAMIC_RANGE_TEN_BIT),
useCasesExpectedDynamicRangeMap = useCaseExpectedDynamicRangeMap,
default10BitProfile = DynamicRangeProfiles.DOLBY_VISION_10B_HDR_OEM
)
@@ -2111,14 +2057,10 @@
@Config(minSdk = Build.VERSION_CODES.TIRAMISU)
@Test
fun dynamicRangeResolver_returnsDolbyVision8_withUndefinedBitDepth_andFullyDefinedHlg10() {
- val videoUseCase =
- createUseCase(
- UseCaseConfigFactory.CaptureType.VIDEO_CAPTURE,
- dynamicRange = DynamicRange.HLG_10_BIT
- )
+ val videoUseCase = createUseCase(CaptureType.VIDEO_CAPTURE, dynamicRange = HLG_10_BIT)
val previewUseCase =
createUseCase(
- UseCaseConfigFactory.CaptureType.PREVIEW,
+ CaptureType.PREVIEW,
dynamicRange =
DynamicRange(
DynamicRange.ENCODING_DOLBY_VISION,
@@ -2128,16 +2070,12 @@
val useCaseExpectedSizeMap =
mutableMapOf(videoUseCase to recordSize, previewUseCase to previewSize)
val useCaseExpectedDynamicRangeMap =
- mapOf(
- videoUseCase to DynamicRange.HLG_10_BIT,
- previewUseCase to DynamicRange.DOLBY_VISION_8_BIT
- )
+ mapOf(videoUseCase to HLG_10_BIT, previewUseCase to DynamicRange.DOLBY_VISION_8_BIT)
getSuggestedSpecsAndVerify(
useCaseExpectedSizeMap,
dynamicRangeProfiles = DOLBY_VISION_8B_UNCONSTRAINED_HLG10_UNCONSTRAINED,
- capabilities =
- intArrayOf(CameraMetadata.REQUEST_AVAILABLE_CAPABILITIES_DYNAMIC_RANGE_TEN_BIT),
+ capabilities = intArrayOf(REQUEST_AVAILABLE_CAPABILITIES_DYNAMIC_RANGE_TEN_BIT),
useCasesExpectedDynamicRangeMap = useCaseExpectedDynamicRangeMap
)
}
@@ -2148,13 +2086,13 @@
// VideoCapture partially defined dynamic range
val videoUseCase =
createUseCase(
- UseCaseConfigFactory.CaptureType.VIDEO_CAPTURE,
+ CaptureType.VIDEO_CAPTURE,
dynamicRange = DynamicRange.HDR_UNSPECIFIED_10_BIT
)
// Preview fully defined dynamic range
val previewUseCase =
createUseCase(
- UseCaseConfigFactory.CaptureType.PREVIEW,
+ CaptureType.PREVIEW,
dynamicRange = DynamicRange.DOLBY_VISION_8_BIT,
)
val useCaseExpectedSizeMap =
@@ -2168,8 +2106,7 @@
getSuggestedSpecsAndVerify(
useCaseExpectedSizeMap,
dynamicRangeProfiles = DOLBY_VISION_CONSTRAINED,
- capabilities =
- intArrayOf(CameraMetadata.REQUEST_AVAILABLE_CAPABILITIES_DYNAMIC_RANGE_TEN_BIT),
+ capabilities = intArrayOf(REQUEST_AVAILABLE_CAPABILITIES_DYNAMIC_RANGE_TEN_BIT),
useCasesExpectedDynamicRangeMap = useCaseExpectedDynamicRangeMap
)
}
@@ -2180,25 +2117,21 @@
// VideoCapture partially defined dynamic range
val videoUseCase =
createUseCase(
- UseCaseConfigFactory.CaptureType.VIDEO_CAPTURE,
+ CaptureType.VIDEO_CAPTURE,
dynamicRange = DynamicRange.HDR_UNSPECIFIED_10_BIT
)
// Preview unspecified dynamic range
- val previewUseCase = createUseCase(UseCaseConfigFactory.CaptureType.PREVIEW)
+ val previewUseCase = createUseCase(CaptureType.PREVIEW)
val useCaseExpectedSizeMap =
mutableMapOf(videoUseCase to recordSize, previewUseCase to previewSize)
val useCaseExpectedDynamicRangeMap =
- mapOf(
- previewUseCase to DynamicRange.HLG_10_BIT,
- videoUseCase to DynamicRange.HLG_10_BIT
- )
+ mapOf(previewUseCase to HLG_10_BIT, videoUseCase to HLG_10_BIT)
getSuggestedSpecsAndVerify(
useCaseExpectedSizeMap,
dynamicRangeProfiles = HLG10_UNCONSTRAINED,
- capabilities =
- intArrayOf(CameraMetadata.REQUEST_AVAILABLE_CAPABILITIES_DYNAMIC_RANGE_TEN_BIT),
+ capabilities = intArrayOf(REQUEST_AVAILABLE_CAPABILITIES_DYNAMIC_RANGE_TEN_BIT),
useCasesExpectedDynamicRangeMap = useCaseExpectedDynamicRangeMap
)
}
@@ -2207,7 +2140,7 @@
@Test
fun dynamicRangeResolver_resolvesUnspecifiedDynamicRangeToSdr() {
// Preview unspecified dynamic range
- val useCase = createUseCase(UseCaseConfigFactory.CaptureType.PREVIEW)
+ val useCase = createUseCase(CaptureType.PREVIEW)
val useCaseExpectedSizeMap = mutableMapOf(useCase to maximumSize)
val useCaseExpectedDynamicRangeMap = mapOf(useCase to DynamicRange.SDR)
@@ -2215,8 +2148,7 @@
getSuggestedSpecsAndVerify(
useCaseExpectedSizeMap,
dynamicRangeProfiles = HLG10_CONSTRAINED,
- capabilities =
- intArrayOf(CameraMetadata.REQUEST_AVAILABLE_CAPABILITIES_DYNAMIC_RANGE_TEN_BIT),
+ capabilities = intArrayOf(REQUEST_AVAILABLE_CAPABILITIES_DYNAMIC_RANGE_TEN_BIT),
useCasesExpectedDynamicRangeMap = useCaseExpectedDynamicRangeMap
)
}
@@ -2224,7 +2156,7 @@
@Test
fun dynamicRangeResolver_resolvesToSdr_when10BitNotSupported() {
// Preview unspecified dynamic range
- val useCase = createUseCase(UseCaseConfigFactory.CaptureType.PREVIEW)
+ val useCase = createUseCase(CaptureType.PREVIEW)
val useCaseExpectedSizeMap = mutableMapOf(useCase to maximumSize)
val useCaseExpectedDynamicRangeMap = mapOf(useCase to DynamicRange.SDR)
@@ -2240,7 +2172,7 @@
// Preview unspecified dynamic range
val useCase =
createUseCase(
- UseCaseConfigFactory.CaptureType.PREVIEW,
+ CaptureType.PREVIEW,
dynamicRange =
DynamicRange(DynamicRange.ENCODING_SDR, DynamicRange.BIT_DEPTH_UNSPECIFIED)
)
@@ -2260,13 +2192,13 @@
// VideoCapture has 10-bit HDR range with constraint for 8-bit non-SDR range
val videoUseCase =
createUseCase(
- UseCaseConfigFactory.CaptureType.VIDEO_CAPTURE,
+ CaptureType.VIDEO_CAPTURE,
dynamicRange = DynamicRange.DOLBY_VISION_10_BIT
)
// Preview unspecified encoding but 8-bit bit depth
val previewUseCase =
createUseCase(
- UseCaseConfigFactory.CaptureType.PREVIEW,
+ CaptureType.PREVIEW,
dynamicRange =
DynamicRange(DynamicRange.ENCODING_UNSPECIFIED, DynamicRange.BIT_DEPTH_8_BIT)
)
@@ -2283,8 +2215,7 @@
getSuggestedSpecsAndVerify(
useCaseExpectedSizeMap,
useCasesExpectedDynamicRangeMap = useCaseExpectedDynamicRangeMap,
- capabilities =
- intArrayOf(CameraMetadata.REQUEST_AVAILABLE_CAPABILITIES_DYNAMIC_RANGE_TEN_BIT),
+ capabilities = intArrayOf(REQUEST_AVAILABLE_CAPABILITIES_DYNAMIC_RANGE_TEN_BIT),
dynamicRangeProfiles = DOLBY_VISION_CONSTRAINED
)
}
@@ -2294,7 +2225,7 @@
fun dynamicRangeResolver_resolvesToSdr_forUnspecified8Bit_whenNoOtherDynamicRangesPresent() {
val useCase =
createUseCase(
- UseCaseConfigFactory.CaptureType.PREVIEW,
+ CaptureType.PREVIEW,
dynamicRange =
DynamicRange(DynamicRange.ENCODING_UNSPECIFIED, DynamicRange.BIT_DEPTH_8_BIT)
)
@@ -2315,16 +2246,10 @@
fun dynamicRangeResolver_resolvesUnspecified8BitToDolbyVision8Bit_whenAlreadyPresent() {
// VideoCapture fully resolved Dolby Vision 8-bit
val videoUseCase =
- createUseCase(
- UseCaseConfigFactory.CaptureType.VIDEO_CAPTURE,
- dynamicRange = DynamicRange.DOLBY_VISION_8_BIT
- )
+ createUseCase(CaptureType.VIDEO_CAPTURE, dynamicRange = DynamicRange.DOLBY_VISION_8_BIT)
// Preview unspecified encoding / 8-bit
val previewUseCase =
- createUseCase(
- UseCaseConfigFactory.CaptureType.PREVIEW,
- dynamicRange = DynamicRange.UNSPECIFIED
- )
+ createUseCase(CaptureType.PREVIEW, dynamicRange = DynamicRange.UNSPECIFIED)
// Since there are no 10-bit dynamic ranges, the 10-bit resolution table isn't used.
// Instead, this will use the camera default LIMITED table which is limited to preview
@@ -2349,11 +2274,7 @@
@Test
fun tenBitTable_isUsed_whenAttaching10BitUseCaseToAlreadyAttachedSdrUseCases() {
// JPEG use case can't be attached with an existing PRIV + YUV in the 10-bit tables
- val useCase =
- createUseCase(
- UseCaseConfigFactory.CaptureType.IMAGE_CAPTURE,
- dynamicRange = DynamicRange.HLG_10_BIT
- )
+ val useCase = createUseCase(CaptureType.IMAGE_CAPTURE, dynamicRange = HLG_10_BIT)
val useCaseExpectedSizeMap =
mapOf(
// Size would be valid for LIMITED table
@@ -2362,24 +2283,21 @@
// existing surfaces (Preview + ImageAnalysis)
val attachedPreview =
AttachedSurfaceInfo.create(
- SurfaceConfig.create(
- SurfaceConfig.ConfigType.PRIV,
- SurfaceConfig.ConfigSize.PREVIEW
- ),
+ SurfaceConfig.create(ConfigType.PRIV, ConfigSize.PREVIEW),
ImageFormat.PRIVATE,
previewSize,
DynamicRange.SDR,
- listOf(UseCaseConfigFactory.CaptureType.PREVIEW),
+ listOf(CaptureType.PREVIEW),
useCase.currentConfig,
/*targetFrameRate=*/ null
)
val attachedAnalysis =
AttachedSurfaceInfo.create(
- SurfaceConfig.create(SurfaceConfig.ConfigType.YUV, SurfaceConfig.ConfigSize.RECORD),
+ SurfaceConfig.create(ConfigType.YUV, ConfigSize.RECORD),
ImageFormat.YUV_420_888,
recordSize,
DynamicRange.SDR,
- listOf(UseCaseConfigFactory.CaptureType.IMAGE_ANALYSIS),
+ listOf(CaptureType.IMAGE_ANALYSIS),
useCase.currentConfig,
/*targetFrameRate=*/ null
)
@@ -2389,10 +2307,9 @@
useCaseExpectedSizeMap,
attachedSurfaceInfoList = listOf(attachedPreview, attachedAnalysis),
// LIMITED allows this combination, but 10-bit table does not
- hardwareLevel = CameraMetadata.INFO_SUPPORTED_HARDWARE_LEVEL_LIMITED,
+ hardwareLevel = INFO_SUPPORTED_HARDWARE_LEVEL_LIMITED,
dynamicRangeProfiles = HLG10_SDR_CONSTRAINED,
- capabilities =
- intArrayOf(CameraMetadata.REQUEST_AVAILABLE_CAPABILITIES_DYNAMIC_RANGE_TEN_BIT)
+ capabilities = intArrayOf(REQUEST_AVAILABLE_CAPABILITIES_DYNAMIC_RANGE_TEN_BIT)
)
}
}
@@ -2400,11 +2317,7 @@
@Config(minSdk = Build.VERSION_CODES.TIRAMISU)
@Test
fun dynamicRangeConstraints_causeAutoResolutionToThrow() {
- val useCase =
- createUseCase(
- UseCaseConfigFactory.CaptureType.IMAGE_CAPTURE,
- dynamicRange = DynamicRange.HLG_10_BIT
- )
+ val useCase = createUseCase(CaptureType.IMAGE_CAPTURE, dynamicRange = HLG_10_BIT)
val useCaseExpectedSizeMap =
mapOf(
// Size would be valid for 10-bit table within constraints
@@ -2413,27 +2326,21 @@
// existing surfaces (PRIV + PRIV)
val attachedPriv1 =
AttachedSurfaceInfo.create(
- SurfaceConfig.create(
- SurfaceConfig.ConfigType.PRIV,
- SurfaceConfig.ConfigSize.PREVIEW
- ),
+ SurfaceConfig.create(ConfigType.PRIV, ConfigSize.PREVIEW),
ImageFormat.PRIVATE,
previewSize,
DynamicRange.HDR10_10_BIT,
- listOf(UseCaseConfigFactory.CaptureType.PREVIEW),
+ listOf(CaptureType.PREVIEW),
useCase.currentConfig,
/*targetFrameRate=*/ null
)
val attachedPriv2 =
AttachedSurfaceInfo.create(
- SurfaceConfig.create(
- SurfaceConfig.ConfigType.PRIV,
- SurfaceConfig.ConfigSize.RECORD
- ),
+ SurfaceConfig.create(ConfigType.PRIV, ConfigSize.RECORD),
ImageFormat.YUV_420_888,
recordSize,
DynamicRange.HDR10_PLUS_10_BIT,
- listOf(UseCaseConfigFactory.CaptureType.VIDEO_CAPTURE),
+ listOf(CaptureType.VIDEO_CAPTURE),
useCase.currentConfig,
/*targetFrameRate=*/ null
)
@@ -2459,8 +2366,7 @@
useCaseExpectedSizeMap,
attachedSurfaceInfoList = listOf(attachedPriv1, attachedPriv2),
dynamicRangeProfiles = constraintsTable,
- capabilities =
- intArrayOf(CameraMetadata.REQUEST_AVAILABLE_CAPABILITIES_DYNAMIC_RANGE_TEN_BIT)
+ capabilities = intArrayOf(REQUEST_AVAILABLE_CAPABILITIES_DYNAMIC_RANGE_TEN_BIT)
)
}
}
@@ -2469,11 +2375,7 @@
@Test
fun canAttachHlgDynamicRange_toExistingSdrStreams() {
// JPEG use case can be attached with an existing PRIV + PRIV in the 10-bit tables
- val useCase =
- createUseCase(
- UseCaseConfigFactory.CaptureType.IMAGE_CAPTURE,
- dynamicRange = DynamicRange.HLG_10_BIT
- )
+ val useCase = createUseCase(CaptureType.IMAGE_CAPTURE, dynamicRange = HLG_10_BIT)
val useCaseExpectedSizeMap =
mapOf(
// Size is valid for 10-bit table within constraints
@@ -2482,27 +2384,21 @@
// existing surfaces (PRIV + PRIV)
val attachedPriv1 =
AttachedSurfaceInfo.create(
- SurfaceConfig.create(
- SurfaceConfig.ConfigType.PRIV,
- SurfaceConfig.ConfigSize.PREVIEW
- ),
+ SurfaceConfig.create(ConfigType.PRIV, ConfigSize.PREVIEW),
ImageFormat.PRIVATE,
previewSize,
DynamicRange.SDR,
- listOf(UseCaseConfigFactory.CaptureType.PREVIEW),
+ listOf(CaptureType.PREVIEW),
useCase.currentConfig,
/*targetFrameRate=*/ null
)
val attachedPriv2 =
AttachedSurfaceInfo.create(
- SurfaceConfig.create(
- SurfaceConfig.ConfigType.PRIV,
- SurfaceConfig.ConfigSize.RECORD
- ),
+ SurfaceConfig.create(ConfigType.PRIV, ConfigSize.RECORD),
ImageFormat.YUV_420_888,
recordSize,
DynamicRange.SDR,
- listOf(UseCaseConfigFactory.CaptureType.IMAGE_ANALYSIS),
+ listOf(CaptureType.IMAGE_ANALYSIS),
useCase.currentConfig,
/*targetFrameRate=*/ null
)
@@ -2511,8 +2407,7 @@
useCaseExpectedSizeMap,
attachedSurfaceInfoList = listOf(attachedPriv1, attachedPriv2),
dynamicRangeProfiles = HLG10_SDR_CONSTRAINED,
- capabilities =
- intArrayOf(CameraMetadata.REQUEST_AVAILABLE_CAPABILITIES_DYNAMIC_RANGE_TEN_BIT)
+ capabilities = intArrayOf(REQUEST_AVAILABLE_CAPABILITIES_DYNAMIC_RANGE_TEN_BIT)
)
}
@@ -2520,14 +2415,9 @@
@Test
fun requiredSdrDynamicRangeThrows_whenCombinedWithConstrainedHlg() {
// VideoCapture HLG dynamic range
- val videoUseCase =
- createUseCase(
- UseCaseConfigFactory.CaptureType.VIDEO_CAPTURE,
- dynamicRange = DynamicRange.HLG_10_BIT
- )
+ val videoUseCase = createUseCase(CaptureType.VIDEO_CAPTURE, dynamicRange = HLG_10_BIT)
// Preview SDR dynamic range
- val previewUseCase =
- createUseCase(UseCaseConfigFactory.CaptureType.PREVIEW, dynamicRange = DynamicRange.SDR)
+ val previewUseCase = createUseCase(CaptureType.PREVIEW, dynamicRange = DynamicRange.SDR)
val useCaseExpectedSizeMap =
mutableMapOf(videoUseCase to recordSize, previewUseCase to previewSize)
@@ -2537,8 +2427,7 @@
getSuggestedSpecsAndVerify(
useCaseExpectedSizeMap,
dynamicRangeProfiles = HLG10_CONSTRAINED,
- capabilities =
- intArrayOf(CameraMetadata.REQUEST_AVAILABLE_CAPABILITIES_DYNAMIC_RANGE_TEN_BIT),
+ capabilities = intArrayOf(REQUEST_AVAILABLE_CAPABILITIES_DYNAMIC_RANGE_TEN_BIT),
)
}
}
@@ -2547,14 +2436,9 @@
@Test
fun requiredSdrDynamicRange_canBeCombinedWithUnconstrainedHlg() {
// VideoCapture HLG dynamic range
- val videoUseCase =
- createUseCase(
- UseCaseConfigFactory.CaptureType.VIDEO_CAPTURE,
- dynamicRange = DynamicRange.HLG_10_BIT
- )
+ val videoUseCase = createUseCase(CaptureType.VIDEO_CAPTURE, dynamicRange = HLG_10_BIT)
// Preview SDR dynamic range
- val previewUseCase =
- createUseCase(UseCaseConfigFactory.CaptureType.PREVIEW, dynamicRange = DynamicRange.SDR)
+ val previewUseCase = createUseCase(CaptureType.PREVIEW, dynamicRange = DynamicRange.SDR)
val useCaseExpectedSizeMap =
mutableMapOf(videoUseCase to recordSize, previewUseCase to previewSize)
@@ -2563,8 +2447,7 @@
getSuggestedSpecsAndVerify(
useCaseExpectedSizeMap,
dynamicRangeProfiles = HLG10_UNCONSTRAINED,
- capabilities =
- intArrayOf(CameraMetadata.REQUEST_AVAILABLE_CAPABILITIES_DYNAMIC_RANGE_TEN_BIT),
+ capabilities = intArrayOf(REQUEST_AVAILABLE_CAPABILITIES_DYNAMIC_RANGE_TEN_BIT),
)
}
@@ -2573,16 +2456,10 @@
fun multiple10BitUnconstrainedDynamicRanges_canBeCombined() {
// VideoCapture HDR10 dynamic range
val videoUseCase =
- createUseCase(
- UseCaseConfigFactory.CaptureType.VIDEO_CAPTURE,
- dynamicRange = DynamicRange.HDR10_10_BIT
- )
+ createUseCase(CaptureType.VIDEO_CAPTURE, dynamicRange = DynamicRange.HDR10_10_BIT)
// Preview HDR10_PLUS dynamic range
val previewUseCase =
- createUseCase(
- UseCaseConfigFactory.CaptureType.PREVIEW,
- dynamicRange = DynamicRange.HDR10_PLUS_10_BIT
- )
+ createUseCase(CaptureType.PREVIEW, dynamicRange = DynamicRange.HDR10_PLUS_10_BIT)
val useCaseExpectedSizeMap =
mutableMapOf(videoUseCase to recordSize, previewUseCase to previewSize)
@@ -2591,8 +2468,7 @@
getSuggestedSpecsAndVerify(
useCaseExpectedSizeMap,
dynamicRangeProfiles = HDR10_HDR10_PLUS_UNCONSTRAINED,
- capabilities =
- intArrayOf(CameraMetadata.REQUEST_AVAILABLE_CAPABILITIES_DYNAMIC_RANGE_TEN_BIT),
+ capabilities = intArrayOf(REQUEST_AVAILABLE_CAPABILITIES_DYNAMIC_RANGE_TEN_BIT),
)
}
@@ -2605,48 +2481,32 @@
@Test
fun getSupportedOutputSizes_single_valid_targetFPS() {
// a valid target means the device is capable of that fps
- val useCase =
- createUseCase(
- UseCaseConfigFactory.CaptureType.PREVIEW,
- targetFrameRate = Range<Int>(25, 30)
- )
+ val useCase = createUseCase(CaptureType.PREVIEW, targetFrameRate = Range<Int>(25, 30))
val useCaseExpectedResultMap =
mutableMapOf<UseCase, Size>().apply { put(useCase, Size(3840, 2160)) }
getSuggestedSpecsAndVerify(
useCaseExpectedResultMap,
- hardwareLevel = CameraCharacteristics.INFO_SUPPORTED_HARDWARE_LEVEL_LIMITED
+ hardwareLevel = INFO_SUPPORTED_HARDWARE_LEVEL_LIMITED
)
}
@Test
fun getSuggestedStreamSpec_single_invalid_targetFPS() {
// an invalid target means the device would neve be able to reach that fps
- val useCase =
- createUseCase(
- UseCaseConfigFactory.CaptureType.PREVIEW,
- targetFrameRate = Range<Int>(65, 70)
- )
+ val useCase = createUseCase(CaptureType.PREVIEW, targetFrameRate = Range<Int>(65, 70))
val useCaseExpectedResultMap =
mutableMapOf<UseCase, Size>().apply { put(useCase, Size(800, 450)) }
getSuggestedSpecsAndVerify(
useCaseExpectedResultMap,
- hardwareLevel = CameraCharacteristics.INFO_SUPPORTED_HARDWARE_LEVEL_LIMITED
+ hardwareLevel = INFO_SUPPORTED_HARDWARE_LEVEL_LIMITED
)
}
@Test
fun getSuggestedStreamSpec_multiple_targetFPS_first_is_larger() {
// a valid target means the device is capable of that fps
- val useCase1 =
- createUseCase(
- UseCaseConfigFactory.CaptureType.PREVIEW,
- targetFrameRate = Range<Int>(30, 35)
- )
- val useCase2 =
- createUseCase(
- UseCaseConfigFactory.CaptureType.PREVIEW,
- targetFrameRate = Range<Int>(15, 25)
- )
+ val useCase1 = createUseCase(CaptureType.PREVIEW, targetFrameRate = Range<Int>(30, 35))
+ val useCase2 = createUseCase(CaptureType.PREVIEW, targetFrameRate = Range<Int>(15, 25))
val useCaseExpectedResultMap =
mutableMapOf<UseCase, Size>().apply {
// both selected size should be no larger than 1920 x 1445
@@ -2663,16 +2523,8 @@
@Test
fun getSuggestedStreamSpec_multiple_targetFPS_first_is_smaller() {
// a valid target means the device is capable of that fps
- val useCase1 =
- createUseCase(
- UseCaseConfigFactory.CaptureType.PREVIEW,
- targetFrameRate = Range<Int>(30, 35)
- )
- val useCase2 =
- createUseCase(
- UseCaseConfigFactory.CaptureType.PREVIEW,
- targetFrameRate = Range<Int>(45, 50)
- )
+ val useCase1 = createUseCase(CaptureType.PREVIEW, targetFrameRate = Range<Int>(30, 35))
+ val useCase2 = createUseCase(CaptureType.PREVIEW, targetFrameRate = Range<Int>(45, 50))
val useCaseExpectedResultMap =
mutableMapOf<UseCase, Size>().apply {
// both selected size should be no larger than 1920 x 1440
@@ -2681,7 +2533,7 @@
}
getSuggestedSpecsAndVerify(
useCaseExpectedResultMap,
- hardwareLevel = CameraCharacteristics.INFO_SUPPORTED_HARDWARE_LEVEL_LIMITED,
+ hardwareLevel = INFO_SUPPORTED_HARDWARE_LEVEL_LIMITED,
compareWithAtMost = true
)
}
@@ -2689,16 +2541,8 @@
@Test
fun getSuggestedStreamSpec_multiple_targetFPS_intersect() {
// first and second new use cases have target fps that intersect each other
- val useCase1 =
- createUseCase(
- UseCaseConfigFactory.CaptureType.PREVIEW,
- targetFrameRate = Range<Int>(30, 40)
- )
- val useCase2 =
- createUseCase(
- UseCaseConfigFactory.CaptureType.PREVIEW,
- targetFrameRate = Range<Int>(35, 45)
- )
+ val useCase1 = createUseCase(CaptureType.PREVIEW, targetFrameRate = Range<Int>(30, 40))
+ val useCase2 = createUseCase(CaptureType.PREVIEW, targetFrameRate = Range<Int>(35, 45))
val useCaseExpectedResultMap =
mutableMapOf<UseCase, Size>().apply {
// effective target fps becomes 35-40
@@ -2708,7 +2552,7 @@
}
getSuggestedSpecsAndVerify(
useCaseExpectedResultMap,
- hardwareLevel = CameraCharacteristics.INFO_SUPPORTED_HARDWARE_LEVEL_LIMITED,
+ hardwareLevel = INFO_SUPPORTED_HARDWARE_LEVEL_LIMITED,
compareWithAtMost = true
)
}
@@ -2716,12 +2560,8 @@
@Test
fun getSuggestedStreamSpec_multiple_cases_first_has_targetFPS() {
// first new use case has a target fps, second new use case does not
- val useCase1 =
- createUseCase(
- UseCaseConfigFactory.CaptureType.PREVIEW,
- targetFrameRate = Range<Int>(30, 35)
- )
- val useCase2 = createUseCase(UseCaseConfigFactory.CaptureType.PREVIEW)
+ val useCase1 = createUseCase(CaptureType.PREVIEW, targetFrameRate = Range<Int>(30, 35))
+ val useCase2 = createUseCase(CaptureType.PREVIEW)
val useCaseExpectedResultMap =
mutableMapOf<UseCase, Size>().apply {
// both selected size should be no larger than 1920 x 1440
@@ -2730,7 +2570,7 @@
}
getSuggestedSpecsAndVerify(
useCaseExpectedResultMap,
- hardwareLevel = CameraCharacteristics.INFO_SUPPORTED_HARDWARE_LEVEL_LIMITED,
+ hardwareLevel = INFO_SUPPORTED_HARDWARE_LEVEL_LIMITED,
compareWithAtMost = true
)
}
@@ -2738,12 +2578,8 @@
@Test
fun getSuggestedStreamSpec_multiple_cases_second_has_targetFPS() {
// second new use case does not have a target fps, first new use case does not
- val useCase1 = createUseCase(UseCaseConfigFactory.CaptureType.PREVIEW)
- val useCase2 =
- createUseCase(
- UseCaseConfigFactory.CaptureType.PREVIEW,
- targetFrameRate = Range<Int>(30, 35)
- )
+ val useCase1 = createUseCase(CaptureType.PREVIEW)
+ val useCase2 = createUseCase(CaptureType.PREVIEW, targetFrameRate = Range<Int>(30, 35))
val useCaseExpectedResultMap =
mutableMapOf<UseCase, Size>().apply {
// both selected size should be no larger than 1920 x 1440
@@ -2752,7 +2588,7 @@
}
getSuggestedSpecsAndVerify(
useCaseExpectedResultMap,
- hardwareLevel = CameraCharacteristics.INFO_SUPPORTED_HARDWARE_LEVEL_LIMITED,
+ hardwareLevel = INFO_SUPPORTED_HARDWARE_LEVEL_LIMITED,
compareWithAtMost = true
)
}
@@ -2760,7 +2596,7 @@
@Test
fun getSuggestedStreamSpec_attached_with_targetFPS_no_new_targetFPS() {
// existing surface with target fps + new use case without a target fps
- val useCase = createUseCase(UseCaseConfigFactory.CaptureType.PREVIEW)
+ val useCase = createUseCase(CaptureType.PREVIEW)
val useCaseExpectedResultMap =
mutableMapOf<UseCase, Size>().apply {
// size should be no larger than 1280 x 960
@@ -2769,21 +2605,18 @@
// existing surface w/ target fps
val attachedSurfaceInfo =
AttachedSurfaceInfo.create(
- SurfaceConfig.create(
- SurfaceConfig.ConfigType.JPEG,
- SurfaceConfig.ConfigSize.PREVIEW
- ),
+ SurfaceConfig.create(ConfigType.JPEG, ConfigSize.PREVIEW),
ImageFormat.JPEG,
Size(1280, 720),
DynamicRange.SDR,
- listOf(UseCaseConfigFactory.CaptureType.PREVIEW),
+ listOf(CaptureType.PREVIEW),
useCase.currentConfig,
Range(40, 50)
)
getSuggestedSpecsAndVerify(
useCaseExpectedResultMap,
attachedSurfaceInfoList = listOf(attachedSurfaceInfo),
- hardwareLevel = CameraCharacteristics.INFO_SUPPORTED_HARDWARE_LEVEL_LIMITED,
+ hardwareLevel = INFO_SUPPORTED_HARDWARE_LEVEL_LIMITED,
compareWithAtMost = true
)
}
@@ -2791,11 +2624,7 @@
@Test
fun getSuggestedStreamSpec_attached_with_targetFPS_and_new_targetFPS_no_intersect() {
// existing surface with target fps + new use case with target fps that does not intersect
- val useCase =
- createUseCase(
- UseCaseConfigFactory.CaptureType.PREVIEW,
- targetFrameRate = Range<Int>(30, 35)
- )
+ val useCase = createUseCase(CaptureType.PREVIEW, targetFrameRate = Range<Int>(30, 35))
val useCaseExpectedResultMap =
mutableMapOf<UseCase, Size>().apply {
// size of new surface should be no larger than 1280 x 960
@@ -2804,21 +2633,18 @@
// existing surface w/ target fps
val attachedSurfaceInfo =
AttachedSurfaceInfo.create(
- SurfaceConfig.create(
- SurfaceConfig.ConfigType.JPEG,
- SurfaceConfig.ConfigSize.PREVIEW
- ),
+ SurfaceConfig.create(ConfigType.JPEG, ConfigSize.PREVIEW),
ImageFormat.JPEG,
Size(1280, 720),
DynamicRange.SDR,
- listOf(UseCaseConfigFactory.CaptureType.PREVIEW),
+ listOf(CaptureType.PREVIEW),
useCase.currentConfig,
Range(40, 50)
)
getSuggestedSpecsAndVerify(
useCaseExpectedResultMap,
attachedSurfaceInfoList = listOf(attachedSurfaceInfo),
- hardwareLevel = CameraCharacteristics.INFO_SUPPORTED_HARDWARE_LEVEL_LIMITED,
+ hardwareLevel = INFO_SUPPORTED_HARDWARE_LEVEL_LIMITED,
compareWithAtMost = true
)
}
@@ -2826,11 +2652,7 @@
@Test
fun getSuggestedStreamSpec_attached_with_targetFPS_and_new_targetFPS_with_intersect() {
// existing surface with target fps + new use case with target fps that intersect each other
- val useCase =
- createUseCase(
- UseCaseConfigFactory.CaptureType.PREVIEW,
- targetFrameRate = Range<Int>(45, 50)
- )
+ val useCase = createUseCase(CaptureType.PREVIEW, targetFrameRate = Range<Int>(45, 50))
val useCaseExpectedResultMap =
mutableMapOf<UseCase, Size>().apply {
// size of new surface should be no larger than 1280 x 720
@@ -2839,21 +2661,18 @@
// existing surface w/ target fps
val attachedSurfaceInfo =
AttachedSurfaceInfo.create(
- SurfaceConfig.create(
- SurfaceConfig.ConfigType.JPEG,
- SurfaceConfig.ConfigSize.PREVIEW
- ),
+ SurfaceConfig.create(ConfigType.JPEG, ConfigSize.PREVIEW),
ImageFormat.JPEG,
Size(1280, 720),
DynamicRange.SDR,
- listOf(UseCaseConfigFactory.CaptureType.PREVIEW),
+ listOf(CaptureType.PREVIEW),
useCase.currentConfig,
Range(40, 50)
)
getSuggestedSpecsAndVerify(
useCaseExpectedResultMap,
attachedSurfaceInfoList = listOf(attachedSurfaceInfo),
- hardwareLevel = CameraCharacteristics.INFO_SUPPORTED_HARDWARE_LEVEL_LIMITED,
+ hardwareLevel = INFO_SUPPORTED_HARDWARE_LEVEL_LIMITED,
compareWithAtMost = true
)
}
@@ -2861,11 +2680,7 @@
@Test
fun getSuggestedStreamSpec_has_device_supported_expectedFrameRateRange() {
// use case with target fps
- val useCase1 =
- createUseCase(
- UseCaseConfigFactory.CaptureType.PREVIEW,
- targetFrameRate = Range<Int>(15, 25)
- )
+ val useCase1 = createUseCase(CaptureType.PREVIEW, targetFrameRate = Range<Int>(15, 25))
val useCaseExpectedResultMap =
mutableMapOf<UseCase, Size>().apply { put(useCase1, Size(4032, 3024)) }
getSuggestedSpecsAndVerify(
@@ -2880,11 +2695,7 @@
@Test
fun getSuggestedStreamSpec_has_exact_device_supported_expectedFrameRateRange() {
// use case with target fps
- val useCase1 =
- createUseCase(
- UseCaseConfigFactory.CaptureType.PREVIEW,
- targetFrameRate = Range<Int>(30, 30)
- )
+ val useCase1 = createUseCase(CaptureType.PREVIEW, targetFrameRate = Range<Int>(30, 30))
val useCaseExpectedResultMap =
mutableMapOf<UseCase, Size>().apply { put(useCase1, Size(1920, 1440)) }
getSuggestedSpecsAndVerify(
@@ -2899,11 +2710,7 @@
@Test
fun getSuggestedStreamSpec_has_no_device_supported_expectedFrameRateRange() {
// use case with target fps
- val useCase1 =
- createUseCase(
- UseCaseConfigFactory.CaptureType.PREVIEW,
- targetFrameRate = Range<Int>(65, 65)
- )
+ val useCase1 = createUseCase(CaptureType.PREVIEW, targetFrameRate = Range<Int>(65, 65))
val useCaseExpectedResultMap =
mutableMapOf<UseCase, Size>().apply { put(useCase1, Size(800, 450)) }
@@ -2920,11 +2727,7 @@
fun getSuggestedStreamSpec_has_multiple_device_supported_expectedFrameRateRange() {
// use case with target fps
- val useCase1 =
- createUseCase(
- UseCaseConfigFactory.CaptureType.PREVIEW,
- targetFrameRate = Range<Int>(36, 45)
- )
+ val useCase1 = createUseCase(CaptureType.PREVIEW, targetFrameRate = Range<Int>(36, 45))
val useCaseExpectedResultMap =
mutableMapOf<UseCase, Size>().apply { put(useCase1, Size(1280, 960)) }
@@ -2945,11 +2748,7 @@
// target fps is between ranges, but within device capability (for some reason lol)
// use case with target fps
- val useCase1 =
- createUseCase(
- UseCaseConfigFactory.CaptureType.PREVIEW,
- targetFrameRate = Range<Int>(26, 27)
- )
+ val useCase1 = createUseCase(CaptureType.PREVIEW, targetFrameRate = Range<Int>(26, 27))
val useCaseExpectedResultMap =
mutableMapOf<UseCase, Size>().apply { put(useCase1, Size(1920, 1440)) }
@@ -2966,11 +2765,7 @@
fun getSuggestedStreamSpec_has_no_device_intersection_equidistant_expectedFrameRateRange() {
// use case with target fps
- val useCase1 =
- createUseCase(
- UseCaseConfigFactory.CaptureType.PREVIEW,
- targetFrameRate = Range<Int>(26, 26)
- )
+ val useCase1 = createUseCase(CaptureType.PREVIEW, targetFrameRate = Range<Int>(26, 26))
val useCaseExpectedResultMap =
mutableMapOf<UseCase, Size>().apply { put(useCase1, Size(1920, 1440)) }
@@ -2990,7 +2785,7 @@
// a valid target means the device is capable of that fps
// use case with no target fps
- val useCase1 = createUseCase(UseCaseConfigFactory.CaptureType.PREVIEW)
+ val useCase1 = createUseCase(CaptureType.PREVIEW)
val useCaseExpectedResultMap =
mutableMapOf<UseCase, Size>().apply { put(useCase1, Size(4032, 3024)) }
@@ -3010,7 +2805,7 @@
// use case with no target fps
val useCase1 =
createUseCase(
- UseCaseConfigFactory.CaptureType.PREVIEW,
+ CaptureType.PREVIEW,
targetFrameRate = StreamSpec.FRAME_RATE_RANGE_UNSPECIFIED
)
@@ -3191,7 +2986,7 @@
fun applyResolutionCorrectorWorkaroundCorrectly() {
ReflectionHelpers.setStaticField(Build::class.java, "BRAND", "Samsung")
ReflectionHelpers.setStaticField(Build::class.java, "MODEL", "SM-J710MN")
- setupCamera(hardwareLevel = CameraMetadata.INFO_SUPPORTED_HARDWARE_LEVEL_LIMITED)
+ setupCamera(hardwareLevel = INFO_SUPPORTED_HARDWARE_LEVEL_LIMITED)
val supportedSurfaceCombination =
SupportedSurfaceCombination(context, fakeCameraMetadata, mockEncoderProfilesAdapter)
val resultList =
@@ -3225,10 +3020,7 @@
@Test
fun canPopulateStreamUseCaseStreamSpecOption_jpeg() {
val jpegUseCase =
- createUseCase(
- UseCaseConfigFactory.CaptureType.IMAGE_CAPTURE,
- streamUseCaseOverride = true
- ) // JPEG
+ createUseCase(CaptureType.IMAGE_CAPTURE, streamUseCaseOverride = true) // JPEG
val useCaseExpectedResultMap =
mutableMapOf<UseCase, Size>().apply { put(jpegUseCase, landscapePixelArraySize) }
val resultPair = getSuggestedSpecsAndVerify(useCaseExpectedResultMap)
@@ -3245,15 +3037,9 @@
@Test
fun throwException_PopulateStreamUseCaseStreamSpecOption_notFullyOverride() {
val jpegUseCase =
- createUseCase(
- UseCaseConfigFactory.CaptureType.IMAGE_CAPTURE,
- streamUseCaseOverride = true
- ) // JPEG
+ createUseCase(CaptureType.IMAGE_CAPTURE, streamUseCaseOverride = true) // JPEG
val yuvUseCase =
- createUseCase(
- UseCaseConfigFactory.CaptureType.PREVIEW,
- streamUseCaseOverride = false
- ) // PREVIEW
+ createUseCase(CaptureType.PREVIEW, streamUseCaseOverride = false) // PREVIEW
val useCaseExpectedResultMap =
mutableMapOf<UseCase, Size>().apply {
put(jpegUseCase, landscapePixelArraySize)
@@ -3267,16 +3053,8 @@
@Config(minSdk = Build.VERSION_CODES.TIRAMISU)
@Test
fun skipPopulateStreamUseCaseStreamSpecOption_unsupportedCombination() {
- val useCase1 =
- createUseCase(
- UseCaseConfigFactory.CaptureType.PREVIEW,
- streamUseCaseOverride = true
- ) // PREVIEW
- val useCase2 =
- createUseCase(
- UseCaseConfigFactory.CaptureType.PREVIEW,
- streamUseCaseOverride = true
- ) // PREVIEW
+ val useCase1 = createUseCase(CaptureType.PREVIEW, streamUseCaseOverride = true) // PREVIEW
+ val useCase2 = createUseCase(CaptureType.PREVIEW, streamUseCaseOverride = true) // PREVIEW
val useCaseExpectedResultMap =
mutableMapOf<UseCase, Size>().apply {
put(useCase1, previewSize)
@@ -3307,10 +3085,7 @@
@Test
fun skipPopulateStreamUseCaseStreamSpecOption_unsupportedOs() {
val jpegUseCase =
- createUseCase(
- UseCaseConfigFactory.CaptureType.IMAGE_CAPTURE,
- streamUseCaseOverride = true
- ) // JPEG
+ createUseCase(CaptureType.IMAGE_CAPTURE, streamUseCaseOverride = true) // JPEG
val useCaseExpectedResultMap =
mutableMapOf<UseCase, Size>().apply { put(jpegUseCase, landscapePixelArraySize) }
val resultPair =
@@ -3763,16 +3538,16 @@
val cameraX: CameraX =
try {
CameraXUtil.getOrCreateInstance(context) { cameraXConfig }.get()
- } catch (e: ExecutionException) {
+ } catch (_: ExecutionException) {
throw IllegalStateException("Unable to initialize CameraX for test.")
- } catch (e: InterruptedException) {
+ } catch (_: InterruptedException) {
throw IllegalStateException("Unable to initialize CameraX for test.")
}
useCaseConfigFactory = cameraX.defaultConfigFactory
}
private fun createUseCase(
- captureType: UseCaseConfigFactory.CaptureType,
+ captureType: CaptureType,
targetFrameRate: Range<Int>? = null,
dynamicRange: DynamicRange = DynamicRange.UNSPECIFIED,
surfaceOccupancyPriority: Int? = null
@@ -3787,7 +3562,7 @@
}
private fun createUseCase(
- captureType: UseCaseConfigFactory.CaptureType,
+ captureType: CaptureType,
targetFrameRate: Range<Int>? = null,
dynamicRange: DynamicRange? = DynamicRange.UNSPECIFIED,
streamUseCaseOverride: Boolean = false,
@@ -3799,8 +3574,8 @@
captureType,
imageFormat
?: when (captureType) {
- UseCaseConfigFactory.CaptureType.IMAGE_CAPTURE -> ImageFormat.JPEG
- UseCaseConfigFactory.CaptureType.IMAGE_ANALYSIS -> ImageFormat.YUV_420_888
+ CaptureType.IMAGE_CAPTURE -> ImageFormat.JPEG
+ CaptureType.IMAGE_ANALYSIS -> ImageFormat.YUV_420_888
else -> ImageFormatConstants.INTERNAL_DEFINED_IMAGE_FORMAT_PRIVATE
}
)
diff --git a/camera/camera-camera2/build.gradle b/camera/camera-camera2/build.gradle
index cf174ef..45bc114 100644
--- a/camera/camera-camera2/build.gradle
+++ b/camera/camera-camera2/build.gradle
@@ -81,6 +81,8 @@
androidTestImplementation("androidx.test.espresso:espresso-core:3.3.0")
}
android {
+ compileSdk 35
+
buildTypes.configureEach {
consumerProguardFiles("proguard-rules.pro")
}
diff --git a/camera/camera-camera2/src/androidTest/java/androidx/camera/camera2/internal/Camera2CameraControlImplDeviceTest.java b/camera/camera-camera2/src/androidTest/java/androidx/camera/camera2/internal/Camera2CameraControlImplDeviceTest.java
index d43e3f6..96d36ea 100644
--- a/camera/camera-camera2/src/androidTest/java/androidx/camera/camera2/internal/Camera2CameraControlImplDeviceTest.java
+++ b/camera/camera-camera2/src/androidTest/java/androidx/camera/camera2/internal/Camera2CameraControlImplDeviceTest.java
@@ -21,6 +21,7 @@
import static android.hardware.camera2.CameraMetadata.CONTROL_AE_MODE_ON_ALWAYS_FLASH;
import static android.hardware.camera2.CameraMetadata.CONTROL_AE_MODE_ON_AUTO_FLASH;
import static android.hardware.camera2.CameraMetadata.CONTROL_AE_MODE_ON_EXTERNAL_FLASH;
+import static android.hardware.camera2.CameraMetadata.CONTROL_AE_MODE_ON_LOW_LIGHT_BOOST_BRIGHTNESS_PRIORITY;
import static android.hardware.camera2.CameraMetadata.CONTROL_AF_MODE_AUTO;
import static android.hardware.camera2.CameraMetadata.CONTROL_AF_MODE_CONTINUOUS_PICTURE;
import static android.hardware.camera2.CameraMetadata.CONTROL_AF_MODE_OFF;
@@ -397,20 +398,8 @@
public void enableTorch_aeModeSetAndRequestUpdated() throws InterruptedException {
assumeTrue(mHasFlashUnit);
mCamera2CameraControlImpl.enableTorch(true);
-
HandlerUtil.waitForLooperToIdle(mHandler);
-
- verify(mControlUpdateCallback, times(1)).onCameraControlUpdateSessionConfig();
- SessionConfig sessionConfig = mCamera2CameraControlImpl.getSessionConfig();
- Camera2ImplConfig camera2Config = new Camera2ImplConfig(
- sessionConfig.getImplementationOptions());
-
- assertAeMode(camera2Config, CONTROL_AE_MODE_ON);
-
- assertThat(
- camera2Config.getCaptureRequestOption(
- CaptureRequest.FLASH_MODE, FLASH_MODE_OFF))
- .isEqualTo(FLASH_MODE_TORCH);
+ verifyControlAeModeAndFlashMode(CONTROL_AE_MODE_ON, FLASH_MODE_TORCH);
}
@Test
@@ -442,6 +431,47 @@
}
+ @SdkSuppress(minSdkVersion = 35)
+ @Test
+ public void enableLowLightBoost_aeModeSetAndRequestUpdated() throws InterruptedException {
+ assumeTrue(mCamera2CameraControlImpl.getLowLightBoostControl().isLowLightBoostSupported());
+ mCamera2CameraControlImpl.enableLowLightBoostAsync(true);
+ HandlerUtil.waitForLooperToIdle(mHandler);
+ verifyControlAeModeAndFlashMode(CONTROL_AE_MODE_ON_LOW_LIGHT_BOOST_BRIGHTNESS_PRIORITY,
+ FLASH_MODE_OFF);
+ }
+
+ @SdkSuppress(minSdkVersion = 35)
+ @Test
+ public void enableLowLightBoostCanOverrideTorch_aeModeSetAndRequestUpdated()
+ throws InterruptedException {
+ assumeTrue(mCamera2CameraControlImpl.getLowLightBoostControl().isLowLightBoostSupported());
+ assumeTrue(mHasFlashUnit);
+
+ mCamera2CameraControlImpl.enableTorch(true);
+ HandlerUtil.waitForLooperToIdle(mHandler);
+ verifyControlAeModeAndFlashMode(CONTROL_AE_MODE_ON, FLASH_MODE_TORCH);
+
+ mCamera2CameraControlImpl.enableTorch(true);
+ HandlerUtil.waitForLooperToIdle(mHandler);
+ verifyControlAeModeAndFlashMode(CONTROL_AE_MODE_ON_LOW_LIGHT_BOOST_BRIGHTNESS_PRIORITY,
+ FLASH_MODE_OFF);
+ }
+
+ private void verifyControlAeModeAndFlashMode(int expectedAeMode, int expectedFlashMode) {
+ verify(mControlUpdateCallback, times(1)).onCameraControlUpdateSessionConfig();
+ SessionConfig sessionConfig = mCamera2CameraControlImpl.getSessionConfig();
+ Camera2ImplConfig camera2Config = new Camera2ImplConfig(
+ sessionConfig.getImplementationOptions());
+
+ assertAeMode(camera2Config, expectedAeMode);
+
+ assertThat(
+ camera2Config.getCaptureRequestOption(
+ CaptureRequest.FLASH_MODE, FLASH_MODE_OFF))
+ .isEqualTo(expectedFlashMode);
+ }
+
@Test
@LargeTest
public void triggerAf_futureSucceeds() throws Exception {
diff --git a/camera/camera-camera2/src/androidTest/java/androidx/camera/camera2/internal/LowLightBoostControlDeviceTest.kt b/camera/camera-camera2/src/androidTest/java/androidx/camera/camera2/internal/LowLightBoostControlDeviceTest.kt
new file mode 100644
index 0000000..b0a8f1d
--- /dev/null
+++ b/camera/camera-camera2/src/androidTest/java/androidx/camera/camera2/internal/LowLightBoostControlDeviceTest.kt
@@ -0,0 +1,100 @@
+/*
+ * Copyright 2024 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT 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.camera.camera2.internal
+
+import android.content.Context
+import androidx.camera.camera2.Camera2Config
+import androidx.camera.camera2.internal.util.TestUtil
+import androidx.camera.core.CameraSelector
+import androidx.camera.core.Preview
+import androidx.camera.core.internal.CameraUseCaseAdapter
+import androidx.camera.testing.impl.CameraUtil
+import androidx.camera.testing.impl.CameraUtil.PreTestCameraIdList
+import androidx.camera.testing.impl.CameraXUtil
+import androidx.test.core.app.ApplicationProvider
+import androidx.test.ext.junit.runners.AndroidJUnit4
+import androidx.test.filters.LargeTest
+import androidx.test.filters.SdkSuppress
+import androidx.test.platform.app.InstrumentationRegistry
+import java.util.concurrent.TimeUnit
+import org.junit.After
+import org.junit.Assume.assumeTrue
+import org.junit.Before
+import org.junit.Rule
+import org.junit.Test
+import org.junit.runner.RunWith
+
+private val DEFAULT_CAMERA_SELECTOR = CameraSelector.DEFAULT_BACK_CAMERA
+
+@LargeTest
+@RunWith(AndroidJUnit4::class)
+@SdkSuppress(minSdkVersion = 35)
+class LowLightBoostControlDeviceTest {
+
+ @get:Rule
+ val cameraRule =
+ CameraUtil.grantCameraPermissionAndPreTestAndPostTest(
+ PreTestCameraIdList(Camera2Config.defaultConfig())
+ )
+
+ val context = ApplicationProvider.getApplicationContext() as Context
+
+ private lateinit var camera: CameraUseCaseAdapter
+
+ @Before
+ fun setUp() {
+ assumeTrue(CameraUtil.hasCameraWithLensFacing(DEFAULT_CAMERA_SELECTOR.lensFacing!!))
+ // Init CameraX
+ val config = Camera2Config.defaultConfig()
+ CameraXUtil.initialize(context, config)
+
+ // Prepare LowLightBoostControl
+ // To get a functional Camera2CameraControlImpl, it needs to bind an active UseCase and the
+ // UseCase must have repeating surface. Create and bind Preview as repeating surface.
+ camera =
+ CameraUtil.createCameraAndAttachUseCase(
+ context,
+ DEFAULT_CAMERA_SELECTOR,
+ Preview.Builder().build()
+ )
+ }
+
+ @After
+ fun tearDown() {
+ if (::camera.isInitialized) {
+ InstrumentationRegistry.getInstrumentation().runOnMainSync {
+ // TODO: The removeUseCases() call might be removed after clarifying the
+ // abortCaptures() issue in b/162314023.
+ camera.removeUseCases(camera.getUseCases())
+ }
+ }
+
+ CameraXUtil.shutdown().get(10000, TimeUnit.MILLISECONDS)
+ }
+
+ @Test
+ fun enableDisableLowLightBoost_futureWillCompleteSuccessfully_whenLlbIsSupported() {
+ assumeTrue(camera.cameraInfo.isLowLightBoostSupported)
+ TestUtil.getCamera2CameraControlImpl(camera.cameraControl).lowLightBoostControl.apply {
+ // Future should return with no exception
+ enableLowLightBoost(true).get(3, TimeUnit.SECONDS)
+
+ // Future should return with no exception
+ enableLowLightBoost(false).get(3, TimeUnit.SECONDS)
+ }
+ }
+}
diff --git a/camera/camera-camera2/src/main/java/androidx/camera/camera2/internal/Camera2CameraControlImpl.java b/camera/camera-camera2/src/main/java/androidx/camera/camera2/internal/Camera2CameraControlImpl.java
index 2b9b8a2..ef38ab5 100644
--- a/camera/camera-camera2/src/main/java/androidx/camera/camera2/internal/Camera2CameraControlImpl.java
+++ b/camera/camera-camera2/src/main/java/androidx/camera/camera2/internal/Camera2CameraControlImpl.java
@@ -16,6 +16,8 @@
package androidx.camera.camera2.internal;
+import static android.hardware.camera2.CameraMetadata.CONTROL_AE_MODE_ON_LOW_LIGHT_BOOST_BRIGHTNESS_PRIORITY;
+
import static androidx.camera.core.ImageCapture.FLASH_MODE_AUTO;
import static androidx.camera.core.ImageCapture.FLASH_MODE_OFF;
import static androidx.camera.core.ImageCapture.FLASH_MODE_ON;
@@ -124,6 +126,7 @@
private final FocusMeteringControl mFocusMeteringControl;
private final ZoomControl mZoomControl;
private final TorchControl mTorchControl;
+ private final LowLightBoostControl mLowLightBoostControl;
private final ExposureControl mExposureControl;
@VisibleForTesting
ZslControl mZslControl;
@@ -137,6 +140,7 @@
// use volatile modifier to make these variables in sync in all threads.
private volatile boolean mIsTorchOn = false;
+ private volatile boolean mIsLowLightBoostOn = false;
@ImageCapture.FlashMode
private volatile int mFlashMode = FLASH_MODE_OFF;
@@ -201,6 +205,7 @@
this, scheduler, mExecutor, cameraQuirks);
mZoomControl = new ZoomControl(this, mCameraCharacteristics, mExecutor);
mTorchControl = new TorchControl(this, mCameraCharacteristics, mExecutor);
+ mLowLightBoostControl = new LowLightBoostControl(this, mCameraCharacteristics, mExecutor);
if (Build.VERSION.SDK_INT >= 23) {
mZslControl = new ZslControlImpl(mCameraCharacteristics, mExecutor);
} else {
@@ -262,6 +267,10 @@
return mTorchControl;
}
+ public @NonNull LowLightBoostControl getLowLightBoostControl() {
+ return mLowLightBoostControl;
+ }
+
public @NonNull ExposureControl getExposureControl() {
return mExposureControl;
}
@@ -307,6 +316,7 @@
Logger.d(TAG, "setActive: isActive = " + isActive);
mFocusMeteringControl.setActive(isActive);
mZoomControl.setActive(isActive);
+ mLowLightBoostControl.setActive(isActive);
mTorchControl.setActive(isActive);
mExposureControl.setActive(isActive);
mCamera2CameraControl.setActive(isActive);
@@ -424,6 +434,17 @@
return Futures.nonCancellationPropagating(mTorchControl.enableTorch(torch));
}
+ /** {@inheritDoc} */
+ @Override
+ public @NonNull ListenableFuture<Void> enableLowLightBoostAsync(final boolean lowLightBoost) {
+ if (!isControlInUse()) {
+ return Futures.immediateFailedFuture(
+ new OperationCanceledException("Camera is not active."));
+ }
+ return Futures.nonCancellationPropagating(
+ mLowLightBoostControl.enableLowLightBoost(lowLightBoost));
+ }
+
@ExecutedBy("mExecutor")
private @NonNull ListenableFuture<Void> waitForSessionUpdateId(long sessionUpdateIdToWait) {
return CallbackToFutureAdapter.getFuture(completer -> {
@@ -623,30 +644,66 @@
@SuppressWarnings("WeakerAccess") /* synthetic accessor */
@ExecutedBy("mExecutor")
void enableTorchInternal(boolean torch) {
+ // When low-light boost is on, any torch related operations will be ignored.
+ if (mIsLowLightBoostOn) {
+ return;
+ }
+
mIsTorchOn = torch;
if (!torch) {
- // Send capture request with AE_MODE_ON + FLASH_MODE_OFF to turn off torch.
- CaptureConfig.Builder singleRequestBuilder = new CaptureConfig.Builder();
- singleRequestBuilder.setTemplateType(mTemplate);
- singleRequestBuilder.setUseRepeatingSurface(true);
- Camera2ImplConfig.Builder configBuilder = new Camera2ImplConfig.Builder();
- configBuilder.setCaptureRequestOption(CaptureRequest.CONTROL_AE_MODE,
- getSupportedAeMode(CaptureRequest.CONTROL_AE_MODE_ON));
- configBuilder.setCaptureRequestOption(CaptureRequest.FLASH_MODE,
- CaptureRequest.FLASH_MODE_OFF);
- singleRequestBuilder.addImplementationOptions(configBuilder.build());
- submitCaptureRequestsInternal(
- Collections.singletonList(singleRequestBuilder.build()));
+ // On some devices, needs to reset the AE/flash state to ensure that the torch can be
+ // turned off.
+ resetAeFlashState();
}
updateSessionConfigSynchronous();
}
+ @SuppressWarnings("WeakerAccess") /* synthetic accessor */
+ @ExecutedBy("mExecutor")
+ void enableLowLightBoostInternal(boolean lowLightBoost) {
+ if (mIsLowLightBoostOn == lowLightBoost) {
+ return;
+ }
+
+ // Forces turn off torch before enabling low-light boost.
+ if (lowLightBoost && mIsTorchOn) {
+ // On some devices, needs to reset the AE/flash state to ensure that the torch can be
+ // turned off.
+ resetAeFlashState();
+ mIsTorchOn = false;
+ mTorchControl.forceUpdateTorchStateToOff();
+ }
+
+ mIsLowLightBoostOn = lowLightBoost;
+ updateSessionConfigSynchronous();
+ }
+
+ private void resetAeFlashState() {
+ // Send capture request with AE_MODE_ON + FLASH_MODE_OFF to reset the AE/flash state.
+ CaptureConfig.Builder singleRequestBuilder = new CaptureConfig.Builder();
+ singleRequestBuilder.setTemplateType(mTemplate);
+ singleRequestBuilder.setUseRepeatingSurface(true);
+ Camera2ImplConfig.Builder configBuilder = new Camera2ImplConfig.Builder();
+ configBuilder.setCaptureRequestOption(CaptureRequest.CONTROL_AE_MODE,
+ getSupportedAeMode(CaptureRequest.CONTROL_AE_MODE_ON));
+ configBuilder.setCaptureRequestOption(CaptureRequest.FLASH_MODE,
+ CaptureRequest.FLASH_MODE_OFF);
+ singleRequestBuilder.addImplementationOptions(configBuilder.build());
+ submitCaptureRequestsInternal(
+ Collections.singletonList(singleRequestBuilder.build()));
+ }
+
@ExecutedBy("mExecutor")
boolean isTorchOn() {
return mIsTorchOn;
}
@ExecutedBy("mExecutor")
+ boolean isLowLightBoostOn() {
+ return mIsLowLightBoostOn;
+ }
+
+ @ExecutedBy("mExecutor")
void submitCaptureRequestsInternal(final List<CaptureConfig> captureConfigs) {
mControlUpdateCallback.onCameraControlCaptureRequests(captureConfigs);
}
@@ -676,7 +733,9 @@
aeMode = CaptureRequest.CONTROL_AE_MODE_ON_EXTERNAL_FLASH;
}
- if (mIsTorchOn) {
+ if (mIsLowLightBoostOn) {
+ aeMode = CONTROL_AE_MODE_ON_LOW_LIGHT_BOOST_BRIGHTNESS_PRIORITY;
+ } else if (mIsTorchOn) {
builder.setCaptureRequestOptionWithPriority(CaptureRequest.FLASH_MODE,
CaptureRequest.FLASH_MODE_TORCH, Config.OptionPriority.REQUIRED);
} else {
diff --git a/camera/camera-camera2/src/main/java/androidx/camera/camera2/internal/Camera2CameraInfoImpl.java b/camera/camera-camera2/src/main/java/androidx/camera/camera2/internal/Camera2CameraInfoImpl.java
index 65ed945..81a5d90 100644
--- a/camera/camera-camera2/src/main/java/androidx/camera/camera2/internal/Camera2CameraInfoImpl.java
+++ b/camera/camera-camera2/src/main/java/androidx/camera/camera2/internal/Camera2CameraInfoImpl.java
@@ -110,6 +110,8 @@
@GuardedBy("mLock")
private @Nullable RedirectableLiveData<Integer> mRedirectTorchStateLiveData = null;
@GuardedBy("mLock")
+ private @Nullable RedirectableLiveData<Integer> mRedirectLowLightBoostStateLiveData = null;
+ @GuardedBy("mLock")
private @Nullable RedirectableLiveData<ZoomState> mRedirectZoomStateLiveData = null;
private final @NonNull RedirectableLiveData<CameraState> mCameraStateLiveData;
@GuardedBy("mLock")
@@ -159,6 +161,11 @@
mCamera2CameraControlImpl.getTorchControl().getTorchState());
}
+ if (mRedirectLowLightBoostStateLiveData != null) {
+ mRedirectLowLightBoostStateLiveData.redirectTo(mCamera2CameraControlImpl
+ .getLowLightBoostControl().getLowLightBoostState());
+ }
+
if (mCameraCaptureCallbacks != null) {
for (Pair<CameraCaptureCallback, Executor> pair :
mCameraCaptureCallbacks) {
@@ -291,6 +298,31 @@
}
@Override
+ public boolean isLowLightBoostSupported() {
+ return LowLightBoostControl.checkLowLightBoostAvailability(mCameraCharacteristicsCompat);
+ }
+
+ @Override
+ public @NonNull LiveData<Integer> getLowLightBoostState() {
+ synchronized (mLock) {
+ if (mCamera2CameraControlImpl == null) {
+ if (mRedirectLowLightBoostStateLiveData == null) {
+ mRedirectLowLightBoostStateLiveData =
+ new RedirectableLiveData<>(LowLightBoostControl.DEFAULT_LLB_STATE);
+ }
+ return mRedirectLowLightBoostStateLiveData;
+ }
+
+ // if RedirectableLiveData exists, use it directly.
+ if (mRedirectLowLightBoostStateLiveData != null) {
+ return mRedirectLowLightBoostStateLiveData;
+ }
+
+ return mCamera2CameraControlImpl.getLowLightBoostControl().getLowLightBoostState();
+ }
+ }
+
+ @Override
public @NonNull LiveData<ZoomState> getZoomState() {
synchronized (mLock) {
if (mCamera2CameraControlImpl == null) {
diff --git a/camera/camera-camera2/src/main/java/androidx/camera/camera2/internal/Camera2CapturePipeline.java b/camera/camera-camera2/src/main/java/androidx/camera/camera2/internal/Camera2CapturePipeline.java
index d000354..42a38eb 100644
--- a/camera/camera-camera2/src/main/java/androidx/camera/camera2/internal/Camera2CapturePipeline.java
+++ b/camera/camera-camera2/src/main/java/androidx/camera/camera2/internal/Camera2CapturePipeline.java
@@ -326,7 +326,8 @@
null) : Futures.immediateFuture(null);
preCapture = FutureChain.from(getResult).transformAsync(captureResult -> {
- if (isFlashRequired(flashMode, captureResult)) {
+ if (!mCameraControl.isLowLightBoostOn() && isFlashRequired(flashMode,
+ captureResult)) {
setTimeout3A(CHECK_3A_WITH_FLASH_TIMEOUT_IN_NS);
}
return mPipelineSubTask.preCapture(captureResult);
@@ -625,7 +626,9 @@
Logger.d(TAG, "TorchTask#preCapture: isFlashRequired = " + isFlashRequired);
if (isFlashRequired(mFlashMode, captureResult)) {
- if (mCameraControl.isTorchOn()) {
+ if (mCameraControl.isLowLightBoostOn()) {
+ Logger.d(TAG, "Low-light boost already on, not turn on");
+ } else if (mCameraControl.isTorchOn()) {
Logger.d(TAG, "Torch already on, not turn on");
} else {
Logger.d(TAG, "Turn on torch");
@@ -694,7 +697,7 @@
@Override
public @NonNull ListenableFuture<Boolean> preCapture(
@Nullable TotalCaptureResult captureResult) {
- if (isFlashRequired(mFlashMode, captureResult)) {
+ if (!mCameraControl.isLowLightBoostOn() && isFlashRequired(mFlashMode, captureResult)) {
Logger.d(TAG, "Trigger AE");
mIsExecuted = true;
diff --git a/camera/camera-camera2/src/main/java/androidx/camera/camera2/internal/LowLightBoostControl.java b/camera/camera-camera2/src/main/java/androidx/camera/camera2/internal/LowLightBoostControl.java
new file mode 100644
index 0000000..78bcb35
--- /dev/null
+++ b/camera/camera-camera2/src/main/java/androidx/camera/camera2/internal/LowLightBoostControl.java
@@ -0,0 +1,266 @@
+/*
+ * Copyright 2024 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT 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.camera.camera2.internal;
+
+import static android.hardware.camera2.CameraMetadata.CONTROL_AE_MODE_ON_LOW_LIGHT_BOOST_BRIGHTNESS_PRIORITY;
+import static android.hardware.camera2.CaptureResult.CONTROL_LOW_LIGHT_BOOST_STATE;
+
+import android.hardware.camera2.CameraCharacteristics;
+import android.hardware.camera2.CaptureRequest;
+import android.os.Build;
+
+import androidx.annotation.VisibleForTesting;
+import androidx.camera.camera2.internal.annotation.CameraExecutor;
+import androidx.camera.camera2.internal.compat.CameraCharacteristicsCompat;
+import androidx.camera.core.CameraControl;
+import androidx.camera.core.Logger;
+import androidx.camera.core.LowLightBoostState;
+import androidx.camera.core.impl.annotation.ExecutedBy;
+import androidx.camera.core.impl.utils.Threads;
+import androidx.camera.core.impl.utils.futures.Futures;
+import androidx.concurrent.futures.CallbackToFutureAdapter;
+import androidx.concurrent.futures.CallbackToFutureAdapter.Completer;
+import androidx.lifecycle.LiveData;
+import androidx.lifecycle.MutableLiveData;
+
+import com.google.common.util.concurrent.ListenableFuture;
+
+import org.jspecify.annotations.NonNull;
+import org.jspecify.annotations.Nullable;
+
+import java.util.concurrent.Executor;
+
+/**
+ * Implementation of low-light boost control used within CameraControl and CameraInfo.
+ *
+ * It is used to control the low-light boost mode of camera device that
+ * {@link Camera2CameraControlImpl} operates. The low-light boost control must be activated via
+ * {@link #setActive(boolean)} when the camera device is ready to do low-light boost operations
+ * and be deactivated when the camera device is closing or closed.
+ */
+final class LowLightBoostControl {
+ private static final String TAG = "LowLightBoostControl";
+ static final int DEFAULT_LLB_STATE = LowLightBoostState.OFF;
+
+ @SuppressWarnings("WeakerAccess") /* synthetic accessor */
+ private final Camera2CameraControlImpl mCamera2CameraControlImpl;
+ private final MutableLiveData<Integer> mLowLightBoostState;
+ private final boolean mIsLowLightBoostSupported;
+ @CameraExecutor
+ private final Executor mExecutor;
+
+ private boolean mIsActive;
+ @SuppressWarnings("WeakerAccess") /* synthetic accessor */
+ CallbackToFutureAdapter.Completer<Void> mEnableLlbCompleter;
+ @SuppressWarnings("WeakerAccess") /* synthetic accessor */
+ boolean mTargetLlbEnabled;
+
+ @VisibleForTesting
+ final Camera2CameraControlImpl.CaptureResultListener mCaptureResultListener;
+
+ /**
+ * Constructs a LowLightBoostControl.
+ *
+ * @param camera2CameraControlImpl the camera control this LowLightBoostControl belongs.
+ * @param cameraCharacteristics the characteristics for the camera being controlled.
+ * @param executor the camera executor used to run camera task.
+ */
+ LowLightBoostControl(@NonNull Camera2CameraControlImpl camera2CameraControlImpl,
+ @NonNull CameraCharacteristicsCompat cameraCharacteristics,
+ @CameraExecutor @NonNull Executor executor) {
+ mCamera2CameraControlImpl = camera2CameraControlImpl;
+ mExecutor = executor;
+
+ mIsLowLightBoostSupported = checkLowLightBoostAvailability(cameraCharacteristics);
+ mLowLightBoostState = new MutableLiveData<>(DEFAULT_LLB_STATE);
+
+ mCaptureResultListener = captureResult -> {
+ if (mEnableLlbCompleter != null) {
+ CaptureRequest captureRequest = captureResult.getRequest();
+ Integer aeMode = captureRequest.get(CaptureRequest.CONTROL_AE_MODE);
+
+ // Skips the check if capture result doesn't contain AE mode related info.
+ if (aeMode == null) {
+ return false;
+ }
+
+ // mTargetLlbEnabled might be either true or false.
+ // - When mTargetLlbEnabled is true: complete the completer when
+ // AE mode becomes CONTROL_AE_MODE_ON_LOW_LIGHT_BOOST_BRIGHTNESS_PRIORITY.
+ // - When mTargetLlbEnabled is false: complete the completer when
+ // AE mode becomes non-CONTROL_AE_MODE_ON_LOW_LIGHT_BOOST_BRIGHTNESS_PRIORITY.
+ boolean llbEnabled =
+ aeMode == CONTROL_AE_MODE_ON_LOW_LIGHT_BOOST_BRIGHTNESS_PRIORITY;
+ if (llbEnabled == mTargetLlbEnabled) {
+ mEnableLlbCompleter.set(null);
+ mEnableLlbCompleter = null;
+ } else {
+ return false;
+ }
+ }
+
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.VANILLA_ICE_CREAM
+ && mTargetLlbEnabled) {
+ Integer currentState = captureResult.get(CONTROL_LOW_LIGHT_BOOST_STATE);
+ if (currentState != null) {
+ setLiveDataValue(mLowLightBoostState, currentState);
+ }
+ }
+
+ // Return false to keep getting captureResult.
+ return false;
+ };
+
+ if (mIsLowLightBoostSupported) {
+ mCamera2CameraControlImpl.addCaptureResultListener(mCaptureResultListener);
+ }
+ }
+
+ /**
+ * Set current active state. Set active if it is ready to do low-light boost operations.
+ *
+ * @param isActive true to activate or false otherwise.
+ */
+ @ExecutedBy("mExecutor")
+ void setActive(boolean isActive) {
+ if (mIsActive == isActive) {
+ return;
+ }
+
+ mIsActive = isActive;
+
+ if (!isActive) {
+ if (mTargetLlbEnabled) {
+ mTargetLlbEnabled = false;
+ mCamera2CameraControlImpl.enableLowLightBoostInternal(false);
+ setLiveDataValue(mLowLightBoostState, LowLightBoostState.OFF);
+ }
+
+ if (mEnableLlbCompleter != null) {
+ mEnableLlbCompleter.setException(
+ new CameraControl.OperationCanceledException("Camera is not active."));
+ mEnableLlbCompleter = null;
+ }
+ }
+ }
+
+ /**
+ * Enable or disable the low-light boost.
+ *
+ * <p>The returned {@link ListenableFuture} will succeed when the request is sent to camera
+ * device. But it may get an {@link CameraControl.OperationCanceledException} result when:
+ * <ol>
+ * <li>There are multiple {@code enableLowLightBoost(boolean)} requests in the same time, the
+ * older and incomplete futures will get cancelled.
+ * <li>When the LowLightBoostControl is set to inactive.
+ * </ol>
+ *
+ * <p>The returned {@link ListenableFuture} will fail immediately when:
+ * <ol>
+ * <li>The LowLightBoostControl is not in active state.
+ * <li>The camera doesn't support low-light boost mode.
+ * </ol>
+ *
+ * @param enabled true to open the low-light boost, false to close it.
+ * @return A {@link ListenableFuture} which is successful when the low-light boost was changed
+ * to the value specified. It fails when it is unable to change the low-light boost state.
+ */
+ ListenableFuture<Void> enableLowLightBoost(boolean enabled) {
+ if (!mIsLowLightBoostSupported) {
+ Logger.d(TAG, "Unable to enable low-light boost due to it is not supported.");
+ return Futures.immediateFailedFuture(
+ new IllegalStateException("Low-light boost is not supported"));
+ }
+
+ setLiveDataValue(mLowLightBoostState,
+ enabled ? LowLightBoostState.INACTIVE : LowLightBoostState.OFF);
+
+ return CallbackToFutureAdapter.getFuture(completer -> {
+ mExecutor.execute(() -> enableLowLightBoostInternal(completer, enabled));
+ return "enableLowLightBoost: " + enabled;
+ });
+ }
+
+ /**
+ * Returns a {@link LiveData} of current {@link LowLightBoostState}.
+ *
+ * <p>The low-light boost state can be enabled or disabled via
+ * {@link #enableLowLightBoost(boolean)} which will trigger the change event to the returned
+ * {@link LiveData}.
+ *
+ * @return a {@link LiveData} containing current low-light boost state.
+ */
+ @NonNull
+ LiveData<Integer> getLowLightBoostState() {
+ return mLowLightBoostState;
+ }
+
+ @SuppressWarnings("WeakerAccess") /* synthetic accessor */
+ @ExecutedBy("mExecutor")
+ void enableLowLightBoostInternal(@Nullable Completer<Void> completer, boolean enabled) {
+ if (!mIsActive) {
+ setLiveDataValue(mLowLightBoostState, LowLightBoostState.OFF);
+ if (completer != null) {
+ completer.setException(
+ new CameraControl.OperationCanceledException("Camera is not active."));
+ }
+ return;
+ }
+
+ mTargetLlbEnabled = enabled;
+ mCamera2CameraControlImpl.enableLowLightBoostInternal(enabled);
+ setLiveDataValue(mLowLightBoostState,
+ enabled ? LowLightBoostState.INACTIVE : LowLightBoostState.OFF);
+ if (mEnableLlbCompleter != null) {
+ mEnableLlbCompleter.setException(new CameraControl.OperationCanceledException(
+ "There is a new enableLowLightBoost being set"));
+ }
+ mEnableLlbCompleter = completer;
+ }
+
+ boolean isLowLightBoostSupported() {
+ return mIsLowLightBoostSupported;
+ }
+
+ static boolean checkLowLightBoostAvailability(
+ @NonNull CameraCharacteristicsCompat cameraCharacteristics) {
+ if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.UPSIDE_DOWN_CAKE) {
+ return false;
+ }
+
+ int[] availableAeModes = cameraCharacteristics.get(
+ CameraCharacteristics.CONTROL_AE_AVAILABLE_MODES);
+ if (availableAeModes != null) {
+ for (int availableAeMode : availableAeModes) {
+ if (availableAeMode
+ == CONTROL_AE_MODE_ON_LOW_LIGHT_BOOST_BRIGHTNESS_PRIORITY) {
+ return true;
+ }
+ }
+ }
+
+ return false;
+ }
+
+ private <T> void setLiveDataValue(@NonNull MutableLiveData<T> liveData, T value) {
+ if (Threads.isMainThread()) {
+ liveData.setValue(value);
+ } else {
+ liveData.postValue(value);
+ }
+ }
+}
diff --git a/camera/camera-camera2/src/main/java/androidx/camera/camera2/internal/TorchControl.java b/camera/camera-camera2/src/main/java/androidx/camera/camera2/internal/TorchControl.java
index c18d7b0..d4c634e 100644
--- a/camera/camera-camera2/src/main/java/androidx/camera/camera2/internal/TorchControl.java
+++ b/camera/camera-camera2/src/main/java/androidx/camera/camera2/internal/TorchControl.java
@@ -61,9 +61,9 @@
private boolean mIsActive;
@SuppressWarnings("WeakerAccess") /* synthetic accessor */
- CallbackToFutureAdapter.Completer<Void> mEnableTorchCompleter;
+ CallbackToFutureAdapter.Completer<Void> mEnableTorchCompleter;
@SuppressWarnings("WeakerAccess") /* synthetic accessor */
- boolean mTargetTorchEnabled;
+ boolean mTargetTorchEnabled;
/**
* Constructs a TorchControl.
@@ -193,6 +193,14 @@
return;
}
+ if (mCamera2CameraControlImpl.isLowLightBoostOn()) {
+ if (completer != null) {
+ completer.setException(new IllegalStateException(
+ "Torch can not be enabled when low-light boost is on!"));
+ }
+ return;
+ }
+
mTargetTorchEnabled = enabled;
mCamera2CameraControlImpl.enableTorchInternal(enabled);
setLiveDataValue(mTorchState, enabled ? TorchState.ON : TorchState.OFF);
@@ -203,6 +211,23 @@
mEnableTorchCompleter = completer;
}
+ /**
+ * Force update the torch state to OFF.
+ *
+ * <p>This can be invoked when low-light boost is turned on. The torch state will also be
+ * updated as {@link TorchState#OFF}.
+ */
+ @ExecutedBy("mExecutor")
+ void forceUpdateTorchStateToOff() {
+ // Directly return if torch is originally off
+ if (!mTargetTorchEnabled) {
+ return;
+ }
+
+ mTargetTorchEnabled = false;
+ setLiveDataValue(mTorchState, TorchState.OFF);
+ }
+
private <T> void setLiveDataValue(@NonNull MutableLiveData<T> liveData, T value) {
if (Threads.isMainThread()) {
liveData.setValue(value);
diff --git a/camera/camera-camera2/src/test/java/androidx/camera/camera2/internal/Camera2CameraInfoImplTest.java b/camera/camera-camera2/src/test/java/androidx/camera/camera2/internal/Camera2CameraInfoImplTest.java
index 3228d2b..529c505 100644
--- a/camera/camera-camera2/src/test/java/androidx/camera/camera2/internal/Camera2CameraInfoImplTest.java
+++ b/camera/camera-camera2/src/test/java/androidx/camera/camera2/internal/Camera2CameraInfoImplTest.java
@@ -17,6 +17,7 @@
package androidx.camera.camera2.internal;
import static android.hardware.camera2.CameraCharacteristics.REQUEST_AVAILABLE_CAPABILITIES;
+import static android.hardware.camera2.CameraMetadata.CONTROL_AE_MODE_ON_LOW_LIGHT_BOOST_BRIGHTNESS_PRIORITY;
import static android.hardware.camera2.CameraMetadata.CONTROL_VIDEO_STABILIZATION_MODE_OFF;
import static android.hardware.camera2.CameraMetadata.CONTROL_VIDEO_STABILIZATION_MODE_ON;
import static android.hardware.camera2.CameraMetadata.CONTROL_VIDEO_STABILIZATION_MODE_PREVIEW_STABILIZATION;
@@ -62,6 +63,7 @@
import androidx.camera.core.DynamicRange;
import androidx.camera.core.ExposureState;
import androidx.camera.core.FocusMeteringAction;
+import androidx.camera.core.LowLightBoostState;
import androidx.camera.core.SurfaceOrientedMeteringPointFactory;
import androidx.camera.core.TorchState;
import androidx.camera.core.ZoomState;
@@ -163,6 +165,7 @@
private CameraManagerCompat mCameraManagerCompat;
private ZoomControl mMockZoomControl;
private TorchControl mMockTorchControl;
+ private LowLightBoostControl mMockLowLightBoostControl;
private ExposureControl mExposureControl;
private FocusMeteringControl mFocusMeteringControl;
private Camera2CameraControlImpl mMockCameraControl;
@@ -254,6 +257,27 @@
assertThat(cameraInfoInternal.hasFlashUnit()).isEqualTo(CAMERA1_FLASH_INFO_BOOLEAN);
}
+ @Config(minSdk = 35)
+ @Test
+ public void cameraInfo_canReturnLowLightBoostSupported_forBackCamera()
+ throws CameraAccessExceptionCompat {
+ init(/* hasAvailableCapabilities = */ false);
+
+ CameraInfoInternal cameraInfoInternal =
+ new Camera2CameraInfoImpl(CAMERA0_ID, mCameraManagerCompat);
+ assertThat(cameraInfoInternal.isLowLightBoostSupported()).isTrue();
+ }
+
+ @Test
+ public void cameraInfo_canReturnLowLightBoostSupported_forFrontCamera()
+ throws CameraAccessExceptionCompat {
+ init(/* hasAvailableCapabilities = */ false);
+
+ CameraInfoInternal cameraInfoInternal =
+ new Camera2CameraInfoImpl(CAMERA1_ID, mCameraManagerCompat);
+ assertThat(cameraInfoInternal.isLowLightBoostSupported()).isFalse();
+ }
+
@Test
public void cameraInfoWithoutCameraControl_canReturnDefaultTorchState()
throws CameraAccessExceptionCompat {
@@ -296,6 +320,46 @@
assertThat(camera2CameraInfoImpl.getTorchState().getValue()).isEqualTo(TorchState.ON);
}
+ @Config(minSdk = 35)
+ @Test
+ public void cameraInfoWithCameraControl_canReturnLowLightBoostState()
+ throws CameraAccessExceptionCompat {
+ init(/* hasAvailableCapabilities = */ false);
+
+ when(mMockLowLightBoostControl.getLowLightBoostState()).thenReturn(
+ new MutableLiveData<>(LowLightBoostState.ACTIVE));
+ Camera2CameraInfoImpl camera2CameraInfoImpl =
+ new Camera2CameraInfoImpl(CAMERA0_ID, mCameraManagerCompat);
+ camera2CameraInfoImpl.linkWithCameraControl(mMockCameraControl);
+ assertThat(camera2CameraInfoImpl.getLowLightBoostState().getValue()).isEqualTo(
+ LowLightBoostState.ACTIVE);
+ }
+
+ @Config(minSdk = 35)
+ @Test
+ public void lowLightBoostStateLiveData_SameInstanceBeforeAndAfterCameraControlLink()
+ throws CameraAccessExceptionCompat {
+ init(/* hasAvailableCapabilities = */ false);
+
+ Camera2CameraInfoImpl camera2CameraInfoImpl =
+ new Camera2CameraInfoImpl(CAMERA0_ID, mCameraManagerCompat);
+
+ // Calls getLowLightBoostState() to trigger RedirectableLiveData
+ LiveData<Integer> lowLightBoostStateLiveData =
+ camera2CameraInfoImpl.getLowLightBoostState();
+
+ when(mMockLowLightBoostControl.getLowLightBoostState()).thenReturn(
+ new MutableLiveData<>(LowLightBoostState.ACTIVE));
+ camera2CameraInfoImpl.linkWithCameraControl(mMockCameraControl);
+
+ // LowLightBoostState LiveData instances are the same before and after the
+ // linkWithCameraControl.
+ assertThat(camera2CameraInfoImpl.getLowLightBoostState()).isSameInstanceAs(
+ lowLightBoostStateLiveData);
+ assertThat(camera2CameraInfoImpl.getLowLightBoostState().getValue()).isEqualTo(
+ LowLightBoostState.ACTIVE);
+ }
+
// zoom related tests just ensure it uses ZoomControl to get the value
// Full tests are performed at ZoomControlDeviceTest / ZoomControlTest.
@Test
@@ -937,12 +1001,14 @@
mMockZoomControl = mock(ZoomControl.class);
mMockTorchControl = mock(TorchControl.class);
+ mMockLowLightBoostControl = mock(LowLightBoostControl.class);
mExposureControl = mock(ExposureControl.class);
mMockCameraControl = mock(Camera2CameraControlImpl.class);
mFocusMeteringControl = mock(FocusMeteringControl.class);
when(mMockCameraControl.getZoomControl()).thenReturn(mMockZoomControl);
when(mMockCameraControl.getTorchControl()).thenReturn(mMockTorchControl);
+ when(mMockCameraControl.getLowLightBoostControl()).thenReturn(mMockLowLightBoostControl);
when(mMockCameraControl.getExposureControl()).thenReturn(mExposureControl);
when(mMockCameraControl.getFocusMeteringControl()).thenReturn(mFocusMeteringControl);
}
@@ -1022,6 +1088,16 @@
});
}
+ // Adds low-light boost support for the back camera since API 35
+ if (Build.VERSION.SDK_INT >= 35) {
+ shadowCharacteristics0.set(
+ CameraCharacteristics.CONTROL_AE_AVAILABLE_MODES,
+ new int[]{
+ CONTROL_AE_MODE_ON_LOW_LIGHT_BOOST_BRIGHTNESS_PRIORITY
+ }
+ );
+ }
+
// Mock the request capability
if (hasAvailableCapabilities) {
shadowCharacteristics0.set(REQUEST_AVAILABLE_CAPABILITIES,
diff --git a/camera/camera-camera2/src/test/java/androidx/camera/camera2/internal/Camera2CapturePipelineTest.kt b/camera/camera-camera2/src/test/java/androidx/camera/camera2/internal/Camera2CapturePipelineTest.kt
index a9e2c9d..0a8d0c7 100644
--- a/camera/camera-camera2/src/test/java/androidx/camera/camera2/internal/Camera2CapturePipelineTest.kt
+++ b/camera/camera-camera2/src/test/java/androidx/camera/camera2/internal/Camera2CapturePipelineTest.kt
@@ -23,13 +23,13 @@
import android.hardware.camera2.CameraDevice
import android.hardware.camera2.CameraManager
import android.hardware.camera2.CameraMetadata
+import android.hardware.camera2.CameraMetadata.CONTROL_AE_MODE_ON_LOW_LIGHT_BOOST_BRIGHTNESS_PRIORITY
import android.hardware.camera2.CaptureRequest
import android.hardware.camera2.CaptureResult
import android.hardware.camera2.TotalCaptureResult
import android.media.Image
import android.media.ImageWriter
import android.os.Build
-import android.os.Looper
import android.view.Surface
import androidx.annotation.RequiresApi
import androidx.camera.camera2.impl.Camera2ImplConfig
@@ -79,15 +79,14 @@
import kotlinx.coroutines.withTimeout
import org.junit.After
import org.junit.Assert.assertThrows
-import org.junit.Assert.assertTrue
+import org.junit.Assume.assumeTrue
import org.junit.Before
import org.junit.Ignore
import org.junit.Test
import org.junit.runner.RunWith
import org.mockito.Mockito
import org.mockito.Mockito.mock
-import org.robolectric.RobolectricTestRunner
-import org.robolectric.Shadows
+import org.robolectric.ParameterizedRobolectricTestRunner
import org.robolectric.annotation.Config
import org.robolectric.annotation.internal.DoNotInstrument
import org.robolectric.shadow.api.Shadow
@@ -96,12 +95,12 @@
private const val CAMERA_ID_0 = "0"
-@RunWith(RobolectricTestRunner::class)
+@RunWith(ParameterizedRobolectricTestRunner::class)
@DoNotInstrument
@Config(
minSdk = Build.VERSION_CODES.LOLLIPOP,
)
-class Camera2CapturePipelineTest {
+class Camera2CapturePipelineTest(private val isLowLightBoostEnabled: Boolean) {
private val context = ApplicationProvider.getApplicationContext() as Context
private val executorService = Executors.newSingleThreadScheduledExecutor()
@@ -151,8 +150,17 @@
private lateinit var testScreenFlash: MockScreenFlash
+ companion object {
+ @JvmStatic
+ @ParameterizedRobolectricTestRunner.Parameters(name = "isLowLightBoostEnabled: {0}")
+ fun data() = listOf(true, false)
+ }
+
@Before
fun setUp() {
+ if (isLowLightBoostEnabled) {
+ assumeTrue(Build.VERSION.SDK_INT >= 35)
+ }
initCameras()
testScreenFlash = MockScreenFlash()
}
@@ -212,8 +220,8 @@
)
// Assert.
- assertTrue(fakeTask.preCaptureCountDown.await(3, TimeUnit.SECONDS))
- assertTrue(fakeTask.postCaptureCountDown.await(3, TimeUnit.SECONDS))
+ assertThat(fakeTask.preCaptureCountDown.await(3, TimeUnit.SECONDS)).isTrue()
+ assertThat(fakeTask.postCaptureCountDown.await(3, TimeUnit.SECONDS)).isTrue()
}
@Test
@@ -288,12 +296,19 @@
simulateRepeatingResult(initialDelay = 100)
}
- // Assert 1, verify the CONTROL_AE_PRECAPTURE_TRIGGER is triggered
+ // Assert 1, verify the CONTROL_AE_PRECAPTURE_TRIGGER is triggered when low-light boost is
+ // off, otherwise, is not triggered.
immediateCompleteCapture.verifyRequestResult {
it.requestContains(
CaptureRequest.CONTROL_AE_PRECAPTURE_TRIGGER,
CaptureRequest.CONTROL_AE_PRECAPTURE_TRIGGER_START
- )
+ ) != isLowLightBoostEnabled
+ }
+
+ // When low-light boost is on, AE pre-capture is not triggered. Therefore, converged stage
+ // is not required.
+ if (isLowLightBoostEnabled) {
+ return
}
// Switch the repeating result to 3A converged state.
@@ -302,7 +317,8 @@
resultParameters = resultConverged
)
- // Assert 2 that CONTROL_AE_PRECAPTURE_TRIGGER should be cancelled finally.
+ // Assert 2 that CONTROL_AE_PRECAPTURE_TRIGGER should be cancelled finally when low-light
+ // boost is off, otherwise, TRIGGER_CANCEL is not triggered.
if (Build.VERSION.SDK_INT >= 23) {
immediateCompleteCapture.verifyRequestResult {
it.requestContains(
@@ -345,12 +361,19 @@
)
}
- // Assert 1, verify the CONTROL_AE_PRECAPTURE_TRIGGER is triggered
+ // Assert 1, verify the CONTROL_AE_PRECAPTURE_TRIGGER is triggered when low-light boost is
+ // off, otherwise, is not triggered.
immediateCompleteCapture.verifyRequestResult {
it.requestContains(
CaptureRequest.CONTROL_AE_PRECAPTURE_TRIGGER,
CaptureRequest.CONTROL_AE_PRECAPTURE_TRIGGER_START
- )
+ ) != isLowLightBoostEnabled
+ }
+
+ // When low-light boost is on, AE pre-capture is not triggered. Therefore, converged stage
+ // is not required.
+ if (isLowLightBoostEnabled) {
+ return
}
// Switch the repeating result to 3A converged state.
@@ -359,7 +382,8 @@
resultParameters = resultConverged
)
- // Assert 2 that CONTROL_AE_PRECAPTURE_TRIGGER should be cancelled finally.
+ // Assert 2 that CONTROL_AE_PRECAPTURE_TRIGGER should be cancelled finally when low-light
+ // boost is off, otherwise, TRIGGER_CANCEL is not triggered.
if (Build.VERSION.SDK_INT >= 23) {
immediateCompleteCapture.verifyRequestResult {
it.requestContains(
@@ -430,7 +454,19 @@
}
// Assert 1 torch should be turned on
- cameraControl.waitForSessionConfig { it.isTorchParameterEnabled() }
+ cameraControl.waitForSessionConfig {
+ if (isLowLightBoostEnabled) {
+ it.isLowLightBoostEnabled()
+ } else {
+ it.isTorchParameterEnabled()
+ }
+ }
+
+ // When low-light boost is on, AE pre-capture is not triggered. Therefore, converged stage
+ // is not required.
+ if (isLowLightBoostEnabled) {
+ return
+ }
// Switch the repeating result to 3A converged state.
cameraControl.simulateRepeatingResult(
@@ -468,7 +504,19 @@
}
// Assert 1 torch should be turned on
- cameraControl.waitForSessionConfig { it.isTorchParameterEnabled() }
+ cameraControl.waitForSessionConfig {
+ if (isLowLightBoostEnabled) {
+ it.isLowLightBoostEnabled()
+ } else {
+ it.isTorchParameterEnabled()
+ }
+ }
+
+ // When low-light boost is on, AE pre-capture is not triggered. Therefore, converged stage
+ // is not required.
+ if (isLowLightBoostEnabled) {
+ return
+ }
// Switch the repeating result to 3A converged state.
cameraControl.simulateRepeatingResult(
@@ -503,7 +551,19 @@
}
// Assert 1 torch should be turned on
- cameraControl.waitForSessionConfig { it.isTorchParameterEnabled() }
+ cameraControl.waitForSessionConfig {
+ if (isLowLightBoostEnabled) {
+ it.isLowLightBoostEnabled()
+ } else {
+ it.isTorchParameterEnabled()
+ }
+ }
+
+ // When low-light boost is on, AE pre-capture is not triggered. Therefore, converged stage
+ // is not required.
+ if (isLowLightBoostEnabled) {
+ return
+ }
// Switch the repeating result to 3A converged state.
cameraControl.simulateRepeatingResult(
@@ -794,7 +854,7 @@
// Assert.
val exception =
assertThrows(ExecutionException::class.java) { future.get(1, TimeUnit.SECONDS) }
- assertTrue(exception.cause is ImageCaptureException)
+ assertThat(exception.cause).isInstanceOf(ImageCaptureException::class.java)
assertThat((exception.cause as ImageCaptureException).imageCaptureError)
.isEqualTo(ImageCapture.ERROR_CAPTURE_FAILED)
}
@@ -830,7 +890,7 @@
// Assert.
val exception =
assertThrows(ExecutionException::class.java) { future.get(1, TimeUnit.SECONDS) }
- assertTrue(exception.cause is ImageCaptureException)
+ assertThat(exception.cause).isInstanceOf(ImageCaptureException::class.java)
assertThat((exception.cause as ImageCaptureException).imageCaptureError)
.isEqualTo(ImageCapture.ERROR_CAMERA_CLOSED)
}
@@ -1170,6 +1230,13 @@
CameraMetadata.FLASH_MODE_TORCH
}
+ private fun SessionConfig.isLowLightBoostEnabled(): Boolean {
+ val config = toCamera2Config()
+
+ return config.getCaptureRequestOption(CaptureRequest.CONTROL_AE_MODE, null) ==
+ CONTROL_AE_MODE_ON_LOW_LIGHT_BOOST_BRIGHTNESS_PRIORITY
+ }
+
private fun List<CaptureConfig>.isTorchParameterDisabled() =
requestContains(
CaptureRequest.CONTROL_AE_MODE,
@@ -1283,6 +1350,8 @@
setActive(true)
incrementUseCount()
this.screenFlash = testScreenFlash
+ // Applies low-light boost setting
+ enableLowLightBoostAndAssert(this)
}
}
@@ -1297,14 +1366,19 @@
set(CameraCharacteristics.FLASH_INFO_AVAILABLE, true)
set(
CameraCharacteristics.CONTROL_AE_AVAILABLE_MODES,
- intArrayOf(
- CaptureRequest.CONTROL_AE_MODE_OFF,
- CaptureRequest.CONTROL_AE_MODE_ON,
- CaptureRequest.CONTROL_AE_MODE_ON_AUTO_FLASH,
- CaptureRequest.CONTROL_AE_MODE_ON_ALWAYS_FLASH,
- CaptureRequest.CONTROL_AE_MODE_ON_AUTO_FLASH_REDEYE,
- CaptureRequest.CONTROL_AE_MODE_ON_EXTERNAL_FLASH
- )
+ mutableListOf<Int>()
+ .apply {
+ add(CaptureRequest.CONTROL_AE_MODE_OFF)
+ add(CaptureRequest.CONTROL_AE_MODE_ON)
+ add(CaptureRequest.CONTROL_AE_MODE_ON_AUTO_FLASH)
+ add(CaptureRequest.CONTROL_AE_MODE_ON_ALWAYS_FLASH)
+ add(CaptureRequest.CONTROL_AE_MODE_ON_AUTO_FLASH_REDEYE)
+ add(CaptureRequest.CONTROL_AE_MODE_ON_EXTERNAL_FLASH)
+ if (Build.VERSION.SDK_INT >= 35) {
+ add(CONTROL_AE_MODE_ON_LOW_LIGHT_BOOST_BRIGHTNESS_PRIORITY)
+ }
+ }
+ .toIntArray()
)
set(CameraCharacteristics.LENS_FACING, CameraMetadata.LENS_FACING_BACK)
}
@@ -1334,7 +1408,7 @@
}
waitingList.add(resultPair)
}
- assertTrue(resultPair.first.await(timeout, TimeUnit.MILLISECONDS))
+ assertThat(resultPair.first.await(timeout, TimeUnit.MILLISECONDS)).isTrue()
waitingList.remove(resultPair)
}
@@ -1459,13 +1533,16 @@
cameraControl.mZslControl = zslControl
+ // Applies low-light boost setting
+ enableLowLightBoostAndAssert(cameraControl)
+
return cameraControl
}
- private fun Looper.advanceUntilIdle() {
- val shadowLooper = Shadows.shadowOf(this)
- while (!shadowLooper.isIdle) {
- shadowLooper.idle()
+ private fun enableLowLightBoostAndAssert(cameraControlImpl: Camera2CameraControlImpl) {
+ if (isLowLightBoostEnabled) {
+ executorService.run { cameraControlImpl.enableLowLightBoostInternal(true) }
}
+ assertThat(cameraControlImpl.isLowLightBoostOn).isEqualTo(isLowLightBoostEnabled)
}
}
diff --git a/camera/camera-camera2/src/test/java/androidx/camera/camera2/internal/LowLightBoostControlTest.kt b/camera/camera-camera2/src/test/java/androidx/camera/camera2/internal/LowLightBoostControlTest.kt
new file mode 100644
index 0000000..bed297c
--- /dev/null
+++ b/camera/camera-camera2/src/test/java/androidx/camera/camera2/internal/LowLightBoostControlTest.kt
@@ -0,0 +1,294 @@
+/*
+ * Copyright 2024 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT 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.camera.camera2.internal
+
+import android.content.Context
+import android.hardware.camera2.CameraCharacteristics
+import android.hardware.camera2.CameraManager
+import android.hardware.camera2.CameraMetadata
+import android.hardware.camera2.CameraMetadata.CONTROL_AE_MODE_ON_LOW_LIGHT_BOOST_BRIGHTNESS_PRIORITY
+import android.hardware.camera2.CaptureRequest
+import android.hardware.camera2.CaptureResult.CONTROL_LOW_LIGHT_BOOST_STATE
+import android.hardware.camera2.TotalCaptureResult
+import android.os.Looper.getMainLooper
+import androidx.camera.camera2.internal.compat.CameraCharacteristicsCompat
+import androidx.camera.core.CameraControl.OperationCanceledException
+import androidx.camera.core.LowLightBoostState
+import androidx.camera.core.impl.CameraControlInternal
+import androidx.camera.core.impl.utils.executor.CameraXExecutors
+import androidx.test.core.app.ApplicationProvider
+import com.google.common.truth.Truth.assertThat
+import com.google.common.util.concurrent.ListenableFuture
+import java.util.concurrent.ExecutionException
+import java.util.concurrent.Executors
+import java.util.concurrent.TimeUnit
+import kotlinx.coroutines.delay
+import kotlinx.coroutines.runBlocking
+import org.junit.Test
+import org.junit.runner.RunWith
+import org.mockito.Mockito
+import org.mockito.Mockito.mock
+import org.robolectric.RobolectricTestRunner
+import org.robolectric.Shadows.shadowOf
+import org.robolectric.annotation.Config
+import org.robolectric.annotation.internal.DoNotInstrument
+import org.robolectric.shadow.api.Shadow
+import org.robolectric.shadows.ShadowCameraCharacteristics
+import org.robolectric.shadows.ShadowCameraManager
+import org.robolectric.shadows.ShadowLog
+
+private const val CAMERA_ID_0 = "0"
+
+@RunWith(RobolectricTestRunner::class)
+@DoNotInstrument
+@Config(
+ minSdk = 35,
+)
+class LowLightBoostControlTest {
+
+ private val context = ApplicationProvider.getApplicationContext() as Context
+
+ @Test
+ fun enableLowLightBoostThrowException_stateActive_whenIsSupported() {
+ ShadowLog.stream = System.out
+ initCamera(supportedLlb = true)
+ createLowLightBoostControl().apply {
+ setActive(true)
+ val future = enableLowLightBoost(true)
+
+ // Issue CONTROL_AE_MODE_ON_LOW_LIGHT_BOOST_BRIGHTNESS_PRIORITY AE mode capture result
+ // to check whether the future can be completed or not.
+ issueControlAeModeCaptureResult(mCaptureResultListener)
+ shadowOf(getMainLooper()).idle()
+
+ future.get(1, TimeUnit.SECONDS)
+ }
+ }
+
+ @Test
+ fun enableLowLightBoost_stateInactive_whenIsSupported() {
+ initCamera(supportedLlb = true)
+ createLowLightBoostControl().apply {
+ setActive(false)
+ val future = enableLowLightBoost(true)
+ shadowOf(getMainLooper()).idle()
+ assertFutureCompleteWithException(future, OperationCanceledException::class.java)
+ }
+ }
+
+ @Test
+ fun enableLowLightBoostThrowException_stateActive_whenIsNotSupported() {
+ initCamera(supportedLlb = false)
+ createLowLightBoostControl().apply {
+ setActive(true)
+ val future = enableLowLightBoost(true)
+ assertFutureCompleteWithException(future, IllegalStateException::class.java)
+ }
+ }
+
+ @Test
+ fun getLowLightBoostState_stateActive_whenIsNotSupported() {
+ initCamera(supportedLlb = false)
+ createLowLightBoostControl().apply {
+ setActive(true)
+ enableLowLightBoost(true)
+ shadowOf(getMainLooper()).idle()
+ assertThat(lowLightBoostState.value).isEqualTo(LowLightBoostState.OFF)
+ }
+ }
+
+ @Test
+ fun getLowLightBoostState_stateActive_whenIsSupported() {
+ initCamera(supportedLlb = true)
+ createLowLightBoostControl().apply {
+ setActive(true)
+ // State is OFF before low-light boost is enabled
+ assertThat(lowLightBoostState.value).isEqualTo(LowLightBoostState.OFF)
+
+ enableLowLightBoost(true)
+ shadowOf(getMainLooper()).idle()
+ // State is INACTIVE after low-light boost is enabled but no ACTIVE state is received
+ assertThat(lowLightBoostState.value).isEqualTo(LowLightBoostState.INACTIVE)
+
+ issueControlAeModeCaptureResult(
+ mCaptureResultListener,
+ llbState = LowLightBoostState.ACTIVE
+ )
+ // When low-light boost state is updated, postValue method is invoked. In robolectric
+ // test, it is hard to know when will the task is added to the main thread. Adding
+ // delay 100ms here to make sure that the value update task has been posted to the main
+ // thread.
+ runBlocking { delay(100) }
+ shadowOf(getMainLooper()).idle()
+ // State is ACTIVE after ACTIVE state is received
+ assertThat(lowLightBoostState.value).isEqualTo(LowLightBoostState.ACTIVE)
+
+ issueControlAeModeCaptureResult(
+ mCaptureResultListener,
+ llbState = LowLightBoostState.INACTIVE
+ )
+ runBlocking { delay(100) }
+ shadowOf(getMainLooper()).idle()
+ // State is INACTIVE after INACTIVE state is received again
+ assertThat(lowLightBoostState.value).isEqualTo(LowLightBoostState.INACTIVE)
+ }
+ }
+
+ @Test
+ fun getLowLightBoostState_stateInactive_whenIsSupported() {
+ initCamera(supportedLlb = true)
+ createLowLightBoostControl().apply {
+ setActive(false)
+ assertThat(lowLightBoostState.value).isEqualTo(LowLightBoostState.OFF)
+ }
+ }
+
+ @Test
+ fun enableTorchTwice_cancelPreviousFuture() {
+ initCamera(supportedLlb = true)
+ createLowLightBoostControl().apply {
+ setActive(true)
+ val future1 = enableLowLightBoost(true)
+ val future2 = enableLowLightBoost(true)
+ shadowOf(getMainLooper()).idle()
+
+ // Verifies that the first future has been canceled.
+ assertFutureCompleteWithException(future1, OperationCanceledException::class.java)
+
+ // Verifies that the second future can be completed after issue the AE mode capture
+ // result
+ issueControlAeModeCaptureResult(mCaptureResultListener)
+ shadowOf(getMainLooper()).idle()
+ future2.get(1, TimeUnit.SECONDS)
+ }
+ }
+
+ @Test
+ fun setInActive_cancelPreviousFuture() {
+ initCamera(supportedLlb = true)
+ createLowLightBoostControl().apply {
+ setActive(true)
+ val future = enableLowLightBoost(true)
+ shadowOf(getMainLooper()).idle()
+
+ setActive(false)
+ assertFutureCompleteWithException(future, OperationCanceledException::class.java)
+ }
+ }
+
+ @Test
+ fun setInActive_changeToStateOff() {
+ initCamera(supportedLlb = true)
+ createLowLightBoostControl().apply {
+ setActive(true)
+ enableLowLightBoost(true)
+ assertThat(lowLightBoostState.value).isEqualTo(LowLightBoostState.INACTIVE)
+
+ setActive(false)
+ shadowOf(getMainLooper()).idle()
+ assertThat(lowLightBoostState.value).isEqualTo(LowLightBoostState.OFF)
+ }
+ }
+
+ private fun assertFutureCompleteWithException(future: ListenableFuture<Void>, clazz: Class<*>) {
+ assertThat(future.isDone).isTrue()
+ try {
+ future.get()
+ } catch (exception: ExecutionException) {
+ assertThat(exception.cause).isInstanceOf(clazz)
+ }
+ }
+
+ private fun createLowLightBoostControl(): LowLightBoostControl {
+ val cameraManager = context.getSystemService(Context.CAMERA_SERVICE) as CameraManager
+ val cameraCharacteristics = cameraManager.getCameraCharacteristics(CAMERA_ID_0)
+ val characteristicsCompat =
+ CameraCharacteristicsCompat.toCameraCharacteristicsCompat(
+ cameraCharacteristics,
+ CAMERA_ID_0
+ )
+
+ val cameraControlImpl =
+ Camera2CameraControlImpl(
+ characteristicsCompat,
+ CameraXExecutors.mainThreadExecutor(),
+ CameraXExecutors.mainThreadExecutor(),
+ mock(CameraControlInternal.ControlUpdateCallback::class.java)
+ )
+
+ return LowLightBoostControl(
+ cameraControlImpl,
+ characteristicsCompat,
+ CameraXExecutors.mainThreadExecutor()
+ )
+ }
+
+ private fun issueControlAeModeCaptureResult(
+ captureResultListener: Camera2CameraControlImpl.CaptureResultListener,
+ resultAeMode: Int = CONTROL_AE_MODE_ON_LOW_LIGHT_BOOST_BRIGHTNESS_PRIORITY,
+ llbState: Int? = null
+ ) {
+ Executors.newSingleThreadScheduledExecutor()
+ .schedule(
+ {
+ val captureRequest = mock(CaptureRequest::class.java)
+ Mockito.`when`(captureRequest.get(CaptureRequest.CONTROL_AE_MODE))
+ .thenReturn(resultAeMode)
+
+ val totalCaptureResult = mock(TotalCaptureResult::class.java)
+ Mockito.`when`(totalCaptureResult.request).thenReturn(captureRequest)
+
+ llbState?.let {
+ Mockito.`when`(totalCaptureResult.get(CONTROL_LOW_LIGHT_BOOST_STATE))
+ .thenReturn(llbState)
+ }
+ captureResultListener.onCaptureResult(totalCaptureResult)
+ },
+ 20,
+ TimeUnit.MILLISECONDS
+ )
+ }
+
+ private fun initCamera(supportedLlb: Boolean) {
+ val cameraCharacteristics =
+ ShadowCameraCharacteristics.newCameraCharacteristics().also {
+ Shadow.extract<ShadowCameraCharacteristics>(it).apply {
+ set(
+ CameraCharacteristics.CONTROL_AE_AVAILABLE_MODES,
+ mutableListOf<Int>()
+ .apply {
+ add(CaptureRequest.CONTROL_AE_MODE_OFF)
+ add(CaptureRequest.CONTROL_AE_MODE_ON)
+ add(CaptureRequest.CONTROL_AE_MODE_ON_AUTO_FLASH)
+ add(CaptureRequest.CONTROL_AE_MODE_ON_ALWAYS_FLASH)
+ add(CaptureRequest.CONTROL_AE_MODE_ON_AUTO_FLASH_REDEYE)
+ add(CaptureRequest.CONTROL_AE_MODE_ON_EXTERNAL_FLASH)
+
+ if (supportedLlb) {
+ add(CONTROL_AE_MODE_ON_LOW_LIGHT_BOOST_BRIGHTNESS_PRIORITY)
+ }
+ }
+ .toIntArray()
+ )
+ set(CameraCharacteristics.LENS_FACING, CameraMetadata.LENS_FACING_BACK)
+ }
+ }
+
+ Shadow.extract<ShadowCameraManager>(context.getSystemService(Context.CAMERA_SERVICE))
+ .apply { addCamera(CAMERA_ID_0, cameraCharacteristics) }
+ }
+}
diff --git a/camera/camera-camera2/src/test/java/androidx/camera/camera2/internal/SupportedSurfaceCombinationTest.kt b/camera/camera-camera2/src/test/java/androidx/camera/camera2/internal/SupportedSurfaceCombinationTest.kt
index cf9f36b..7f11ecb 100644
--- a/camera/camera-camera2/src/test/java/androidx/camera/camera2/internal/SupportedSurfaceCombinationTest.kt
+++ b/camera/camera-camera2/src/test/java/androidx/camera/camera2/internal/SupportedSurfaceCombinationTest.kt
@@ -123,7 +123,6 @@
private val RECORD_SIZE = Size(3840, 2160)
private val MAXIMUM_SIZE = Size(4032, 3024)
private val LEGACY_VIDEO_MAXIMUM_SIZE = Size(1920, 1080)
-private val VIDEO_MAXIMUM_SIZE = Size(3840, 2160)
private val DEFAULT_SUPPORTED_SIZES =
arrayOf(
Size(4032, 3024), // 4:3
@@ -310,9 +309,7 @@
@Test
fun checkLimitedSurfaceCombinationSupportedInLimitedDevice() {
- setupCameraAndInitCameraX(
- hardwareLevel = CameraCharacteristics.INFO_SUPPORTED_HARDWARE_LEVEL_LIMITED
- )
+ setupCameraAndInitCameraX(hardwareLevel = INFO_SUPPORTED_HARDWARE_LEVEL_LIMITED)
val supportedSurfaceCombination =
SupportedSurfaceCombination(
context,
@@ -333,9 +330,7 @@
@Test
fun checkFullSurfaceCombinationNotSupportedInLimitedDevice() {
- setupCameraAndInitCameraX(
- hardwareLevel = CameraCharacteristics.INFO_SUPPORTED_HARDWARE_LEVEL_LIMITED
- )
+ setupCameraAndInitCameraX(hardwareLevel = INFO_SUPPORTED_HARDWARE_LEVEL_LIMITED)
val supportedSurfaceCombination =
SupportedSurfaceCombination(
context,
@@ -356,9 +351,7 @@
@Test
fun checkLevel3SurfaceCombinationNotSupportedInLimitedDevice() {
- setupCameraAndInitCameraX(
- hardwareLevel = CameraCharacteristics.INFO_SUPPORTED_HARDWARE_LEVEL_LIMITED
- )
+ setupCameraAndInitCameraX(hardwareLevel = INFO_SUPPORTED_HARDWARE_LEVEL_LIMITED)
val supportedSurfaceCombination =
SupportedSurfaceCombination(
context,
@@ -1154,7 +1147,7 @@
}
getSuggestedSpecsAndVerify(
useCaseExpectedResultMap,
- hardwareLevel = CameraCharacteristics.INFO_SUPPORTED_HARDWARE_LEVEL_LIMITED
+ hardwareLevel = INFO_SUPPORTED_HARDWARE_LEVEL_LIMITED
)
}
@@ -1170,7 +1163,7 @@
}
getSuggestedSpecsAndVerify(
useCaseExpectedResultMap,
- hardwareLevel = CameraCharacteristics.INFO_SUPPORTED_HARDWARE_LEVEL_LIMITED
+ hardwareLevel = INFO_SUPPORTED_HARDWARE_LEVEL_LIMITED
)
}
@@ -1186,7 +1179,7 @@
}
getSuggestedSpecsAndVerify(
useCaseExpectedResultMap,
- hardwareLevel = CameraCharacteristics.INFO_SUPPORTED_HARDWARE_LEVEL_LIMITED
+ hardwareLevel = INFO_SUPPORTED_HARDWARE_LEVEL_LIMITED
)
}
@@ -1204,7 +1197,7 @@
}
getSuggestedSpecsAndVerify(
useCaseExpectedResultMap,
- hardwareLevel = CameraCharacteristics.INFO_SUPPORTED_HARDWARE_LEVEL_LIMITED
+ hardwareLevel = INFO_SUPPORTED_HARDWARE_LEVEL_LIMITED
)
}
@@ -1222,7 +1215,7 @@
}
getSuggestedSpecsAndVerify(
useCaseExpectedResultMap,
- hardwareLevel = CameraCharacteristics.INFO_SUPPORTED_HARDWARE_LEVEL_LIMITED
+ hardwareLevel = INFO_SUPPORTED_HARDWARE_LEVEL_LIMITED
)
}
@@ -1240,7 +1233,7 @@
}
getSuggestedSpecsAndVerify(
useCaseExpectedResultMap,
- hardwareLevel = CameraCharacteristics.INFO_SUPPORTED_HARDWARE_LEVEL_LIMITED
+ hardwareLevel = INFO_SUPPORTED_HARDWARE_LEVEL_LIMITED
)
}
@@ -1259,7 +1252,7 @@
assertThrows(IllegalArgumentException::class.java) {
getSuggestedSpecsAndVerify(
useCaseExpectedResultMap,
- hardwareLevel = CameraCharacteristics.INFO_SUPPORTED_HARDWARE_LEVEL_LIMITED
+ hardwareLevel = INFO_SUPPORTED_HARDWARE_LEVEL_LIMITED
)
}
}
@@ -1389,7 +1382,7 @@
assertThrows(IllegalArgumentException::class.java) {
getSuggestedSpecsAndVerify(
useCaseExpectedResultMap,
- hardwareLevel = CameraCharacteristics.INFO_SUPPORTED_HARDWARE_LEVEL_LIMITED
+ hardwareLevel = INFO_SUPPORTED_HARDWARE_LEVEL_LIMITED
)
}
}
@@ -1482,7 +1475,7 @@
}
getSuggestedSpecsAndVerify(
useCaseExpectedResultMap,
- hardwareLevel = CameraCharacteristics.INFO_SUPPORTED_HARDWARE_LEVEL_LIMITED,
+ hardwareLevel = INFO_SUPPORTED_HARDWARE_LEVEL_LIMITED,
capabilities =
intArrayOf(CameraCharacteristics.REQUEST_AVAILABLE_CAPABILITIES_BURST_CAPTURE)
)
@@ -1500,7 +1493,7 @@
}
getSuggestedSpecsAndVerify(
useCaseExpectedResultMap,
- hardwareLevel = CameraCharacteristics.INFO_SUPPORTED_HARDWARE_LEVEL_LIMITED,
+ hardwareLevel = INFO_SUPPORTED_HARDWARE_LEVEL_LIMITED,
capabilities =
intArrayOf(CameraCharacteristics.REQUEST_AVAILABLE_CAPABILITIES_BURST_CAPTURE)
)
@@ -1518,7 +1511,7 @@
}
getSuggestedSpecsAndVerify(
useCaseExpectedResultMap,
- hardwareLevel = CameraCharacteristics.INFO_SUPPORTED_HARDWARE_LEVEL_LIMITED,
+ hardwareLevel = INFO_SUPPORTED_HARDWARE_LEVEL_LIMITED,
capabilities =
intArrayOf(CameraCharacteristics.REQUEST_AVAILABLE_CAPABILITIES_BURST_CAPTURE)
)
@@ -1538,7 +1531,7 @@
mutableMapOf<UseCase, Size>().apply { put(rawUseCase, MAXIMUM_SIZE) }
getSuggestedSpecsAndVerify(
useCaseExpectedResultMap,
- hardwareLevel = CameraCharacteristics.INFO_SUPPORTED_HARDWARE_LEVEL_LIMITED,
+ hardwareLevel = INFO_SUPPORTED_HARDWARE_LEVEL_LIMITED,
capabilities = intArrayOf(CameraCharacteristics.REQUEST_AVAILABLE_CAPABILITIES_RAW)
)
}
@@ -1555,7 +1548,7 @@
}
getSuggestedSpecsAndVerify(
useCaseExpectedResultMap,
- hardwareLevel = CameraCharacteristics.INFO_SUPPORTED_HARDWARE_LEVEL_LIMITED,
+ hardwareLevel = INFO_SUPPORTED_HARDWARE_LEVEL_LIMITED,
capabilities = intArrayOf(CameraCharacteristics.REQUEST_AVAILABLE_CAPABILITIES_RAW)
)
}
@@ -1574,7 +1567,7 @@
}
getSuggestedSpecsAndVerify(
useCaseExpectedResultMap,
- hardwareLevel = CameraCharacteristics.INFO_SUPPORTED_HARDWARE_LEVEL_LIMITED,
+ hardwareLevel = INFO_SUPPORTED_HARDWARE_LEVEL_LIMITED,
capabilities = intArrayOf(CameraCharacteristics.REQUEST_AVAILABLE_CAPABILITIES_RAW)
)
}
@@ -1593,7 +1586,7 @@
}
getSuggestedSpecsAndVerify(
useCaseExpectedResultMap,
- hardwareLevel = CameraCharacteristics.INFO_SUPPORTED_HARDWARE_LEVEL_LIMITED,
+ hardwareLevel = INFO_SUPPORTED_HARDWARE_LEVEL_LIMITED,
capabilities = intArrayOf(CameraCharacteristics.REQUEST_AVAILABLE_CAPABILITIES_RAW)
)
}
@@ -1612,7 +1605,7 @@
}
getSuggestedSpecsAndVerify(
useCaseExpectedResultMap,
- hardwareLevel = CameraCharacteristics.INFO_SUPPORTED_HARDWARE_LEVEL_LIMITED,
+ hardwareLevel = INFO_SUPPORTED_HARDWARE_LEVEL_LIMITED,
capabilities = intArrayOf(CameraCharacteristics.REQUEST_AVAILABLE_CAPABILITIES_RAW)
)
}
@@ -1631,7 +1624,7 @@
}
getSuggestedSpecsAndVerify(
useCaseExpectedResultMap,
- hardwareLevel = CameraCharacteristics.INFO_SUPPORTED_HARDWARE_LEVEL_LIMITED,
+ hardwareLevel = INFO_SUPPORTED_HARDWARE_LEVEL_LIMITED,
capabilities = intArrayOf(CameraCharacteristics.REQUEST_AVAILABLE_CAPABILITIES_RAW)
)
}
@@ -1650,7 +1643,7 @@
}
getSuggestedSpecsAndVerify(
useCaseExpectedResultMap,
- hardwareLevel = CameraCharacteristics.INFO_SUPPORTED_HARDWARE_LEVEL_LIMITED,
+ hardwareLevel = INFO_SUPPORTED_HARDWARE_LEVEL_LIMITED,
capabilities = intArrayOf(CameraCharacteristics.REQUEST_AVAILABLE_CAPABILITIES_RAW)
)
}
@@ -2047,7 +2040,7 @@
assertThrows(IllegalArgumentException::class.java) {
getSuggestedSpecsAndVerify(
useCaseExpectedSizeMap,
- cameraMode = CameraMode.ULTRA_HIGH_RESOLUTION_CAMERA,
+ cameraMode = ULTRA_HIGH_RESOLUTION_CAMERA,
dynamicRangeProfiles = HLG10_CONSTRAINED
)
}
@@ -2604,7 +2597,7 @@
mutableMapOf<UseCase, Size>().apply { put(useCase, Size(3840, 2160)) }
getSuggestedSpecsAndVerify(
useCaseExpectedResultMap,
- hardwareLevel = CameraCharacteristics.INFO_SUPPORTED_HARDWARE_LEVEL_LIMITED
+ hardwareLevel = INFO_SUPPORTED_HARDWARE_LEVEL_LIMITED
)
}
@@ -2616,7 +2609,7 @@
mutableMapOf<UseCase, Size>().apply { put(useCase, Size(800, 450)) }
getSuggestedSpecsAndVerify(
useCaseExpectedResultMap,
- hardwareLevel = CameraCharacteristics.INFO_SUPPORTED_HARDWARE_LEVEL_LIMITED
+ hardwareLevel = INFO_SUPPORTED_HARDWARE_LEVEL_LIMITED
)
}
@@ -2651,7 +2644,7 @@
}
getSuggestedSpecsAndVerify(
useCaseExpectedResultMap,
- hardwareLevel = CameraCharacteristics.INFO_SUPPORTED_HARDWARE_LEVEL_LIMITED,
+ hardwareLevel = INFO_SUPPORTED_HARDWARE_LEVEL_LIMITED,
compareWithAtMost = true
)
}
@@ -2670,7 +2663,7 @@
}
getSuggestedSpecsAndVerify(
useCaseExpectedResultMap,
- hardwareLevel = CameraCharacteristics.INFO_SUPPORTED_HARDWARE_LEVEL_LIMITED,
+ hardwareLevel = INFO_SUPPORTED_HARDWARE_LEVEL_LIMITED,
compareWithAtMost = true
)
}
@@ -2688,7 +2681,7 @@
}
getSuggestedSpecsAndVerify(
useCaseExpectedResultMap,
- hardwareLevel = CameraCharacteristics.INFO_SUPPORTED_HARDWARE_LEVEL_LIMITED,
+ hardwareLevel = INFO_SUPPORTED_HARDWARE_LEVEL_LIMITED,
compareWithAtMost = true
)
}
@@ -2706,7 +2699,7 @@
}
getSuggestedSpecsAndVerify(
useCaseExpectedResultMap,
- hardwareLevel = CameraCharacteristics.INFO_SUPPORTED_HARDWARE_LEVEL_LIMITED,
+ hardwareLevel = INFO_SUPPORTED_HARDWARE_LEVEL_LIMITED,
compareWithAtMost = true
)
}
@@ -2734,7 +2727,7 @@
getSuggestedSpecsAndVerify(
useCaseExpectedResultMap,
attachedSurfaceInfoList = listOf(attachedSurfaceInfo),
- hardwareLevel = CameraCharacteristics.INFO_SUPPORTED_HARDWARE_LEVEL_LIMITED,
+ hardwareLevel = INFO_SUPPORTED_HARDWARE_LEVEL_LIMITED,
compareWithAtMost = true
)
}
@@ -2762,7 +2755,7 @@
getSuggestedSpecsAndVerify(
useCaseExpectedResultMap,
attachedSurfaceInfoList = listOf(attachedSurfaceInfo),
- hardwareLevel = CameraCharacteristics.INFO_SUPPORTED_HARDWARE_LEVEL_LIMITED,
+ hardwareLevel = INFO_SUPPORTED_HARDWARE_LEVEL_LIMITED,
compareWithAtMost = true
)
}
@@ -2790,7 +2783,7 @@
getSuggestedSpecsAndVerify(
useCaseExpectedResultMap,
attachedSurfaceInfoList = listOf(attachedSurfaceInfo),
- hardwareLevel = CameraCharacteristics.INFO_SUPPORTED_HARDWARE_LEVEL_LIMITED,
+ hardwareLevel = INFO_SUPPORTED_HARDWARE_LEVEL_LIMITED,
compareWithAtMost = true
)
}
@@ -3082,7 +3075,7 @@
}
getSuggestedSpecsAndVerify(
useCaseExpectedResultMap,
- hardwareLevel = CameraCharacteristics.INFO_SUPPORTED_HARDWARE_LEVEL_LIMITED
+ hardwareLevel = INFO_SUPPORTED_HARDWARE_LEVEL_LIMITED
)
}
@@ -3242,7 +3235,7 @@
val resultPair =
getSuggestedSpecsAndVerify(
useCaseExpectedResultMap,
- cameraMode = CameraMode.ULTRA_HIGH_RESOLUTION_CAMERA,
+ cameraMode = ULTRA_HIGH_RESOLUTION_CAMERA,
)
assertThat(resultPair.first.size).isEqualTo(2)
assertThat(
@@ -3641,7 +3634,7 @@
Mockito.mock(StreamConfigurationMap::class.java).also { map ->
supportedSizes?.let {
// Sets up the supported sizes
- Mockito.`when`(map.getOutputSizes(ArgumentMatchers.anyInt())).thenReturn(it)
+ Mockito.`when`(map.getOutputSizes(anyInt())).thenReturn(it)
// ImageFormat.PRIVATE was supported since API level 23. Before that, the
// supported
// output sizes need to be retrieved via SurfaceTexture.class.
@@ -3657,7 +3650,7 @@
// minimum frame durations were designated only for the purpose of testing
Mockito.`when`(
map.getOutputMinFrameDuration(
- ArgumentMatchers.anyInt(),
+ anyInt(),
ArgumentMatchers.eq(Size(4032, 3024))
)
)
@@ -3665,7 +3658,7 @@
Mockito.`when`(
map.getOutputMinFrameDuration(
- ArgumentMatchers.anyInt(),
+ anyInt(),
ArgumentMatchers.eq(Size(3840, 2160))
)
)
@@ -3673,7 +3666,7 @@
Mockito.`when`(
map.getOutputMinFrameDuration(
- ArgumentMatchers.anyInt(),
+ anyInt(),
ArgumentMatchers.eq(Size(1920, 1440))
)
)
@@ -3681,7 +3674,7 @@
Mockito.`when`(
map.getOutputMinFrameDuration(
- ArgumentMatchers.anyInt(),
+ anyInt(),
ArgumentMatchers.eq(Size(1920, 1080))
)
)
@@ -3689,7 +3682,7 @@
Mockito.`when`(
map.getOutputMinFrameDuration(
- ArgumentMatchers.anyInt(),
+ anyInt(),
ArgumentMatchers.eq(Size(1280, 960))
)
)
@@ -3697,39 +3690,30 @@
Mockito.`when`(
map.getOutputMinFrameDuration(
- ArgumentMatchers.anyInt(),
+ anyInt(),
ArgumentMatchers.eq(Size(1280, 720))
)
)
.thenReturn(22222222L) // 45, size preview/display
Mockito.`when`(
- map.getOutputMinFrameDuration(
- ArgumentMatchers.anyInt(),
- ArgumentMatchers.eq(Size(960, 544))
- )
+ map.getOutputMinFrameDuration(anyInt(), ArgumentMatchers.eq(Size(960, 544)))
)
.thenReturn(20000000L) // 50
Mockito.`when`(
- map.getOutputMinFrameDuration(
- ArgumentMatchers.anyInt(),
- ArgumentMatchers.eq(Size(800, 450))
- )
+ map.getOutputMinFrameDuration(anyInt(), ArgumentMatchers.eq(Size(800, 450)))
)
.thenReturn(16666666L) // 60fps
Mockito.`when`(
- map.getOutputMinFrameDuration(
- ArgumentMatchers.anyInt(),
- ArgumentMatchers.eq(Size(640, 480))
- )
+ map.getOutputMinFrameDuration(anyInt(), ArgumentMatchers.eq(Size(640, 480)))
)
.thenReturn(16666666L) // 60fps
// Sets up the supported high resolution sizes
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
- Mockito.`when`(map.getHighResolutionOutputSizes(ArgumentMatchers.anyInt()))
+ Mockito.`when`(map.getHighResolutionOutputSizes(anyInt()))
.thenReturn(supportedHighResolutionSizes)
}
@@ -3773,11 +3757,11 @@
maximumResolutionHighResolutionSupportedSizes != null)
) {
Mockito.mock(StreamConfigurationMap::class.java).also {
- Mockito.`when`(it.getOutputSizes(ArgumentMatchers.anyInt()))
+ Mockito.`when`(it.getOutputSizes(anyInt()))
.thenReturn(maximumResolutionSupportedSizes)
Mockito.`when`(it.getOutputSizes(SurfaceTexture::class.java))
.thenReturn(maximumResolutionSupportedSizes)
- Mockito.`when`(it.getHighResolutionOutputSizes(ArgumentMatchers.anyInt()))
+ Mockito.`when`(it.getHighResolutionOutputSizes(anyInt()))
.thenReturn(maximumResolutionHighResolutionSupportedSizes)
}
} else {
@@ -3839,21 +3823,19 @@
set(CameraCharacteristics.SCALER_AVAILABLE_STREAM_USE_CASES, uc)
}
- val vs: IntArray
- if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) {
- vs =
+ val vs: IntArray =
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) {
intArrayOf(
CameraCharacteristics.CONTROL_VIDEO_STABILIZATION_MODE_OFF,
CameraCharacteristics.CONTROL_VIDEO_STABILIZATION_MODE_ON,
CameraCharacteristics.CONTROL_VIDEO_STABILIZATION_MODE_PREVIEW_STABILIZATION
)
- } else {
- vs =
+ } else {
intArrayOf(
CameraCharacteristics.CONTROL_VIDEO_STABILIZATION_MODE_OFF,
CameraCharacteristics.CONTROL_VIDEO_STABILIZATION_MODE_ON
)
- }
+ }
set(CameraCharacteristics.CONTROL_AVAILABLE_VIDEO_STABILIZATION_MODES, vs)
capabilities?.let { set(CameraCharacteristics.REQUEST_AVAILABLE_CAPABILITIES, it) }
@@ -3889,9 +3871,9 @@
val cameraX: CameraX =
try {
CameraXUtil.getOrCreateInstance(context) { cameraXConfig }.get()
- } catch (e: ExecutionException) {
+ } catch (_: ExecutionException) {
throw IllegalStateException("Unable to initialize CameraX for test.")
- } catch (e: InterruptedException) {
+ } catch (_: InterruptedException) {
throw IllegalStateException("Unable to initialize CameraX for test.")
}
useCaseConfigFactory = cameraX.defaultConfigFactory
diff --git a/camera/camera-camera2/src/test/java/androidx/camera/camera2/internal/TorchControlTest.java b/camera/camera-camera2/src/test/java/androidx/camera/camera2/internal/TorchControlTest.java
index 4937e7b..d725f7f 100644
--- a/camera/camera-camera2/src/test/java/androidx/camera/camera2/internal/TorchControlTest.java
+++ b/camera/camera-camera2/src/test/java/androidx/camera/camera2/internal/TorchControlTest.java
@@ -16,6 +16,7 @@
package androidx.camera.camera2.internal;
+import static android.hardware.camera2.CameraMetadata.CONTROL_AE_MODE_ON_LOW_LIGHT_BOOST_BRIGHTNESS_PRIORITY;
import static android.os.Looper.getMainLooper;
import static com.google.common.truth.Truth.assertThat;
@@ -29,6 +30,7 @@
import static org.mockito.internal.verification.VerificationModeFactory.times;
import static org.robolectric.Shadows.shadowOf;
+import android.annotation.SuppressLint;
import android.content.Context;
import android.hardware.camera2.CameraAccessException;
import android.hardware.camera2.CameraCharacteristics;
@@ -75,6 +77,8 @@
private TorchControl mNoFlashUnitTorchControl;
private TorchControl mTorchControl;
+ private CameraCharacteristicsCompat mLlbEnabledCameraCharacteristicsCompat;
+ private Camera2CameraControlImpl mLlbEnabledCamera2CameraControl;
private Camera2CameraControlImpl.CaptureResultListener mCaptureResultListener;
private TestLifecycleOwner mLifecycleOwner;
@@ -104,22 +108,25 @@
/* Prepare CameraControl 1 which flash is available */
CameraCharacteristics cameraCharacteristics1 =
cameraManager.getCameraCharacteristics(CAMERA1_ID);
- CameraCharacteristicsCompat characteristicsCompat1 =
+ mLlbEnabledCameraCharacteristicsCompat =
CameraCharacteristicsCompat.toCameraCharacteristicsCompat(cameraCharacteristics1,
CAMERA1_ID);
- Camera2CameraControlImpl camera2CameraControlImpl1 =
- spy(new Camera2CameraControlImpl(characteristicsCompat1,
- CameraXExecutors.mainThreadExecutor(),
- CameraXExecutors.mainThreadExecutor(),
- mock(CameraControlInternal.ControlUpdateCallback.class)));
- mTorchControl = new TorchControl(camera2CameraControlImpl1, characteristicsCompat1,
+ mLlbEnabledCamera2CameraControl = new Camera2CameraControlImpl(
+ mLlbEnabledCameraCharacteristicsCompat,
+ CameraXExecutors.mainThreadExecutor(),
+ CameraXExecutors.mainThreadExecutor(),
+ mock(CameraControlInternal.ControlUpdateCallback.class));
+ Camera2CameraControlImpl camera2CameraControl1 = spy(mLlbEnabledCamera2CameraControl);
+ mTorchControl = new TorchControl(camera2CameraControl1,
+ mLlbEnabledCameraCharacteristicsCompat,
CameraXExecutors.mainThreadExecutor());
mTorchControl.setActive(true);
ArgumentCaptor<Camera2CameraControlImpl.CaptureResultListener> argumentCaptor =
ArgumentCaptor.forClass(Camera2CameraControlImpl.CaptureResultListener.class);
- verify(camera2CameraControlImpl1).addCaptureResultListener(argumentCaptor.capture());
+ verify(camera2CameraControl1).addCaptureResultListener(
+ argumentCaptor.capture());
mCaptureResultListener = argumentCaptor.getValue();
/* Prepare Lifecycle for test LiveData */
@@ -305,6 +312,60 @@
assertThat(torchStates.get(2)).isEqualTo(TorchState.OFF); // by enableTorch(false)
}
+ @Config(minSdk = 35)
+ @Test
+ public void enableTorchIsCanceled_whenLowLightBoostIsOn() {
+ // Activates the Camera2CameraControlImpl and ensures low-light boost is turned on
+ mLlbEnabledCamera2CameraControl.incrementUseCount();
+ mLlbEnabledCamera2CameraControl.setActive(true);
+
+ TorchControl torchControl = mLlbEnabledCamera2CameraControl.getTorchControl();
+
+ mLlbEnabledCamera2CameraControl.enableLowLightBoostAsync(true);
+ shadowOf(getMainLooper()).idle();
+ assertThat(mLlbEnabledCamera2CameraControl.isLowLightBoostOn()).isTrue();
+
+ // Verifies that enabling torch operation will run failed with IllegalStateException cause
+ ListenableFuture<Void> future = torchControl.enableTorch(true);
+ shadowOf(getMainLooper()).idle();
+ Throwable cause = null;
+ try {
+ future.get();
+ } catch (ExecutionException | InterruptedException e) {
+ // The real cause is wrapped in ExecutionException, retrieve it and check.
+ cause = e.getCause();
+ }
+
+ assertThat(cause).isInstanceOf(IllegalStateException.class);
+ }
+
+ @SuppressLint("BanThreadSleep")
+ @Config(minSdk = 35)
+ @Test
+ public void torchIsDisabled_whenLowLightBoostIsTurnedOn() {
+ // Activates the Camera2CameraControlImpl
+ mLlbEnabledCamera2CameraControl.incrementUseCount();
+ mLlbEnabledCamera2CameraControl.setActive(true);
+
+ TorchControl torchControl = mLlbEnabledCamera2CameraControl.getTorchControl();
+ assertThat(torchControl.getTorchState().getValue()).isEqualTo(TorchState.OFF);
+
+ // Turns on torch
+ torchControl.enableTorch(true);
+ shadowOf(getMainLooper()).idle();
+ assertThat(mLlbEnabledCamera2CameraControl.isTorchOn()).isTrue();
+ assertThat(torchControl.getTorchState().getValue()).isEqualTo(TorchState.ON);
+
+ // Turns on low-light boost
+ mLlbEnabledCamera2CameraControl.enableLowLightBoostAsync(true);
+ shadowOf(getMainLooper()).idle();
+
+ // Verifies that enabling torch operation will run failed with IllegalStateException cause
+ assertThat(mLlbEnabledCamera2CameraControl.isLowLightBoostOn()).isTrue();
+ assertThat(mLlbEnabledCamera2CameraControl.isTorchOn()).isFalse();
+ assertThat(torchControl.getTorchState().getValue()).isEqualTo(TorchState.OFF);
+ }
+
private void initShadowCameraManager() {
// **** Camera 0 characteristics ****//
CameraCharacteristics characteristics0 =
@@ -326,6 +387,11 @@
ShadowCameraCharacteristics shadowCharacteristics1 = Shadow.extract(characteristics1);
shadowCharacteristics1.set(CameraCharacteristics.FLASH_INFO_AVAILABLE, true);
+ if (Build.VERSION.SDK_INT >= 35) {
+ // Adds low-light boost capability for related tests
+ shadowCharacteristics1.set(CameraCharacteristics.CONTROL_AE_AVAILABLE_MODES,
+ new int[]{CONTROL_AE_MODE_ON_LOW_LIGHT_BOOST_BRIGHTNESS_PRIORITY});
+ }
((ShadowCameraManager)
Shadow.extract(
diff --git a/camera/camera-core/build.gradle b/camera/camera-core/build.gradle
index 191b670..b00dd05 100644
--- a/camera/camera-core/build.gradle
+++ b/camera/camera-core/build.gradle
@@ -85,6 +85,8 @@
}
android {
+ compileSdk 35
+
defaultConfig {
externalNativeBuild {
def versionScript = file("src/main/cpp/jni.lds").getAbsolutePath()
diff --git a/camera/camera-core/src/main/java/androidx/camera/core/CameraControl.java b/camera/camera-core/src/main/java/androidx/camera/core/CameraControl.java
index beff098..9dbfa50 100644
--- a/camera/camera-core/src/main/java/androidx/camera/core/CameraControl.java
+++ b/camera/camera-core/src/main/java/androidx/camera/core/CameraControl.java
@@ -18,6 +18,7 @@
import androidx.annotation.FloatRange;
import androidx.annotation.RestrictTo;
+import androidx.camera.core.impl.utils.futures.Futures;
import com.google.common.util.concurrent.ListenableFuture;
@@ -63,6 +64,53 @@
@NonNull ListenableFuture<Void> enableTorch(boolean torch);
/**
+ * Enables low-light boost mode.
+ *
+ * <p>Devices running Android 15 or higher can provide support for low-light boost. This
+ * feature can automatically adjust the brightness of the preview, video or image analysis
+ * streams in low-light conditions. This is different from how the night mode camera
+ * extension creates still images, because night mode combines a burst of photos to create a
+ * single, enhanced image. While night mode works very well for creating a still image, it
+ * can't create a continuous stream of frames, but Low Light Boost can. Thus, Low Light Boost
+ * enables new camera capabilities, such as the following:
+ *
+ * <ul>
+ * <li>Providing an enhanced image preview, so users can better frame their low-light pictures.
+ * <li>Recording brighter videos in low-light conditions.
+ * <li>Scanning QR codes in low-light conditions.
+ * </ul>
+ *
+ * <p>Applications can query the low-light boost availability via
+ * {@link CameraInfo#isLowLightBoostSupported()}. If you enable Low Light Boost, it
+ * automatically turns on when there's a low light level, and turns off when there's more light.
+ *
+ * <p>If the camera device does not support low-light boost, the value obtained via
+ * {@link CameraInfo#getLowLightBoostState()} will always be {@link LowLightBoostState#OFF}.
+ *
+ * <p>Note that this mode may interact with other configurations:
+ *
+ * <ul>
+ * <li>When low-light boost is on, the flash or torch functionality may be unavailable.
+ * <li>When frame rate configuration results in an FPS exceeding 30, low-light boost will be
+ * disabled and the state will always be ({@link LowLightBoostState#OFF}).
+ * </ul>
+ *
+ * <p>Therefore, to use flash or torch functionality, low-light boost mode must be disabled.
+ * To ensure low-light boost mode functions correctly, avoid frame rate settings that result
+ * in an FPS exceeding 30.
+ *
+ * @param lowLightBoost true to turn on the low-light boost mode, false to turn it off.
+ * @return A {@link ListenableFuture} which is successful when the low-light boost mode was
+ * changed to the value specified. It fails when it is unable to change the log-light boost
+ * state. Cancellation of this future is a no-op.
+ * @see CameraInfo#isLowLightBoostSupported()
+ */
+ @RestrictTo(RestrictTo.Scope.LIBRARY_GROUP)
+ default @NonNull ListenableFuture<Void> enableLowLightBoostAsync(boolean lowLightBoost) {
+ return Futures.immediateFailedFuture(new OperationCanceledException("Not supported!"));
+ }
+
+ /**
* Starts a focus and metering action configured by the {@link FocusMeteringAction}.
*
* <p>It will trigger an auto focus action and enable AF/AE/AWB metering regions. The action
diff --git a/camera/camera-core/src/main/java/androidx/camera/core/CameraInfo.java b/camera/camera-core/src/main/java/androidx/camera/core/CameraInfo.java
index 805440f..e2f6556 100644
--- a/camera/camera-core/src/main/java/androidx/camera/core/CameraInfo.java
+++ b/camera/camera-core/src/main/java/androidx/camera/core/CameraInfo.java
@@ -17,6 +17,7 @@
package androidx.camera.core;
import android.graphics.ImageFormat;
+import android.hardware.camera2.CaptureRequest;
import android.media.MediaActionSound;
import android.util.Range;
import android.view.Surface;
@@ -30,6 +31,7 @@
import androidx.camera.core.internal.compat.MediaActionSoundCompat;
import androidx.lifecycle.LifecycleOwner;
import androidx.lifecycle.LiveData;
+import androidx.lifecycle.MutableLiveData;
import androidx.lifecycle.Observer;
import org.jspecify.annotations.NonNull;
@@ -430,4 +432,38 @@
@RestrictTo(Scope.LIBRARY_GROUP)
@interface ImplementationType {
}
+
+ /**
+ * Returns if low-light boost is supported on the device. Low-light boost can be turned on via
+ * {@link CameraControl#enableLowLightBoostAsync(boolean)}.
+ *
+ * @return true if
+ * {@link CaptureRequest#CONTROL_AE_MODE_ON_LOW_LIGHT_BOOST_BRIGHTNESS_PRIORITY} is supported,
+ * otherwise false.
+ * @see CameraControl#enableLowLightBoostAsync(boolean)
+ * @see CaptureRequest#CONTROL_AE_MODE_ON_LOW_LIGHT_BOOST_BRIGHTNESS_PRIORITY
+ */
+ @RestrictTo(Scope.LIBRARY_GROUP)
+ default boolean isLowLightBoostSupported() {
+ return false;
+ }
+
+ /**
+ * Returns a {@link LiveData} of current {@link LowLightBoostState}.
+ *
+ * <p>Low-light boost can be turned on via
+ * {@link CameraControl#enableLowLightBoostAsync(boolean)} which will trigger the change
+ * event to the returned {@link LiveData}. Apps can either get immediate value via
+ * {@link LiveData#getValue()} or observe it via
+ * {@link LiveData#observe(LifecycleOwner, Observer)} to update low-light boost UI accordingly.
+ *
+ * <p>If the camera doesn't support low-light boost, then the state will always be
+ * {@link LowLightBoostState#OFF}.
+ *
+ * @return a {@link LiveData} containing current low-light boost state.
+ */
+ @RestrictTo(Scope.LIBRARY_GROUP)
+ default @NonNull LiveData<Integer> getLowLightBoostState() {
+ return new MutableLiveData<>(LowLightBoostState.OFF);
+ }
}
diff --git a/camera/camera-core/src/main/java/androidx/camera/core/LowLightBoostState.java b/camera/camera-core/src/main/java/androidx/camera/core/LowLightBoostState.java
new file mode 100644
index 0000000..94d37b3
--- /dev/null
+++ b/camera/camera-core/src/main/java/androidx/camera/core/LowLightBoostState.java
@@ -0,0 +1,51 @@
+/*
+ * Copyright 2024 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT 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.camera.core;
+
+import androidx.annotation.IntDef;
+import androidx.annotation.RestrictTo;
+
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+
+/**
+ * Defines the valid states for Low Light Boost, as returned by
+ * {@link CameraInfo#getLowLightBoostState()}.
+ *
+ * <p>These states indicate whether the camera device supports low light boost and if it is
+ * currently active.
+ */
+@RestrictTo(RestrictTo.Scope.LIBRARY_GROUP)
+public class LowLightBoostState {
+ /** Low-light boost is off. */
+ public static final int OFF = -1;
+ /** Low-light boost is on but inactive. */
+ public static final int INACTIVE = 0;
+ /** Low-light boost is on and active. */
+ public static final int ACTIVE = 1;
+
+ private LowLightBoostState() {
+ }
+
+ /**
+ */
+ @IntDef({OFF, INACTIVE, ACTIVE})
+ @Retention(RetentionPolicy.SOURCE)
+ @RestrictTo(RestrictTo.Scope.LIBRARY_GROUP)
+ public @interface State {
+ }
+}
diff --git a/camera/camera-core/src/main/java/androidx/camera/core/impl/ForwardingCameraControl.java b/camera/camera-core/src/main/java/androidx/camera/core/impl/ForwardingCameraControl.java
index f3531bb..66ea978 100644
--- a/camera/camera-core/src/main/java/androidx/camera/core/impl/ForwardingCameraControl.java
+++ b/camera/camera-core/src/main/java/androidx/camera/core/impl/ForwardingCameraControl.java
@@ -52,6 +52,11 @@
}
@Override
+ public @NonNull ListenableFuture<Void> enableLowLightBoostAsync(boolean lowLightBoost) {
+ return mCameraControlInternal.enableLowLightBoostAsync(lowLightBoost);
+ }
+
+ @Override
public @NonNull ListenableFuture<FocusMeteringResult> startFocusAndMetering(
@NonNull FocusMeteringAction action) {
return mCameraControlInternal.startFocusAndMetering(action);
diff --git a/camera/camera-core/src/main/java/androidx/camera/core/impl/ForwardingCameraInfo.java b/camera/camera-core/src/main/java/androidx/camera/core/impl/ForwardingCameraInfo.java
index 267475d..fd752fd 100644
--- a/camera/camera-core/src/main/java/androidx/camera/core/impl/ForwardingCameraInfo.java
+++ b/camera/camera-core/src/main/java/androidx/camera/core/impl/ForwardingCameraInfo.java
@@ -73,6 +73,16 @@
}
@Override
+ public boolean isLowLightBoostSupported() {
+ return mCameraInfoInternal.isLowLightBoostSupported();
+ }
+
+ @Override
+ public @NonNull LiveData<Integer> getLowLightBoostState() {
+ return mCameraInfoInternal.getLowLightBoostState();
+ }
+
+ @Override
public @NonNull LiveData<ZoomState> getZoomState() {
return mCameraInfoInternal.getZoomState();
}
diff --git a/camera/camera-core/src/main/java/androidx/camera/core/impl/StreamSpec.java b/camera/camera-core/src/main/java/androidx/camera/core/impl/StreamSpec.java
index bbd3ff2..2552a60 100644
--- a/camera/camera-core/src/main/java/androidx/camera/core/impl/StreamSpec.java
+++ b/camera/camera-core/src/main/java/androidx/camera/core/impl/StreamSpec.java
@@ -21,6 +21,8 @@
import android.util.Size;
import androidx.camera.core.DynamicRange;
+import androidx.camera.core.ViewPort;
+import androidx.camera.core.streamsharing.StreamSharing;
import com.google.auto.value.AutoValue;
@@ -46,6 +48,25 @@
public abstract @NonNull Size getResolution();
/**
+ * Returns the original resolution configured by the camera. This value is useful for
+ * debugging and analysis, as it represents the initial resolution intended for the stream,
+ * even if the stream is later modified.
+ *
+ * <p>This value typically matches the resolution returned by {@link #getResolution()},
+ * but may differ if the stream is modified (e.g., cropped, scaled, or rotated)
+ * after being configured by the camera. For example, {@link StreamSharing} first determines
+ * which child use case's requested resolution to be its configured resolution and then
+ * request a larger resolution from the camera. The camera stream is further modified (e.g.,
+ * cropped, scaled, or rotated) to fit the configured resolution and other requirements such
+ * as {@link ViewPort} and rotation. The final resolution after these
+ * modifications would be reflected by {@link #getResolution()}, while this method returns the
+ * original configured resolution.
+ *
+ * @return The originally configured camera resolution.
+ */
+ public abstract @NonNull Size getOriginalConfiguredResolution();
+
+ /**
* Returns the {@link DynamicRange} for the stream associated with this stream specification.
* @return the dynamic range for the stream.
*/
@@ -74,6 +95,7 @@
public static @NonNull Builder builder(@NonNull Size resolution) {
return new AutoValue_StreamSpec.Builder()
.setResolution(resolution)
+ .setOriginalConfiguredResolution(resolution)
.setExpectedFrameRateRange(FRAME_RATE_RANGE_UNSPECIFIED)
.setDynamicRange(DynamicRange.SDR)
.setZslDisabled(false);
@@ -93,6 +115,25 @@
public abstract @NonNull Builder setResolution(@NonNull Size resolution);
/**
+ * Sets the original resolution configured by the camera. This value is useful for
+ * debugging and analysis, as it represents the initial resolution intended by the stream
+ * consumer, even if the stream is later modified.
+ *
+ * <p>This value typically matches the resolution set by {@link #setResolution(Size)},
+ * but may differ if the stream is modified (e.g., cropped, scaled, or rotated)
+ * after being configured by the camera. For example, {@link StreamSharing} first
+ * determines which child use case's requested resolution to be its configured resolution
+ * and then request a larger resolution from the camera. The camera stream is further
+ * modified (e.g., cropped, scaled, or rotated) to fit the configured resolution and other
+ * requirements such as {@link ViewPort} and rotation. The final resolution after these
+ * modifications is set by {@link #setResolution(Size)}, while this method retains the
+ * original configured resolution.
+ *
+ * <p>If not set, this value will default to the resolution set in this builder.
+ */
+ public abstract @NonNull Builder setOriginalConfiguredResolution(@NonNull Size resolution);
+
+ /**
* Sets the dynamic range.
*
* <p>If not set, the default dynamic range is {@link DynamicRange#SDR}.
diff --git a/camera/camera-core/src/main/java/androidx/camera/core/streamsharing/PreferredChildSize.kt b/camera/camera-core/src/main/java/androidx/camera/core/streamsharing/PreferredChildSize.kt
new file mode 100644
index 0000000..1b65043
--- /dev/null
+++ b/camera/camera-core/src/main/java/androidx/camera/core/streamsharing/PreferredChildSize.kt
@@ -0,0 +1,35 @@
+/*
+ * Copyright 2025 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT 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.camera.core.streamsharing
+
+import android.graphics.Rect
+import android.util.Size
+
+/** Data class representing the preferred size information for a child. */
+internal data class PreferredChildSize(
+ /** The cropping rectangle to apply before scaling. */
+ val cropRectBeforeScaling: Rect,
+
+ /** The size of the child after scaling. */
+ val childSizeToScale: Size,
+
+ /**
+ * The original selected size from the child's preferred sizes before any scaling, cropping, or
+ * rotating.
+ */
+ val originalSelectedChildSize: Size
+)
diff --git a/camera/camera-core/src/main/java/androidx/camera/core/streamsharing/ResolutionsMerger.java b/camera/camera-core/src/main/java/androidx/camera/core/streamsharing/ResolutionsMerger.java
index 3ad3c04..deef99f 100644
--- a/camera/camera-core/src/main/java/androidx/camera/core/streamsharing/ResolutionsMerger.java
+++ b/camera/camera-core/src/main/java/androidx/camera/core/streamsharing/ResolutionsMerger.java
@@ -130,10 +130,11 @@
}
/**
- * Returns a preferred pair composed of a crop rect before scaling and a size after scaling.
+ * Returns a {@link PreferredChildSize} object containing the preferred size information for a
+ * child.
*
* <p>The first size in the child's ordered size list that does not require the parent to
- * upscale and does not cause double-cropping will be used to generate the pair, or {@code
+ * upscale and does not cause double-cropping will be used to generate the result, or {@code
* parentCropRect} will be used if no matching is found.
*
* <p>The returned crop rect and size will have the same aspect-ratio. When {@code
@@ -143,8 +144,10 @@
* <p>Notes that the input {@code childConfig} is expected to be one of the values that use to
* construct the {@link ResolutionsMerger}, if not an IllegalArgumentException will be thrown.
*/
- @NonNull Pair<Rect, Size> getPreferredChildSizePair(@NonNull UseCaseConfig<?> childConfig,
- @NonNull Rect parentCropRect, int sensorToBufferRotationDegrees,
+ @NonNull PreferredChildSize getPreferredChildSize(
+ @NonNull UseCaseConfig<?> childConfig,
+ @NonNull Rect parentCropRect,
+ int sensorToBufferRotationDegrees,
boolean isViewportSet) {
// For easier in following computations, width and height are reverted when the rotation
// degrees of sensor-to-buffer is 90 or 270.
@@ -154,27 +157,27 @@
isWidthHeightRevertedForComputation = true;
}
- // Get preferred child size pair.
- Pair<Rect, Size> pair = getPreferredChildSizePairInternal(parentCropRect, childConfig,
- isViewportSet);
- Rect cropRectBeforeScaling = pair.first;
- Size childSizeToScale = pair.second;
+ // Get preferred child size.
+ PreferredChildSize preferredChildSize = getPreferredChildSizeInternal(
+ parentCropRect, childConfig, isViewportSet);
// Restore the reversion of width and height
if (isWidthHeightRevertedForComputation) {
- childSizeToScale = reverseSize(childSizeToScale);
- cropRectBeforeScaling = reverseRect(cropRectBeforeScaling);
+ preferredChildSize = new PreferredChildSize(
+ reverseRect(preferredChildSize.getCropRectBeforeScaling()),
+ reverseSize(preferredChildSize.getChildSizeToScale()),
+ preferredChildSize.getOriginalSelectedChildSize());
}
- return new Pair<>(cropRectBeforeScaling, childSizeToScale);
-
+ return preferredChildSize;
}
- private @NonNull Pair<Rect, Size> getPreferredChildSizePairInternal(
+ private @NonNull PreferredChildSize getPreferredChildSizeInternal(
@NonNull Rect parentCropRect, @NonNull UseCaseConfig<?> childConfig,
boolean isViewportSet) {
Rect cropRectBeforeScaling;
Size childSizeToScale;
+ Size selectedChildSize;
if (isViewportSet) {
cropRectBeforeScaling = parentCropRect;
@@ -182,14 +185,16 @@
// When viewport is set, child size needs to be cropped to match viewport's
// aspect-ratio.
Size viewPortSize = rectToSize(parentCropRect);
- childSizeToScale = getPreferredChildSizeForViewport(viewPortSize, childConfig);
+ Pair<Size, Size> pair = getPreferredChildSizeForViewport(viewPortSize, childConfig);
+ selectedChildSize = pair.first;
+ childSizeToScale = pair.second;
} else {
Size parentSize = rectToSize(parentCropRect);
- childSizeToScale = getPreferredChildSize(parentSize, childConfig);
+ childSizeToScale = selectedChildSize = getPreferredChildSize(parentSize, childConfig);
cropRectBeforeScaling = getCropRectOfReferenceAspectRatio(parentSize, childSizeToScale);
}
- return new Pair<>(cropRectBeforeScaling, childSizeToScale);
+ return new PreferredChildSize(cropRectBeforeScaling, childSizeToScale, selectedChildSize);
}
/**
@@ -242,7 +247,7 @@
* construct the {@link ResolutionsMerger}, if not an IllegalArgumentException will be thrown.
*/
@VisibleForTesting
- @NonNull Size getPreferredChildSizeForViewport(@NonNull Size parentSize,
+ @NonNull Pair<Size, Size> getPreferredChildSizeForViewport(@NonNull Size parentSize,
@NonNull UseCaseConfig<?> childConfig) {
List<Size> candidateChildSizes = getSortedChildSizes(childConfig);
@@ -251,11 +256,11 @@
getCropRectOfReferenceAspectRatio(childSize, parentSize));
if (!hasUpscaling(childSizeToCrop, parentSize)) {
- return childSizeToCrop;
+ return Pair.create(childSize, childSizeToCrop);
}
}
- return parentSize;
+ return Pair.create(parentSize, parentSize);
}
private @NonNull List<Size> getCameraSupportedResolutions() {
diff --git a/camera/camera-core/src/main/java/androidx/camera/core/streamsharing/StreamSharing.java b/camera/camera-core/src/main/java/androidx/camera/core/streamsharing/StreamSharing.java
index ec4402b..565ee32 100644
--- a/camera/camera-core/src/main/java/androidx/camera/core/streamsharing/StreamSharing.java
+++ b/camera/camera-core/src/main/java/androidx/camera/core/streamsharing/StreamSharing.java
@@ -287,7 +287,10 @@
outputEdges.put(entry.getKey(), out.get(entry.getValue()));
}
- mVirtualCameraAdapter.setChildrenEdges(outputEdges);
+ Map<UseCase, Size> selectedChildSizeMap = mVirtualCameraAdapter.getSelectedChildSizes(
+ mSharingInputEdge, isViewportSet);
+
+ mVirtualCameraAdapter.setChildrenEdges(outputEdges, selectedChildSizeMap);
return List.of(mSessionConfigBuilder.build());
} else {
@@ -323,7 +326,11 @@
for (Map.Entry<UseCase, DualOutConfig> entry : outConfigMap.entrySet()) {
outputEdges.put(entry.getKey(), out.get(entry.getValue()));
}
- mVirtualCameraAdapter.setChildrenEdges(outputEdges);
+
+ Map<UseCase, Size> primarySelectedChildSizes =
+ mVirtualCameraAdapter.getSelectedChildSizes(mSharingInputEdge, isViewportSet);
+
+ mVirtualCameraAdapter.setChildrenEdges(outputEdges, primarySelectedChildSizes);
return List.of(mSessionConfigBuilder.build(),
mSecondarySessionConfigBuilder.build());
diff --git a/camera/camera-core/src/main/java/androidx/camera/core/streamsharing/VirtualCameraAdapter.java b/camera/camera-core/src/main/java/androidx/camera/core/streamsharing/VirtualCameraAdapter.java
index 3121dbd..d903782 100644
--- a/camera/camera-core/src/main/java/androidx/camera/core/streamsharing/VirtualCameraAdapter.java
+++ b/camera/camera-core/src/main/java/androidx/camera/core/streamsharing/VirtualCameraAdapter.java
@@ -37,7 +37,6 @@
import android.graphics.ImageFormat;
import android.graphics.Rect;
-import android.util.Pair;
import android.util.Range;
import android.util.Size;
import android.view.Surface;
@@ -222,7 +221,8 @@
/**
* Gets {@link OutConfig} for children {@link UseCase} based on the input edge.
*/
- @NonNull Map<UseCase, OutConfig> getChildrenOutConfigs(@NonNull SurfaceEdge sharingInputEdge,
+ @NonNull Map<UseCase, OutConfig> getChildrenOutConfigs(
+ @NonNull SurfaceEdge sharingInputEdge,
@ImageOutputConfig.RotationValue int parentTargetRotation, boolean isViewportSet) {
Map<UseCase, OutConfig> outConfigs = new HashMap<>();
for (UseCase useCase : mChildren) {
@@ -233,6 +233,24 @@
return outConfigs;
}
+ /**
+ * Gets original selected size for children {@link UseCase} based on the input edge.
+ */
+ @NonNull Map<UseCase, Size> getSelectedChildSizes(@NonNull SurfaceEdge sharingInputEdge,
+ boolean isViewportSet) {
+ Map<UseCase, Size> selectedChildSizes = new HashMap<>();
+ for (UseCase useCase : mChildren) {
+ PreferredChildSize preferredChildSize = mResolutionsMerger
+ .getPreferredChildSize(
+ requireNonNull(mChildrenConfigsMap.get(useCase)),
+ sharingInputEdge.getCropRect(),
+ getRotationDegrees(sharingInputEdge.getSensorToBufferTransform()),
+ isViewportSet);
+ selectedChildSizes.put(useCase, preferredChildSize.getOriginalSelectedChildSize());
+ }
+ return selectedChildSizes;
+ }
+
@NonNull Map<UseCase, DualOutConfig> getChildrenOutConfigs(
@NonNull SurfaceEdge primaryInputEdge,
@NonNull SurfaceEdge secondaryInputEdge,
@@ -247,7 +265,7 @@
parentTargetRotation, isViewportSet);
// secondary
OutConfig secondaryOutConfig = calculateOutConfig(
- useCase, mSecondaryResolutionsMerger,
+ useCase, requireNonNull(mSecondaryResolutionsMerger),
requireNonNull(mSecondaryParentCamera),
secondaryInputEdge,
parentTargetRotation, isViewportSet);
@@ -270,14 +288,14 @@
.getSensorRotationDegrees(parentTargetRotation);
boolean parentIsMirrored = isMirrored(
cameraInputEdge.getSensorToBufferTransform());
- Pair<Rect, Size> preferredSizePair = resolutionsMerger
- .getPreferredChildSizePair(
+ PreferredChildSize preferredChildSize = resolutionsMerger
+ .getPreferredChildSize(
requireNonNull(mChildrenConfigsMap.get(useCase)),
cameraInputEdge.getCropRect(),
getRotationDegrees(cameraInputEdge.getSensorToBufferTransform()),
isViewportSet);
- Rect cropRectBeforeScaling = preferredSizePair.first;
- Size childSizeToScale = preferredSizePair.second;
+ Rect cropRectBeforeScaling = preferredChildSize.getCropRectBeforeScaling();
+ Size childSizeToScale = preferredChildSize.getChildSizeToScale();
// Only use primary camera info for output surface
int childRotationDegrees = getChildRotationDegrees(useCase, mParentCamera);
@@ -299,7 +317,8 @@
/**
* Update children {@link SurfaceEdge} calculated by {@link StreamSharing}.
*/
- void setChildrenEdges(@NonNull Map<UseCase, SurfaceEdge> childrenEdges) {
+ void setChildrenEdges(@NonNull Map<UseCase, SurfaceEdge> childrenEdges,
+ @NonNull Map<UseCase, @NonNull Size> selectedChildSizes) {
mChildrenEdges.clear();
mChildrenEdges.putAll(childrenEdges);
for (Map.Entry<UseCase, SurfaceEdge> entry : mChildrenEdges.entrySet()) {
@@ -307,7 +326,9 @@
SurfaceEdge surfaceEdge = entry.getValue();
useCase.setViewPortCropRect(surfaceEdge.getCropRect());
useCase.setSensorToBufferTransformMatrix(surfaceEdge.getSensorToBufferTransform());
- useCase.updateSuggestedStreamSpec(surfaceEdge.getStreamSpec(), null);
+ StreamSpec streamSpec = getChildStreamSpec(useCase, surfaceEdge.getStreamSpec(),
+ selectedChildSizes);
+ useCase.updateSuggestedStreamSpec(streamSpec, null);
useCase.notifyState();
}
}
@@ -401,6 +422,17 @@
return cameraInternal.getCameraInfo().getSensorRotationDegrees(childTargetRotation);
}
+ @NonNull
+ private static StreamSpec getChildStreamSpec(@NonNull UseCase useCase,
+ @NonNull StreamSpec baseStreamSpec, @NonNull Map<UseCase, Size> selectedChildSizes) {
+ StreamSpec.Builder builder = baseStreamSpec.toBuilder();
+ Size selectedChildSize = selectedChildSizes.get(useCase);
+ if (selectedChildSize != null) {
+ builder.setOriginalConfiguredResolution(selectedChildSize);
+ }
+ return builder.build();
+ }
+
private static int getChildFormat(@NonNull UseCase useCase) {
return useCase instanceof ImageCapture ? ImageFormat.JPEG
: INTERNAL_DEFINED_IMAGE_FORMAT_PRIVATE;
@@ -517,8 +549,8 @@
Range<Integer> resolvedTargetFrameRate = StreamSpec.FRAME_RATE_RANGE_UNSPECIFIED;
for (UseCaseConfig<?> useCaseConfig : useCaseConfigs) {
- Range<Integer> targetFrameRate = useCaseConfig.getTargetFrameRate(
- resolvedTargetFrameRate);
+ Range<Integer> targetFrameRate = requireNonNull(useCaseConfig.getTargetFrameRate(
+ resolvedTargetFrameRate));
if (StreamSpec.FRAME_RATE_RANGE_UNSPECIFIED.equals(resolvedTargetFrameRate)) {
resolvedTargetFrameRate = targetFrameRate;
diff --git a/camera/camera-core/src/test/java/androidx/camera/core/streamsharing/ResolutionsMergerTest.kt b/camera/camera-core/src/test/java/androidx/camera/core/streamsharing/ResolutionsMergerTest.kt
index e7bbbd3..0a227b2 100644
--- a/camera/camera-core/src/test/java/androidx/camera/core/streamsharing/ResolutionsMergerTest.kt
+++ b/camera/camera-core/src/test/java/androidx/camera/core/streamsharing/ResolutionsMergerTest.kt
@@ -18,6 +18,7 @@
import android.graphics.Rect
import android.os.Build
+import android.util.Pair
import android.util.Rational
import android.util.Size
import androidx.camera.core.impl.ImageFormatConstants.INTERNAL_DEFINED_IMAGE_FORMAT_PRIVATE
@@ -337,7 +338,7 @@
}
@Test(expected = IllegalArgumentException::class)
- fun getPreferredChildSizePair_whenConfigNotPassedToConstructor_throwsException() {
+ fun getPreferredChildSize_whenUseCaseConfigNotPassedToConstructor_throwsException() {
// Arrange.
val config = createUseCaseConfig()
val sorter = FakeSupportedOutputSizesSorter(mapOf(config to SIZES_16_9))
@@ -345,11 +346,11 @@
// Act.
val useCaseConfigNotPassed = createUseCaseConfig()
- merger.getPreferredChildSizePair(useCaseConfigNotPassed, SIZE_1920_1440.toRect(), 0, false)
+ merger.getPreferredChildSize(useCaseConfigNotPassed, SIZE_1920_1440.toRect(), 0, false)
}
@Test
- fun getPreferredChildSizePair_whenViewportIsNotSet_canReturnCorrectly() {
+ fun getPreferredChildSize_whenViewportIsNotSet_canReturnCorrectly() {
// Arrange.
val config = createUseCaseConfig()
val candidateChildSizes =
@@ -367,21 +368,18 @@
// Act & Assert, should returns the first child size that do not need upscale and cause
// double-cropping.
- merger
- .getPreferredChildSizePair(config, SIZE_2560_1440.toRect(), 0, false)
- .containsExactly(SIZE_2560_1440.toRect(), SIZE_1920_1080)
- merger
- .getPreferredChildSizePair(config, SIZE_1280_720.toRect(), 0, false)
- .containsExactly(SIZE_1280_720.toRect(), SIZE_960_540)
+ assertThat(merger.getPreferredChildSize(config, SIZE_2560_1440.toRect(), 0, false))
+ .isEqualTo(PreferredChildSize(SIZE_2560_1440.toRect(), SIZE_1920_1080, SIZE_1920_1080))
+ assertThat(merger.getPreferredChildSize(config, SIZE_1280_720.toRect(), 0, false))
+ .isEqualTo(PreferredChildSize(SIZE_1280_720.toRect(), SIZE_960_540, SIZE_960_540))
// Act & Assert, should returns parent size when no matching.
- merger
- .getPreferredChildSizePair(config, SIZE_192_108.toRect(), 0, false)
- .containsExactly(SIZE_192_108.toRect(), SIZE_192_108)
+ assertThat(merger.getPreferredChildSize(config, SIZE_192_108.toRect(), 0, false))
+ .isEqualTo(PreferredChildSize(SIZE_192_108.toRect(), SIZE_192_108, SIZE_192_108))
}
@Test
- fun getPreferredChildSizePair_whenViewportIsSet_canReturnCorrectly() {
+ fun getPreferredChildSize_whenViewportIsSet_canReturnCorrectly() {
// Arrange.
val config = createUseCaseConfig()
val candidateChildSizes =
@@ -396,25 +394,22 @@
// Act & Assert, should returns 1:1 crop rect and size, that are generated from the first
// child size that do not need upscale.
val rect1440To1440 = SIZE_2560_1920.crop(Size(1440, 1440))
- merger
- .getPreferredChildSizePair(config, rect1440To1440, 0, true)
- .containsExactly(rect1440To1440, Size(1080, 1080))
+ assertThat(merger.getPreferredChildSize(config, rect1440To1440, 0, true))
+ .isEqualTo(PreferredChildSize(rect1440To1440, Size(1080, 1080), SIZE_1920_1080))
val rect720To720 = SIZE_1280_720.crop(Size(720, 720))
- merger
- .getPreferredChildSizePair(config, rect720To720, 0, true)
- .containsExactly(rect720To720, Size(540, 540))
+ assertThat(merger.getPreferredChildSize(config, rect720To720, 0, true))
+ .isEqualTo(PreferredChildSize(rect720To720, Size(540, 540), SIZE_960_540))
// Act & Assert, should returns crop rect and size, that are generated from parent size
// when no matching.
val size108To108 = Size(108, 108)
val rect108To108 = SIZE_192_108.crop(size108To108)
- merger
- .getPreferredChildSizePair(config, rect108To108, 0, true)
- .containsExactly(rect108To108, size108To108)
+ assertThat(merger.getPreferredChildSize(config, rect108To108, 0, true))
+ .isEqualTo(PreferredChildSize(rect108To108, size108To108, size108To108))
}
@Test
- fun getPreferredChildSizePair_whenViewportIsSetAndRotationIs90_canReturnCorrectly() {
+ fun getPreferredChildSize_whenViewportIsSetAndRotationIs90_canReturnCorrectly() {
// Arrange.
val config = createUseCaseConfig()
val candidateChildSizes =
@@ -429,20 +424,18 @@
// Act & Assert, should returns 1:2 crop rect and size, that are generated from the first
// child size that do not need upscale.
val rect1280To2560 = SIZE_2560_1440.crop(Size(2560, 1280)).reverse()
- merger
- .getPreferredChildSizePair(config, rect1280To2560, 90, true)
- .containsExactly(rect1280To2560, Size(960, 1920))
+ assertThat(merger.getPreferredChildSize(config, rect1280To2560, 90, true))
+ .isEqualTo(PreferredChildSize(rect1280To2560, Size(960, 1920), SIZE_1920_1080))
val rect640To1280 = SIZE_1280_720.crop(Size(1280, 640)).reverse()
- merger
- .getPreferredChildSizePair(config, rect640To1280, 90, true)
- .containsExactly(rect640To1280, Size(480, 960))
+ assertThat(merger.getPreferredChildSize(config, rect640To1280, 90, true))
+ .isEqualTo(PreferredChildSize(rect640To1280, Size(480, 960), SIZE_960_540))
// Act & Assert, should returns crop rect and size, that are generated from parent size
// when no matching.
- val rect96To192 = SIZE_192_108.crop(Size(192, 96)).reverse()
- merger
- .getPreferredChildSizePair(config, rect96To192, 90, true)
- .containsExactly(rect96To192, rectToSize(rect96To192))
+ val size192To96 = Size(192, 96)
+ val rect96To192 = SIZE_192_108.crop(size192To96).reverse()
+ assertThat(merger.getPreferredChildSize(config, rect96To192, 90, true))
+ .isEqualTo(PreferredChildSize(rect96To192, rectToSize(rect96To192), size192To96))
}
@Test(expected = IllegalArgumentException::class)
@@ -531,13 +524,13 @@
// Act & Assert, should returns the first child size that can be cropped to parent
// aspect-ratio and do not cause upscaling.
assertThat(merger.getPreferredChildSizeForViewport(SIZE_2560_1920, config))
- .isEqualTo(SIZE_1920_1440)
+ .isEqualTo(Pair.create(SIZE_1920_1440, SIZE_1920_1440))
assertThat(merger.getPreferredChildSizeForViewport(SIZE_1280_960, config))
- .isEqualTo(SIZE_960_720)
+ .isEqualTo(Pair.create(SIZE_960_720, SIZE_960_720))
// Act & Assert, should returns parent size when no matching.
assertThat(merger.getPreferredChildSizeForViewport(SIZE_640_480, config))
- .isEqualTo(SIZE_640_480)
+ .isEqualTo(Pair.create(SIZE_640_480, SIZE_640_480))
}
@Test
@@ -556,13 +549,13 @@
// Act & Assert, should returns the first child size that can be cropped to parent
// aspect-ratio and do not cause upscaling.
assertThat(merger.getPreferredChildSizeForViewport(SIZE_1920_1440, config))
- .isEqualTo(Size(1440, 1080))
+ .isEqualTo(Pair.create(SIZE_1920_1080, Size(1440, 1080)))
assertThat(merger.getPreferredChildSizeForViewport(SIZE_1280_960, config))
- .isEqualTo(SIZE_960_720)
+ .isEqualTo(Pair.create(SIZE_1280_720, SIZE_960_720))
// Act & Assert, should returns parent size when no matching.
assertThat(merger.getPreferredChildSizeForViewport(SIZE_640_480, config))
- .isEqualTo(SIZE_640_480)
+ .isEqualTo(Pair.create(SIZE_640_480, SIZE_640_480))
}
@Test
@@ -776,11 +769,6 @@
return FakeUseCaseConfig.Builder().useCaseConfig
}
- private fun android.util.Pair<Rect, Size>.containsExactly(rect: Rect, size: Size) {
- assertThat(first).isEqualTo(rect)
- assertThat(second).isEqualTo(size)
- }
-
private fun Rect.hasMatchingAspectRatio(resolution: Size): Boolean {
return AspectRatioUtil.hasMatchingAspectRatio(resolution, Rational(width(), height()))
}
diff --git a/camera/camera-core/src/test/java/androidx/camera/core/streamsharing/VirtualCameraAdapterTest.kt b/camera/camera-core/src/test/java/androidx/camera/core/streamsharing/VirtualCameraAdapterTest.kt
index 2d8f0f8..1049990 100644
--- a/camera/camera-core/src/test/java/androidx/camera/core/streamsharing/VirtualCameraAdapterTest.kt
+++ b/camera/camera-core/src/test/java/androidx/camera/core/streamsharing/VirtualCameraAdapterTest.kt
@@ -97,6 +97,8 @@
Pair(child1 as UseCase, createSurfaceEdge()),
Pair(child2 as UseCase, createSurfaceEdge())
)
+ private val selectedChildSizes =
+ mapOf<UseCase, Size>(child1 to INPUT_SIZE, child2 to INPUT_SIZE)
private val useCaseConfigFactory = FakeUseCaseConfigFactory()
private lateinit var adapter: VirtualCameraAdapter
private var snapshotTriggered = false
@@ -223,7 +225,7 @@
fun setUseCaseActiveAndInactive_surfaceConnectsAndDisconnects() {
// Arrange.
adapter.bindChildren()
- adapter.setChildrenEdges(childrenEdges)
+ adapter.setChildrenEdges(childrenEdges, selectedChildSizes)
child1.updateSessionConfigForTesting(SESSION_CONFIG_WITH_SURFACE)
// Assert: edge open by default.
verifyEdge(child1, OPEN, NO_PROVIDER)
@@ -242,7 +244,7 @@
fun resetWithClosedChildSurface_invokesErrorListener() {
// Arrange.
adapter.bindChildren()
- adapter.setChildrenEdges(childrenEdges)
+ adapter.setChildrenEdges(childrenEdges, selectedChildSizes)
child1.updateSessionConfigForTesting(SESSION_CONFIG_WITH_SURFACE)
child1.notifyActiveForTesting()
@@ -260,7 +262,7 @@
fun resetUseCase_edgeInvalidated() {
// Arrange: setup and get the old DeferrableSurface.
adapter.bindChildren()
- adapter.setChildrenEdges(childrenEdges)
+ adapter.setChildrenEdges(childrenEdges, selectedChildSizes)
child1.updateSessionConfigForTesting(SESSION_CONFIG_WITH_SURFACE)
child1.notifyActiveForTesting()
val oldSurface = childrenEdges[child1]!!.deferrableSurfaceForTesting
@@ -277,7 +279,7 @@
fun updateUseCaseWithAndWithoutSurface_surfaceConnectsAndDisconnects() {
// Arrange
adapter.bindChildren()
- adapter.setChildrenEdges(childrenEdges)
+ adapter.setChildrenEdges(childrenEdges, selectedChildSizes)
child1.notifyActiveForTesting()
verifyEdge(child1, OPEN, NO_PROVIDER)
@@ -364,10 +366,17 @@
@Test
fun updateChildrenSpec_updateAndNotifyChildren() {
// Act: update children with the map.
- adapter.setChildrenEdges(childrenEdges)
- // Assert: surface size, crop rect and transformation propagated to children
+ val selectedChildSizes =
+ mapOf<UseCase, Size>(child1 to Size(400, 300), child2 to Size(720, 480))
+ adapter.setChildrenEdges(childrenEdges, selectedChildSizes)
+ // Assert: surface size, original selected size, crop rect and transformation propagated
+ // to children
assertThat(child1.attachedStreamSpec!!.resolution).isEqualTo(INPUT_SIZE)
+ assertThat(child1.attachedStreamSpec!!.originalConfiguredResolution)
+ .isEqualTo(Size(400, 300))
assertThat(child2.attachedStreamSpec!!.resolution).isEqualTo(INPUT_SIZE)
+ assertThat(child2.attachedStreamSpec!!.originalConfiguredResolution)
+ .isEqualTo(Size(720, 480))
assertThat(child1.viewPortCropRect).isEqualTo(CROP_RECT)
assertThat(child2.viewPortCropRect).isEqualTo(CROP_RECT)
assertThat(child1.sensorToBufferTransformMatrix).isEqualTo(SENSOR_TO_BUFFER)
diff --git a/camera/camera-effects/build.gradle b/camera/camera-effects/build.gradle
index 647f2fd..8bb2c7e 100644
--- a/camera/camera-effects/build.gradle
+++ b/camera/camera-effects/build.gradle
@@ -49,6 +49,7 @@
androidTestImplementation("androidx.concurrent:concurrent-futures-ktx:1.1.0")
}
android {
+ compileSdk 35
testOptions.unitTests.includeAndroidResources = true
namespace = "androidx.camera.effects"
}
diff --git a/camera/camera-extensions/build.gradle b/camera/camera-extensions/build.gradle
index 0e4ace09..bb99409 100644
--- a/camera/camera-extensions/build.gradle
+++ b/camera/camera-extensions/build.gradle
@@ -76,6 +76,8 @@
}
android {
+ compileSdk 35
+
buildTypes.configureEach {
consumerProguardFiles "proguard-rules.pro"
}
diff --git a/camera/camera-lifecycle/build.gradle b/camera/camera-lifecycle/build.gradle
index c02d39a..a051ed1 100644
--- a/camera/camera-lifecycle/build.gradle
+++ b/camera/camera-lifecycle/build.gradle
@@ -61,6 +61,8 @@
}
android {
+ compileSdk 35
+
lintOptions {
enable 'CameraXQuirksClassDetector'
}
diff --git a/camera/camera-lifecycle/samples/build.gradle b/camera/camera-lifecycle/samples/build.gradle
index 5f5011f..09838ff 100644
--- a/camera/camera-lifecycle/samples/build.gradle
+++ b/camera/camera-lifecycle/samples/build.gradle
@@ -39,6 +39,7 @@
}
android {
+ compileSdk 35
namespace = "androidx.camera.lifecycle.samples"
}
diff --git a/camera/camera-mlkit-vision/build.gradle b/camera/camera-mlkit-vision/build.gradle
index 6ad87b4..25831a7 100644
--- a/camera/camera-mlkit-vision/build.gradle
+++ b/camera/camera-mlkit-vision/build.gradle
@@ -45,6 +45,8 @@
}
android {
+ compileSdk 35
+
lintOptions {
enable 'CameraXQuirksClassDetector'
}
diff --git a/camera/camera-testing/build.gradle b/camera/camera-testing/build.gradle
index 0038f04..a702c14 100644
--- a/camera/camera-testing/build.gradle
+++ b/camera/camera-testing/build.gradle
@@ -79,6 +79,8 @@
}
android {
+ compileSdk 35
+
defaultConfig {
externalNativeBuild {
cmake {
diff --git a/camera/camera-testlib-extensions/build.gradle b/camera/camera-testlib-extensions/build.gradle
index d0e83eeb..a220c59 100644
--- a/camera/camera-testlib-extensions/build.gradle
+++ b/camera/camera-testlib-extensions/build.gradle
@@ -35,6 +35,8 @@
}
android {
+ compileSdk 35
+
lintOptions {
enable 'CameraXQuirksClassDetector'
}
diff --git a/camera/camera-video/api/current.txt b/camera/camera-video/api/current.txt
index 0e6ea1c..0c6fcf2 100644
--- a/camera/camera-video/api/current.txt
+++ b/camera/camera-video/api/current.txt
@@ -162,6 +162,7 @@
method public int getMirrorMode();
method public T getOutput();
method public androidx.camera.core.ResolutionInfo? getResolutionInfo();
+ method public androidx.camera.video.Quality? getSelectedQuality();
method public android.util.Range<java.lang.Integer!> getTargetFrameRate();
method public int getTargetRotation();
method public boolean isVideoStabilizationEnabled();
diff --git a/camera/camera-video/api/restricted_current.txt b/camera/camera-video/api/restricted_current.txt
index 0e6ea1c..0c6fcf2 100644
--- a/camera/camera-video/api/restricted_current.txt
+++ b/camera/camera-video/api/restricted_current.txt
@@ -162,6 +162,7 @@
method public int getMirrorMode();
method public T getOutput();
method public androidx.camera.core.ResolutionInfo? getResolutionInfo();
+ method public androidx.camera.video.Quality? getSelectedQuality();
method public android.util.Range<java.lang.Integer!> getTargetFrameRate();
method public int getTargetRotation();
method public boolean isVideoStabilizationEnabled();
diff --git a/camera/camera-video/build.gradle b/camera/camera-video/build.gradle
index d719316..9cbe32e 100644
--- a/camera/camera-video/build.gradle
+++ b/camera/camera-video/build.gradle
@@ -75,6 +75,8 @@
}
android {
+ compileSdk 35
+
lintOptions {
enable 'CameraXQuirksClassDetector'
}
diff --git a/camera/camera-video/src/main/java/androidx/camera/video/VideoCapture.java b/camera/camera-video/src/main/java/androidx/camera/video/VideoCapture.java
index 43e805a..b947810 100644
--- a/camera/camera-video/src/main/java/androidx/camera/video/VideoCapture.java
+++ b/camera/camera-video/src/main/java/androidx/camera/video/VideoCapture.java
@@ -56,6 +56,7 @@
import static androidx.camera.video.internal.utils.DynamicRangeUtil.videoProfileHdrFormatsToDynamicRangeEncoding;
import static androidx.core.util.Preconditions.checkState;
+import static java.util.Collections.emptyMap;
import static java.util.Collections.singletonList;
import static java.util.Objects.requireNonNull;
@@ -145,6 +146,7 @@
import java.util.Collections;
import java.util.HashSet;
import java.util.Iterator;
+import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.Objects;
@@ -195,6 +197,7 @@
private boolean mHasCompensatingTransformation = false;
private @Nullable SourceStreamRequirementObserver mSourceStreamRequirementObserver;
private SessionConfig.@Nullable CloseableErrorListener mCloseableErrorListener;
+ private Map<Quality, List<Size>> mQualityToCustomSizesMap = emptyMap();
/**
* Create a VideoCapture associated with the given {@link VideoOutput}.
@@ -338,6 +341,44 @@
return getResolutionInfoInternal();
}
+ /**
+ * Returns the selected Quality.
+ *
+ * <p>The selected Quality represents the final quality level chosen for the stream. The
+ * selected Quality will be one of the specified qualities from the {@link QualitySelector}
+ * provided by the associated {@link VideoOutput}. If {@link Quality#HIGHEST} or
+ * {@link Quality#LOWEST} is specified in the selector, it will be resolved to an actual
+ * Quality value. Even if the stream is later cropped (e.g., by using a {@link ViewPort}), this
+ * value represents the original quality level of the stream.
+ *
+ * <p>This method will return the selected Quality only after the use case is bound using
+ * {@link androidx.camera.lifecycle.ProcessCameraProvider#bindToLifecycle}. Otherwise, it
+ * will return null. The selected Quality may change if the use case is unbound and then
+ * rebound.
+ *
+ * @return The selected Quality if the use case is bound, or null otherwise.
+ */
+ public @Nullable Quality getSelectedQuality() {
+ StreamSpec streamSpec = getAttachedStreamSpec();
+ if (streamSpec == null) {
+ return null;
+ }
+ // In the general case, there should be an exact match from configured resolution to
+ // Quality.
+ Size configuredResolution = streamSpec.getOriginalConfiguredResolution();
+ for (Map.Entry<Quality, List<Size>> entry : mQualityToCustomSizesMap.entrySet()) {
+ if (entry.getValue().contains(configuredResolution)) {
+ return entry.getKey(); // Found exact match, no need to check further
+ }
+ }
+ Logger.w(TAG, "Can't find matched Quality for " + configuredResolution);
+
+ // Fallback to find the nearest available quality. This can occur when StreamSharing
+ // is unable to downscale/crop the camera stream according to the UseCase's preferred
+ // resolution and instead returns the original camera stream resolution.
+ return findNearestSizeFor(mQualityToCustomSizesMap, configuredResolution);
+ }
+
@RestrictTo(Scope.LIBRARY_GROUP)
@Override
protected @Nullable ResolutionInfo getResolutionInfoInternal() {
@@ -1456,64 +1497,83 @@
requestedDynamicRange);
QualityRatioToResolutionsTable qualityRatioTable = new QualityRatioToResolutionsTable(
cameraInfo.getSupportedResolutions(getImageFormat()), supportedQualityToSizeMap);
- List<Size> customOrderedResolutions = new ArrayList<>();
+ // Use LinkedHashMap to maintain the order.
+ LinkedHashMap<Quality, List<Size>> orderedQualityToSizesMap = new LinkedHashMap<>();
for (Quality selectedQuality : selectedQualities) {
- customOrderedResolutions.addAll(
+ orderedQualityToSizesMap.put(selectedQuality,
qualityRatioTable.getResolutions(selectedQuality, aspectRatio));
}
- List<Size> filteredCustomOrderedResolutions = filterOutEncoderUnsupportedResolutions(
- (VideoCaptureConfig<T>) builder.getUseCaseConfig(), mediaSpec,
- requestedDynamicRange, videoCapabilities, customOrderedResolutions,
- supportedQualityToSizeMap);
+ LinkedHashMap<Quality, List<Size>> filteredOrderedQualityToSizesMap =
+ filterOutEncoderUnsupportedResolutions(
+ (VideoCaptureConfig<T>) builder.getUseCaseConfig(), mediaSpec,
+ requestedDynamicRange, videoCapabilities, orderedQualityToSizesMap,
+ supportedQualityToSizeMap);
+ List<Size> filteredCustomOrderedResolutions = new ArrayList<>();
+ for (List<Size> resolutions : filteredOrderedQualityToSizesMap.values()) {
+ filteredCustomOrderedResolutions.addAll(resolutions);
+ }
Logger.d(TAG, "Set custom ordered resolutions = " + filteredCustomOrderedResolutions);
builder.getMutableConfig().insertOption(OPTION_CUSTOM_ORDERED_RESOLUTIONS,
filteredCustomOrderedResolutions);
+ mQualityToCustomSizesMap = filteredOrderedQualityToSizesMap;
}
- private static @NonNull List<Size> filterOutEncoderUnsupportedResolutions(
+ private static @NonNull LinkedHashMap<Quality, List<Size>>
+ filterOutEncoderUnsupportedResolutions(
@NonNull VideoCaptureConfig<?> config,
@NonNull MediaSpec mediaSpec,
@NonNull DynamicRange dynamicRange,
@NonNull VideoCapabilities videoCapabilities,
- @NonNull List<Size> resolutions,
+ @NonNull LinkedHashMap<Quality, List<Size>> qualityToSizesOrderedMap,
@NonNull Map<Quality, Size> supportedQualityToSizeMap
) {
- if (resolutions.isEmpty()) {
- return resolutions;
+ if (qualityToSizesOrderedMap.isEmpty()) {
+ return new LinkedHashMap<>();
}
- Iterator<Size> iterator = resolutions.iterator();
- while (iterator.hasNext()) {
- Size resolution = iterator.next();
- // To improve performance, there is no need to check for supported qualities'
- // resolutions because the encoder should support them.
- if (supportedQualityToSizeMap.containsValue(resolution)) {
- continue;
+ LinkedHashMap<Quality, List<Size>> filteredQualityToSizesOrderedMap = new LinkedHashMap<>();
+ for (Map.Entry<Quality, List<Size>> entry : qualityToSizesOrderedMap.entrySet()) {
+ // Copy the size list first and filter out the unsupported resolutions.
+ List<Size> filteredSizeList = new ArrayList<>(entry.getValue());
+ Iterator<Size> sizeIterator = filteredSizeList.iterator();
+ while (sizeIterator.hasNext()) {
+ Size resolution = sizeIterator.next();
+ // To improve performance, there is no need to check for supported qualities'
+ // resolutions because the encoder should support them.
+ if (supportedQualityToSizeMap.containsValue(resolution)) {
+ continue;
+ }
+ // We must find EncoderProfiles for each resolution because the EncoderProfiles
+ // found by resolution may contain different video mine type which leads to
+ // different codec.
+ VideoValidatedEncoderProfilesProxy encoderProfiles =
+ videoCapabilities.findNearestHigherSupportedEncoderProfilesFor(resolution,
+ dynamicRange);
+ if (encoderProfiles == null) {
+ continue;
+ }
+ // If the user set a non-fully specified target DynamicRange, there could be
+ // multiple videoProfiles that matches to the DynamicRange. Find the one with the
+ // largest supported size as a workaround.
+ // If the suggested StreamSpec(i.e. DynamicRange + resolution) is unfortunately over
+ // codec supported size, then rely on surface processing (OpenGL) to resize the
+ // camera stream.
+ VideoEncoderInfo videoEncoderInfo = findLargestSupportedSizeVideoEncoderInfo(
+ config.getVideoEncoderInfoFinder(), encoderProfiles, dynamicRange,
+ mediaSpec, resolution,
+ requireNonNull(config.getTargetFrameRate(Defaults.DEFAULT_FPS_RANGE)));
+ if (videoEncoderInfo != null && !videoEncoderInfo.isSizeSupportedAllowSwapping(
+ resolution.getWidth(), resolution.getHeight())) {
+ sizeIterator.remove();
+ }
}
- // We must find EncoderProfiles for each resolution because the EncoderProfiles found
- // by resolution may contain different video mine type which leads to different codec.
- VideoValidatedEncoderProfilesProxy encoderProfiles =
- videoCapabilities.findNearestHigherSupportedEncoderProfilesFor(resolution,
- dynamicRange);
- if (encoderProfiles == null) {
- continue;
- }
- // If the user set a non-fully specified target DynamicRange, there could be multiple
- // videoProfiles that matches to the DynamicRange. Find the one with the largest
- // supported size as a workaround.
- // If the suggested StreamSpec(i.e. DynamicRange + resolution) is unfortunately over
- // codec supported size, then rely on surface processing (OpenGL) to resize the
- // camera stream.
- VideoEncoderInfo videoEncoderInfo = findLargestSupportedSizeVideoEncoderInfo(
- config.getVideoEncoderInfoFinder(), encoderProfiles, dynamicRange,
- mediaSpec, resolution,
- requireNonNull(config.getTargetFrameRate(Defaults.DEFAULT_FPS_RANGE)));
- if (videoEncoderInfo != null && !videoEncoderInfo.isSizeSupportedAllowSwapping(
- resolution.getWidth(), resolution.getHeight())) {
- iterator.remove();
+
+ // Put the filtered size list only when it is not empty.
+ if (!filteredSizeList.isEmpty()) {
+ filteredQualityToSizesOrderedMap.put(entry.getKey(), filteredSizeList);
}
}
- return resolutions;
+ return filteredQualityToSizesOrderedMap;
}
private static @Nullable VideoEncoderInfo findLargestSupportedSizeVideoEncoderInfo(
@@ -1556,6 +1616,32 @@
}
/**
+ * Finds the Quality with the size closest to the target size based on area.
+ *
+ * @param sizeMap The map of Quality to a list of Size`s.
+ * @param targetSize The target size to compare against.
+ * @return The Quality with the closest size, or `null` if no match is found.
+ */
+ private static @Nullable Quality findNearestSizeFor(
+ @NonNull Map<Quality, List<Size>> sizeMap, @NonNull Size targetSize) {
+ int targetArea = getArea(targetSize);
+ Quality nearestQuality = null;
+ int minAreaDiff = Integer.MAX_VALUE;
+
+ for (Map.Entry<Quality, List<Size>> entry : sizeMap.entrySet()) {
+ for (Size size : entry.getValue()) {
+ int areaDiff = Math.abs(getArea(size) - targetArea);
+ if (areaDiff < minAreaDiff) {
+ minAreaDiff = areaDiff;
+ nearestQuality = entry.getKey();
+ }
+ }
+ }
+
+ return nearestQuality;
+ }
+
+ /**
* Gets the snapshot value of the given {@link Observable}.
*
* <p>Note: Set {@code valueIfMissing} to a non-{@code null} value doesn't mean the method
diff --git a/camera/camera-video/src/test/java/androidx/camera/video/VideoCaptureTest.kt b/camera/camera-video/src/test/java/androidx/camera/video/VideoCaptureTest.kt
index 4641453..f0387ef 100644
--- a/camera/camera-video/src/test/java/androidx/camera/video/VideoCaptureTest.kt
+++ b/camera/camera-video/src/test/java/androidx/camera/video/VideoCaptureTest.kt
@@ -1847,6 +1847,74 @@
)
}
+ @Test
+ fun verifySelectedQuality_matchConfiguredResolution() {
+ testSelectedQualityIsExpected(
+ streamSpecConfiguredResolution = RESOLUTION_720P,
+ qualitySelector = QualitySelector.fromOrderedList(listOf(FHD, HD, SD)),
+ expectedQuality = HD,
+ )
+ }
+
+ @Test
+ fun verifySelectedQuality_setHighestQuality_returnSpecificQuality() {
+ testSelectedQualityIsExpected(
+ streamSpecConfiguredResolution = RESOLUTION_1080P,
+ qualitySelector = QualitySelector.from(HIGHEST),
+ expectedQuality = FHD,
+ )
+ }
+
+ @Test
+ fun verifySelectedQuality_setLowestQuality_returnSpecificQuality() {
+ testSelectedQualityIsExpected(
+ streamSpecConfiguredResolution = RESOLUTION_480P,
+ qualitySelector = QualitySelector.from(LOWEST),
+ expectedQuality = SD,
+ )
+ }
+
+ @Test
+ fun verifySelectedQuality_configuredResolutionNotMatch_returnNearestQuality() {
+ testSelectedQualityIsExpected(
+ streamSpecConfiguredResolution = Size(1920, 1000),
+ qualitySelector = QualitySelector.fromOrderedList(listOf(FHD, HD, SD)),
+ expectedQuality = FHD,
+ )
+ }
+
+ private fun testSelectedQualityIsExpected(
+ streamSpecConfiguredResolution: Size,
+ streamSpecResolution: Size = streamSpecConfiguredResolution,
+ qualitySelector: QualitySelector,
+ profiles: Map<Int, EncoderProfilesProxy> = FULL_QUALITY_PROFILES_MAP,
+ videoCapabilities: VideoCapabilities = FULL_QUALITY_VIDEO_CAPABILITIES,
+ expectedQuality: Quality?
+ ) {
+ // Arrange.
+ setupCamera(profiles = profiles)
+ createCameraUseCaseAdapter()
+ setSuggestedStreamSpec(
+ resolution = streamSpecResolution,
+ originalConfiguredResolution = streamSpecConfiguredResolution
+ )
+ val videoOutput =
+ createVideoOutput(
+ videoCapabilities = videoCapabilities,
+ mediaSpec =
+ MediaSpec.builder()
+ .configureVideo { it.setQualitySelector(qualitySelector) }
+ .build()
+ )
+ val videoCapture = createVideoCapture(videoOutput = videoOutput)
+
+ // Act.
+ addAndAttachUseCases(videoCapture)
+
+ // Assert.
+ assertThat(videoCapture.selectedQuality).isEqualTo(expectedQuality)
+ }
+
private fun testResolutionInfoContainsExpected(
resolution: Size,
sensorRotationDegrees: Int,
@@ -2101,6 +2169,7 @@
private fun setSuggestedStreamSpec(
resolution: Size,
+ originalConfiguredResolution: Size? = null,
expectedFrameRate: Range<Int> = StreamSpec.FRAME_RATE_RANGE_UNSPECIFIED,
dynamicRange: DynamicRange? = null
) {
@@ -2109,6 +2178,9 @@
.apply {
setExpectedFrameRateRange(expectedFrameRate)
dynamicRange?.let { setDynamicRange(dynamicRange) }
+ originalConfiguredResolution?.let {
+ setOriginalConfiguredResolution(originalConfiguredResolution)
+ }
}
.build()
)
diff --git a/camera/camera-view/build.gradle b/camera/camera-view/build.gradle
index e1601f3..1d1f1e5 100644
--- a/camera/camera-view/build.gradle
+++ b/camera/camera-view/build.gradle
@@ -76,6 +76,8 @@
androidTestImplementation("androidx.test.espresso:espresso-core:3.3.0")
}
android {
+ compileSdk 35
+
lintOptions {
enable 'CameraXQuirksClassDetector'
}
diff --git a/camera/integration-tests/camerapipetestapp/build.gradle b/camera/integration-tests/camerapipetestapp/build.gradle
index a615ba4..6c49dbe 100644
--- a/camera/integration-tests/camerapipetestapp/build.gradle
+++ b/camera/integration-tests/camerapipetestapp/build.gradle
@@ -22,6 +22,8 @@
}
android {
+ compileSdk 35
+
defaultConfig {
applicationId = "androidx.camera.integration.camera2.pipe"
}
diff --git a/camera/integration-tests/coretestapp/build.gradle b/camera/integration-tests/coretestapp/build.gradle
index 9b27d74..4b9931e 100644
--- a/camera/integration-tests/coretestapp/build.gradle
+++ b/camera/integration-tests/coretestapp/build.gradle
@@ -21,6 +21,8 @@
}
android {
+ compileSdk 35
+
defaultConfig {
applicationId = "androidx.camera.integration.core"
diff --git a/camera/integration-tests/diagnosetestapp/build.gradle b/camera/integration-tests/diagnosetestapp/build.gradle
index 70a9f1d..2db2390 100644
--- a/camera/integration-tests/diagnosetestapp/build.gradle
+++ b/camera/integration-tests/diagnosetestapp/build.gradle
@@ -21,6 +21,8 @@
}
android {
+ compileSdk 35
+
defaultConfig {
applicationId = "androidx.camera.integration.diagnose"
}
diff --git a/camera/integration-tests/extensionstestapp/build.gradle b/camera/integration-tests/extensionstestapp/build.gradle
index c2c09a4..03e2990 100644
--- a/camera/integration-tests/extensionstestapp/build.gradle
+++ b/camera/integration-tests/extensionstestapp/build.gradle
@@ -31,6 +31,8 @@
}
android {
+ compileSdk 35
+
defaultConfig {
applicationId = "androidx.camera.integration.extensions"
}
diff --git a/camera/integration-tests/extensionstestapp/src/main/java/androidx/camera/integration/extensions/utils/PermissionUtil.kt b/camera/integration-tests/extensionstestapp/src/main/java/androidx/camera/integration/extensions/utils/PermissionUtil.kt
index 1ed34c4..0b1bd0b 100644
--- a/camera/integration-tests/extensionstestapp/src/main/java/androidx/camera/integration/extensions/utils/PermissionUtil.kt
+++ b/camera/integration-tests/extensionstestapp/src/main/java/androidx/camera/integration/extensions/utils/PermissionUtil.kt
@@ -88,7 +88,10 @@
return arrayOfNulls(0)
}
- if (info.requestedPermissions == null || info.requestedPermissions.isEmpty()) {
+ if (
+ info.requestedPermissions == null ||
+ (info.requestedPermissions as Array<out Any>).isEmpty()
+ ) {
return arrayOfNulls(0)
}
@@ -99,7 +102,8 @@
// READ_EXTERNAL_STORAGE will also be included if we specify WRITE_EXTERNAL_STORAGE
// requirement in AndroidManifest.xml. Therefore, also need to skip the permission check
// of READ_EXTERNAL_STORAGE.
- for (permission in info.requestedPermissions) {
+ val requestedPermissions = info.requestedPermissions as Array<out Any>
+ for (permission in requestedPermissions) {
if (
Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU &&
(Manifest.permission.WRITE_EXTERNAL_STORAGE == permission ||
@@ -108,7 +112,7 @@
continue
}
- requiredPermissions.add(permission)
+ requiredPermissions.add(permission.toString())
}
val permissions = requiredPermissions.toTypedArray<String?>()
diff --git a/camera/integration-tests/testingtestapp/build.gradle.kts b/camera/integration-tests/testingtestapp/build.gradle.kts
index e2c430a..3fbaddf 100644
--- a/camera/integration-tests/testingtestapp/build.gradle.kts
+++ b/camera/integration-tests/testingtestapp/build.gradle.kts
@@ -24,6 +24,8 @@
}
android {
+ compileSdk = 35
+
namespace = "androidx.camera.integration.testingtestapp"
defaultConfig {
diff --git a/camera/integration-tests/testingtestapp/src/main/java/androidx/camera/integration/testingtestapp/ui/theme/Theme.kt b/camera/integration-tests/testingtestapp/src/main/java/androidx/camera/integration/testingtestapp/ui/theme/Theme.kt
index 933cedc..44a8f40 100644
--- a/camera/integration-tests/testingtestapp/src/main/java/androidx/camera/integration/testingtestapp/ui/theme/Theme.kt
+++ b/camera/integration-tests/testingtestapp/src/main/java/androidx/camera/integration/testingtestapp/ui/theme/Theme.kt
@@ -50,6 +50,7 @@
*/
)
+@Suppress("DEPRECATION") // setStatusBarColor
@Composable
fun MultimoduleTemplateTheme(
darkTheme: Boolean = isSystemInDarkTheme(),
diff --git a/camera/integration-tests/timingtestapp/build.gradle b/camera/integration-tests/timingtestapp/build.gradle
index 43c8180..896b44b 100644
--- a/camera/integration-tests/timingtestapp/build.gradle
+++ b/camera/integration-tests/timingtestapp/build.gradle
@@ -21,6 +21,8 @@
}
android {
+ compileSdk 35
+
defaultConfig {
applicationId = "androidx.camera.integration.antelope"
versionCode 35
diff --git a/camera/integration-tests/timingtestapp/src/main/java/androidx/camera/integration/antelope/TestUtils.kt b/camera/integration-tests/timingtestapp/src/main/java/androidx/camera/integration/antelope/TestUtils.kt
index 0f01e34..af82a97 100644
--- a/camera/integration-tests/timingtestapp/src/main/java/androidx/camera/integration/antelope/TestUtils.kt
+++ b/camera/integration-tests/timingtestapp/src/main/java/androidx/camera/integration/antelope/TestUtils.kt
@@ -776,7 +776,7 @@
/** Return the version name of the Activity */
@Suppress("DEPRECATION")
-fun getVersionName(activity: MainActivity): String {
+fun getVersionName(activity: MainActivity): String? {
val packageInfo = activity.packageManager.getPackageInfo(activity.packageName, 0)
return packageInfo.versionName
}
diff --git a/camera/viewfinder/viewfinder-core/samples/build.gradle b/camera/viewfinder/viewfinder-core/samples/build.gradle
index 0baad03..4f7cd42 100644
--- a/camera/viewfinder/viewfinder-core/samples/build.gradle
+++ b/camera/viewfinder/viewfinder-core/samples/build.gradle
@@ -38,6 +38,7 @@
}
android {
+ compileSdk 35
namespace = "androidx.camera.viewfinder.core.samples"
}
diff --git a/car/app/app-samples/navigation/automotive/src/main/AndroidManifest.xml b/car/app/app-samples/navigation/automotive/src/main/AndroidManifest.xml
index 6678151..cd78f4d 100644
--- a/car/app/app-samples/navigation/automotive/src/main/AndroidManifest.xml
+++ b/car/app/app-samples/navigation/automotive/src/main/AndroidManifest.xml
@@ -58,7 +58,6 @@
<service
android:name="androidx.car.app.sample.navigation.common.car.NavigationCarAppService"
- android:foregroundServiceType="location"
android:exported="true">
<intent-filter>
diff --git a/car/app/app-samples/navigation/common/src/main/java/androidx/car/app/sample/navigation/common/car/ClusterSession.java b/car/app/app-samples/navigation/common/src/main/java/androidx/car/app/sample/navigation/common/car/ClusterSession.java
new file mode 100644
index 0000000..b6ac766
--- /dev/null
+++ b/car/app/app-samples/navigation/common/src/main/java/androidx/car/app/sample/navigation/common/car/ClusterSession.java
@@ -0,0 +1,110 @@
+/*
+ * Copyright (C) 2025 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT 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.car.app.sample.navigation.common.car;
+
+import android.content.Intent;
+import android.content.res.Configuration;
+import android.util.Log;
+
+import androidx.annotation.NonNull;
+import androidx.annotation.Nullable;
+import androidx.car.app.CarContext;
+import androidx.car.app.CarToast;
+import androidx.car.app.Screen;
+import androidx.car.app.ScreenManager;
+import androidx.car.app.Session;
+import androidx.car.app.model.Action;
+import androidx.car.app.model.CarIcon;
+import androidx.car.app.sample.navigation.common.R;
+import androidx.car.app.sample.navigation.common.model.Instruction;
+import androidx.car.app.sample.navigation.common.nav.NavigationService;
+import androidx.core.graphics.drawable.IconCompat;
+
+import java.util.List;
+
+/** Session class for the Navigation sample app. */
+class ClusterSession extends Session implements NavigationScreen.Listener {
+ static final String TAG = ClusterSession.class.getSimpleName();
+
+ @Nullable
+ NavigationScreen mNavigationScreen;
+
+ @Nullable
+ SurfaceRenderer mNavigationCarSurface;
+
+ // A reference to the navigation service used to get location updates and routing.
+ @Nullable
+ NavigationService mService;
+
+ @NonNull
+ Action mSettingsAction;
+
+ @Override
+ @NonNull
+ public Screen onCreateScreen(@NonNull Intent intent) {
+ Log.i(TAG, "In onCreateScreen()");
+
+ mSettingsAction =
+ new Action.Builder()
+ .setIcon(
+ new CarIcon.Builder(
+ IconCompat.createWithResource(
+ getCarContext(), R.drawable.ic_settings))
+ .build())
+ .setOnClickListener(
+ () -> {
+ getCarContext()
+ .getCarService(ScreenManager.class)
+ .push(new SettingsScreen(getCarContext()));
+ })
+ .build();
+
+ mNavigationCarSurface = new SurfaceRenderer(getCarContext(), getLifecycle());
+ mNavigationScreen =
+ new NavigationScreen(getCarContext(), mSettingsAction, this, mNavigationCarSurface);
+
+ String action = intent.getAction();
+ if (action != null && CarContext.ACTION_NAVIGATE.equals(action)) {
+ CarToast.makeText(
+ getCarContext(),
+ "Navigation intent: " + intent.getDataString(),
+ CarToast.LENGTH_LONG)
+ .show();
+ }
+
+ return mNavigationScreen;
+ }
+
+ @Override
+ public void onCarConfigurationChanged(@NonNull Configuration newConfiguration) {
+ mNavigationCarSurface.onCarConfigurationChanged();
+ }
+
+ @Override
+ public void executeScript(@NonNull List<Instruction> instructions) {
+ if (mService != null) {
+ mService.executeInstructions(instructions);
+ }
+ }
+
+ @Override
+ public void stopNavigation() {
+ if (mService != null) {
+ mService.stopNavigation();
+ }
+ }
+}
diff --git a/car/app/app-samples/navigation/common/src/main/java/androidx/car/app/sample/navigation/common/car/NavigationCarAppService.java b/car/app/app-samples/navigation/common/src/main/java/androidx/car/app/sample/navigation/common/car/NavigationCarAppService.java
index 0b88d64..2951eb8 100644
--- a/car/app/app-samples/navigation/common/src/main/java/androidx/car/app/sample/navigation/common/car/NavigationCarAppService.java
+++ b/car/app/app-samples/navigation/common/src/main/java/androidx/car/app/sample/navigation/common/car/NavigationCarAppService.java
@@ -16,11 +16,9 @@
package androidx.car.app.sample.navigation.common.car;
-import android.app.Notification;
import android.app.NotificationChannel;
import android.app.NotificationManager;
import android.content.pm.ApplicationInfo;
-import android.content.pm.ServiceInfo;
import android.net.Uri;
import android.os.Build;
@@ -28,11 +26,7 @@
import androidx.car.app.CarAppService;
import androidx.car.app.Session;
import androidx.car.app.SessionInfo;
-import androidx.car.app.sample.navigation.common.R;
import androidx.car.app.validation.HostValidator;
-import androidx.core.app.NotificationCompat;
-import androidx.lifecycle.DefaultLifecycleObserver;
-import androidx.lifecycle.LifecycleOwner;
/**
* Entry point for the templated app.
@@ -45,9 +39,6 @@
/** Navigation session channel id. */
public static final String CHANNEL_ID = "NavigationSessionChannel";
- /** The identifier for the notification displayed for the foreground service. */
- private static final int NOTIFICATION_ID = 97654321;
-
/** Create a deep link URL from the given deep link action. */
@NonNull
public static Uri createDeepLinkUri(@NonNull String deepLinkAction) {
@@ -59,36 +50,12 @@
@Override
@NonNull
public Session onCreateSession(@NonNull SessionInfo sessionInfo) {
- createNotificationChannel();
-
- // Turn the car app service into a foreground service in order to make sure we can use all
- // granted "while-in-use" permissions (e.g. location) in the app's process.
- // The "while-in-use" location permission is granted as long as there is a foreground
- // service running in a process in which location access takes place. Here, we set this
- // service, and not NavigationService (which runs only during navigation), as a
- // foreground service because we need location access even when not navigating. If
- // location access is needed only during navigation, we can set NavigationService as a
- // foreground service instead.
- // See https://developer.android.com/reference/com/google/android/libraries/car/app
- // /CarAppService#accessing-location for more details.
- if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.UPSIDE_DOWN_CAKE) {
- startForeground(NOTIFICATION_ID, getNotification(),
- ServiceInfo.FOREGROUND_SERVICE_TYPE_LOCATION);
+ if (sessionInfo.getDisplayType() == SessionInfo.DISPLAY_TYPE_CLUSTER) {
+ return new ClusterSession();
} else {
- startForeground(NOTIFICATION_ID, getNotification());
+ createNotificationChannel();
+ return new NavigationSession();
}
-
- NavigationSession session = new NavigationSession(sessionInfo);
- session.getLifecycle()
- .addObserver(
- new DefaultLifecycleObserver() {
- @Override
- public void onDestroy(@NonNull LifecycleOwner owner) {
- stopForeground(true);
- }
- });
-
- return session;
}
@NonNull
@@ -112,19 +79,4 @@
notificationManager.createNotificationChannel(serviceChannel);
}
}
-
- /** Returns the {@link NotificationCompat} used as part of the foreground service. */
- private Notification getNotification() {
- NotificationCompat.Builder builder =
- new NotificationCompat.Builder(this, CHANNEL_ID)
- .setContentTitle("Navigation App")
- .setContentText("App is running")
- .setSmallIcon(R.drawable.ic_launcher);
-
- if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
- builder.setChannelId(CHANNEL_ID);
- builder.setPriority(NotificationManager.IMPORTANCE_HIGH);
- }
- return builder.build();
- }
}
diff --git a/car/app/app-samples/navigation/common/src/main/java/androidx/car/app/sample/navigation/common/car/NavigationSession.java b/car/app/app-samples/navigation/common/src/main/java/androidx/car/app/sample/navigation/common/car/NavigationSession.java
index 7dc4b57..a67d1c7 100644
--- a/car/app/app-samples/navigation/common/src/main/java/androidx/car/app/sample/navigation/common/car/NavigationSession.java
+++ b/car/app/app-samples/navigation/common/src/main/java/androidx/car/app/sample/navigation/common/car/NavigationSession.java
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2021 The Android Open Source Project
+ * Copyright (C) 2025 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -37,7 +37,6 @@
import androidx.car.app.Screen;
import androidx.car.app.ScreenManager;
import androidx.car.app.Session;
-import androidx.car.app.SessionInfo;
import androidx.car.app.model.Action;
import androidx.car.app.model.CarIcon;
import androidx.car.app.model.Distance;
@@ -178,11 +177,9 @@
}
};
- NavigationSession(@NonNull SessionInfo sessionInfo) {
- if (sessionInfo.getDisplayType() == SessionInfo.DISPLAY_TYPE_MAIN) {
+ NavigationSession() {
Lifecycle lifecycle = getLifecycle();
lifecycle.addObserver(mLifeCycleObserver);
- }
}
@Override
diff --git a/car/app/app-samples/navigation/mobile/src/main/AndroidManifest.xml b/car/app/app-samples/navigation/mobile/src/main/AndroidManifest.xml
index 9ccbefa..26d1712 100644
--- a/car/app/app-samples/navigation/mobile/src/main/AndroidManifest.xml
+++ b/car/app/app-samples/navigation/mobile/src/main/AndroidManifest.xml
@@ -50,7 +50,6 @@
<service
android:name="androidx.car.app.sample.navigation.common.car.NavigationCarAppService"
- android:foregroundServiceType="location"
android:exported="true">
<intent-filter>
diff --git a/collection/collection-ktx/api/1.5.0-beta02.txt b/collection/collection-ktx/api/1.5.0-beta02.txt
new file mode 100644
index 0000000..e6f50d0
--- /dev/null
+++ b/collection/collection-ktx/api/1.5.0-beta02.txt
@@ -0,0 +1 @@
+// Signature format: 4.0
diff --git a/collection/collection-ktx/api/restricted_1.5.0-beta02.txt b/collection/collection-ktx/api/restricted_1.5.0-beta02.txt
new file mode 100644
index 0000000..e6f50d0
--- /dev/null
+++ b/collection/collection-ktx/api/restricted_1.5.0-beta02.txt
@@ -0,0 +1 @@
+// Signature format: 4.0
diff --git a/collection/collection/api/1.5.0-beta02.txt b/collection/collection/api/1.5.0-beta02.txt
new file mode 100644
index 0000000..1594610
--- /dev/null
+++ b/collection/collection/api/1.5.0-beta02.txt
@@ -0,0 +1,2394 @@
+// Signature format: 4.0
+package androidx.collection {
+
+ public class ArrayMap<K, V> extends androidx.collection.SimpleArrayMap<K!,V!> implements java.util.Map<K!,V!> {
+ ctor public ArrayMap();
+ ctor public ArrayMap(androidx.collection.SimpleArrayMap?);
+ ctor public ArrayMap(int);
+ method public boolean containsAll(java.util.Collection<? extends java.lang.Object!>);
+ method public boolean containsKey(Object?);
+ method public boolean containsValue(Object?);
+ method public java.util.Set<java.util.Map.Entry<K!,V!>!> entrySet();
+ method public V! get(Object?);
+ method public java.util.Set<K!> keySet();
+ method public void putAll(java.util.Map<? extends K!,? extends V!>);
+ method public V! remove(Object?);
+ method public boolean removeAll(java.util.Collection<? extends java.lang.Object!>);
+ method public boolean retainAll(java.util.Collection<? extends java.lang.Object!>);
+ method public java.util.Collection<V!> values();
+ }
+
+ public final class ArrayMapKt {
+ method public static inline <K, V> androidx.collection.ArrayMap<K,V> arrayMapOf();
+ method public static <K, V> androidx.collection.ArrayMap<K,V> arrayMapOf(kotlin.Pair<? extends K,? extends V>... pairs);
+ }
+
+ public final class ArraySet<E> implements java.util.Collection<E> kotlin.jvm.internal.markers.KMutableCollection kotlin.jvm.internal.markers.KMutableSet java.util.Set<E> {
+ ctor public ArraySet();
+ ctor public ArraySet(androidx.collection.ArraySet<? extends E>? set);
+ ctor public ArraySet(E[]? array);
+ ctor public ArraySet(optional int capacity);
+ ctor public ArraySet(java.util.Collection<? extends E>? set);
+ method public boolean add(E element);
+ method public void addAll(androidx.collection.ArraySet<? extends E> array);
+ method public boolean addAll(java.util.Collection<? extends E> elements);
+ method public void clear();
+ method public operator boolean contains(E element);
+ method public boolean containsAll(java.util.Collection<? extends E> elements);
+ method public void ensureCapacity(int minimumCapacity);
+ method public int getSize();
+ method public int indexOf(Object? key);
+ method public boolean isEmpty();
+ method public java.util.Iterator<E> iterator();
+ method public boolean remove(E element);
+ method public boolean removeAll(androidx.collection.ArraySet<? extends E> array);
+ method public boolean removeAll(java.util.Collection<? extends E> elements);
+ method public E removeAt(int index);
+ method public boolean retainAll(java.util.Collection<? extends E> elements);
+ method public Object?[] toArray();
+ method public <T> T[] toArray(T[] array);
+ method public E valueAt(int index);
+ property public int size;
+ }
+
+ public final class ArraySetKt {
+ method public static inline <T> androidx.collection.ArraySet<T> arraySetOf();
+ method public static <T> androidx.collection.ArraySet<T> arraySetOf(T... values);
+ }
+
+ public final class CircularArray<E> {
+ ctor public CircularArray();
+ ctor public CircularArray(optional int minCapacity);
+ method public void addFirst(E element);
+ method public void addLast(E element);
+ method public void clear();
+ method public operator E get(int index);
+ method public E getFirst();
+ method public E getLast();
+ method public boolean isEmpty();
+ method public E popFirst();
+ method public E popLast();
+ method public void removeFromEnd(int count);
+ method public void removeFromStart(int count);
+ method public int size();
+ property public final E first;
+ property public final E last;
+ }
+
+ public final class CircularIntArray {
+ ctor public CircularIntArray();
+ ctor public CircularIntArray(optional int minCapacity);
+ method public void addFirst(int element);
+ method public void addLast(int element);
+ method public void clear();
+ method public operator int get(int index);
+ method public int getFirst();
+ method public int getLast();
+ method public boolean isEmpty();
+ method public int popFirst();
+ method public int popLast();
+ method public void removeFromEnd(int count);
+ method public void removeFromStart(int count);
+ method public int size();
+ property public final int first;
+ property public final int last;
+ }
+
+ public abstract sealed class DoubleList {
+ method public final inline boolean any();
+ method public final inline boolean any(kotlin.jvm.functions.Function1<? super java.lang.Double,java.lang.Boolean> predicate);
+ method public final int binarySearch(int element);
+ method public final int binarySearch(int element, optional int fromIndex);
+ method public final int binarySearch(int element, optional int fromIndex, optional int toIndex);
+ method public final operator boolean contains(double element);
+ method public final boolean containsAll(androidx.collection.DoubleList elements);
+ method public final inline int count();
+ method public final inline int count(kotlin.jvm.functions.Function1<? super java.lang.Double,java.lang.Boolean> predicate);
+ method public final double elementAt(@IntRange(from=0L) int index);
+ method public final inline double elementAtOrElse(@IntRange(from=0L) int index, kotlin.jvm.functions.Function1<? super java.lang.Integer,java.lang.Double> defaultValue);
+ method public final double first();
+ method public final inline double first(kotlin.jvm.functions.Function1<? super java.lang.Double,java.lang.Boolean> predicate);
+ method public final inline <R> R fold(R initial, kotlin.jvm.functions.Function2<? super R,? super java.lang.Double,? extends R> operation);
+ method public final inline <R> R foldIndexed(R initial, kotlin.jvm.functions.Function3<? super java.lang.Integer,? super R,? super java.lang.Double,? extends R> operation);
+ method public final inline <R> R foldRight(R initial, kotlin.jvm.functions.Function2<? super java.lang.Double,? super R,? extends R> operation);
+ method public final inline <R> R foldRightIndexed(R initial, kotlin.jvm.functions.Function3<? super java.lang.Integer,? super java.lang.Double,? super R,? extends R> operation);
+ method public final inline void forEach(kotlin.jvm.functions.Function1<? super java.lang.Double,kotlin.Unit> block);
+ method public final inline void forEachIndexed(kotlin.jvm.functions.Function2<? super java.lang.Integer,? super java.lang.Double,kotlin.Unit> block);
+ method public final inline void forEachReversed(kotlin.jvm.functions.Function1<? super java.lang.Double,kotlin.Unit> block);
+ method public final inline void forEachReversedIndexed(kotlin.jvm.functions.Function2<? super java.lang.Integer,? super java.lang.Double,kotlin.Unit> block);
+ method public final operator double get(@IntRange(from=0L) int index);
+ method public final inline kotlin.ranges.IntRange getIndices();
+ method @IntRange(from=-1L) public final inline int getLastIndex();
+ method @IntRange(from=0L) public final inline int getSize();
+ method public final int indexOf(double element);
+ method public final inline int indexOfFirst(kotlin.jvm.functions.Function1<? super java.lang.Double,java.lang.Boolean> predicate);
+ method public final inline int indexOfLast(kotlin.jvm.functions.Function1<? super java.lang.Double,java.lang.Boolean> predicate);
+ method public final inline boolean isEmpty();
+ method public final inline boolean isNotEmpty();
+ method public final String joinToString();
+ method public final String joinToString(optional CharSequence separator);
+ method public final String joinToString(optional CharSequence separator, optional CharSequence prefix);
+ method public final String joinToString(optional CharSequence separator, optional CharSequence prefix, optional CharSequence postfix);
+ method public final String joinToString(optional CharSequence separator, optional CharSequence prefix, optional CharSequence postfix, optional int limit);
+ method public final String joinToString(optional CharSequence separator, optional CharSequence prefix, optional CharSequence postfix, optional int limit, optional CharSequence truncated);
+ method public final inline String joinToString(optional CharSequence separator, optional CharSequence prefix, optional CharSequence postfix, optional int limit, optional CharSequence truncated, kotlin.jvm.functions.Function1<? super java.lang.Double,? extends java.lang.CharSequence> transform);
+ method public final inline String joinToString(optional CharSequence separator, optional CharSequence prefix, optional CharSequence postfix, optional int limit, kotlin.jvm.functions.Function1<? super java.lang.Double,? extends java.lang.CharSequence> transform);
+ method public final inline String joinToString(optional CharSequence separator, optional CharSequence prefix, optional CharSequence postfix, kotlin.jvm.functions.Function1<? super java.lang.Double,? extends java.lang.CharSequence> transform);
+ method public final inline String joinToString(optional CharSequence separator, optional CharSequence prefix, kotlin.jvm.functions.Function1<? super java.lang.Double,? extends java.lang.CharSequence> transform);
+ method public final inline String joinToString(optional CharSequence separator, kotlin.jvm.functions.Function1<? super java.lang.Double,? extends java.lang.CharSequence> transform);
+ method public final inline String joinToString(kotlin.jvm.functions.Function1<? super java.lang.Double,? extends java.lang.CharSequence> transform);
+ method public final double last();
+ method public final inline double last(kotlin.jvm.functions.Function1<? super java.lang.Double,java.lang.Boolean> predicate);
+ method public final int lastIndexOf(double element);
+ method public final inline boolean none();
+ method public final inline boolean reversedAny(kotlin.jvm.functions.Function1<? super java.lang.Double,java.lang.Boolean> predicate);
+ property public final inline kotlin.ranges.IntRange indices;
+ property @IntRange(from=-1L) public final inline int lastIndex;
+ property @IntRange(from=0L) public final inline int size;
+ }
+
+ public final class DoubleListKt {
+ method public static inline androidx.collection.DoubleList buildDoubleList(int initialCapacity, kotlin.jvm.functions.Function1<? super androidx.collection.MutableDoubleList,kotlin.Unit> builderAction);
+ method public static inline androidx.collection.DoubleList buildDoubleList(kotlin.jvm.functions.Function1<? super androidx.collection.MutableDoubleList,kotlin.Unit> builderAction);
+ method public static androidx.collection.DoubleList doubleListOf();
+ method public static androidx.collection.DoubleList doubleListOf(double element1);
+ method public static androidx.collection.DoubleList doubleListOf(double element1, double element2);
+ method public static androidx.collection.DoubleList doubleListOf(double element1, double element2, double element3);
+ method public static androidx.collection.DoubleList doubleListOf(double... elements);
+ method public static androidx.collection.DoubleList emptyDoubleList();
+ method public static inline androidx.collection.MutableDoubleList mutableDoubleListOf();
+ method public static androidx.collection.MutableDoubleList mutableDoubleListOf(double element1);
+ method public static androidx.collection.MutableDoubleList mutableDoubleListOf(double element1, double element2);
+ method public static androidx.collection.MutableDoubleList mutableDoubleListOf(double element1, double element2, double element3);
+ method public static inline androidx.collection.MutableDoubleList mutableDoubleListOf(double... elements);
+ }
+
+ public abstract sealed class FloatFloatMap {
+ method public final inline boolean all(kotlin.jvm.functions.Function2<? super java.lang.Float,? super java.lang.Float,java.lang.Boolean> predicate);
+ method public final boolean any();
+ method public final inline boolean any(kotlin.jvm.functions.Function2<? super java.lang.Float,? super java.lang.Float,java.lang.Boolean> predicate);
+ method public final inline operator boolean contains(float key);
+ method public final boolean containsKey(float key);
+ method public final boolean containsValue(float value);
+ method public final int count();
+ method public final inline int count(kotlin.jvm.functions.Function2<? super java.lang.Float,? super java.lang.Float,java.lang.Boolean> predicate);
+ method public final inline void forEach(kotlin.jvm.functions.Function2<? super java.lang.Float,? super java.lang.Float,kotlin.Unit> block);
+ method public final inline void forEachKey(kotlin.jvm.functions.Function1<? super java.lang.Float,kotlin.Unit> block);
+ method public final inline void forEachValue(kotlin.jvm.functions.Function1<? super java.lang.Float,kotlin.Unit> block);
+ method public final operator float get(float key);
+ method public final int getCapacity();
+ method public final float getOrDefault(float key, float defaultValue);
+ method public final inline float getOrElse(float key, kotlin.jvm.functions.Function0<java.lang.Float> defaultValue);
+ method public final int getSize();
+ method public final boolean isEmpty();
+ method public final boolean isNotEmpty();
+ method public final String joinToString();
+ method public final String joinToString(optional CharSequence separator);
+ method public final String joinToString(optional CharSequence separator, optional CharSequence prefix);
+ method public final String joinToString(optional CharSequence separator, optional CharSequence prefix, optional CharSequence postfix);
+ method public final String joinToString(optional CharSequence separator, optional CharSequence prefix, optional CharSequence postfix, optional int limit);
+ method public final String joinToString(optional CharSequence separator, optional CharSequence prefix, optional CharSequence postfix, optional int limit, optional CharSequence truncated);
+ method public final inline String joinToString(optional CharSequence separator, optional CharSequence prefix, optional CharSequence postfix, optional int limit, optional CharSequence truncated, kotlin.jvm.functions.Function2<? super java.lang.Float,? super java.lang.Float,? extends java.lang.CharSequence> transform);
+ method public final inline String joinToString(optional CharSequence separator, optional CharSequence prefix, optional CharSequence postfix, optional int limit, kotlin.jvm.functions.Function2<? super java.lang.Float,? super java.lang.Float,? extends java.lang.CharSequence> transform);
+ method public final inline String joinToString(optional CharSequence separator, optional CharSequence prefix, optional CharSequence postfix, kotlin.jvm.functions.Function2<? super java.lang.Float,? super java.lang.Float,? extends java.lang.CharSequence> transform);
+ method public final inline String joinToString(optional CharSequence separator, optional CharSequence prefix, kotlin.jvm.functions.Function2<? super java.lang.Float,? super java.lang.Float,? extends java.lang.CharSequence> transform);
+ method public final inline String joinToString(optional CharSequence separator, kotlin.jvm.functions.Function2<? super java.lang.Float,? super java.lang.Float,? extends java.lang.CharSequence> transform);
+ method public final inline String joinToString(kotlin.jvm.functions.Function2<? super java.lang.Float,? super java.lang.Float,? extends java.lang.CharSequence> transform);
+ method public final boolean none();
+ property public final int capacity;
+ property public final int size;
+ }
+
+ public final class FloatFloatMapKt {
+ method public static inline androidx.collection.FloatFloatMap buildFloatFloatMap(int initialCapacity, kotlin.jvm.functions.Function1<? super androidx.collection.MutableFloatFloatMap,kotlin.Unit> builderAction);
+ method public static inline androidx.collection.FloatFloatMap buildFloatFloatMap(kotlin.jvm.functions.Function1<? super androidx.collection.MutableFloatFloatMap,kotlin.Unit> builderAction);
+ method public static androidx.collection.FloatFloatMap emptyFloatFloatMap();
+ method public static androidx.collection.FloatFloatMap floatFloatMapOf();
+ method public static androidx.collection.FloatFloatMap floatFloatMapOf(float key1, float value1);
+ method public static androidx.collection.FloatFloatMap floatFloatMapOf(float key1, float value1, float key2, float value2);
+ method public static androidx.collection.FloatFloatMap floatFloatMapOf(float key1, float value1, float key2, float value2, float key3, float value3);
+ method public static androidx.collection.FloatFloatMap floatFloatMapOf(float key1, float value1, float key2, float value2, float key3, float value3, float key4, float value4);
+ method public static androidx.collection.FloatFloatMap floatFloatMapOf(float key1, float value1, float key2, float value2, float key3, float value3, float key4, float value4, float key5, float value5);
+ method public static androidx.collection.MutableFloatFloatMap mutableFloatFloatMapOf();
+ method public static androidx.collection.MutableFloatFloatMap mutableFloatFloatMapOf(float key1, float value1);
+ method public static androidx.collection.MutableFloatFloatMap mutableFloatFloatMapOf(float key1, float value1, float key2, float value2);
+ method public static androidx.collection.MutableFloatFloatMap mutableFloatFloatMapOf(float key1, float value1, float key2, float value2, float key3, float value3);
+ method public static androidx.collection.MutableFloatFloatMap mutableFloatFloatMapOf(float key1, float value1, float key2, float value2, float key3, float value3, float key4, float value4);
+ method public static androidx.collection.MutableFloatFloatMap mutableFloatFloatMapOf(float key1, float value1, float key2, float value2, float key3, float value3, float key4, float value4, float key5, float value5);
+ }
+
+ @kotlin.jvm.JvmInline public final value class FloatFloatPair {
+ ctor public FloatFloatPair(float first, float second);
+ method public inline operator float component1();
+ method public inline operator float component2();
+ property public final inline float first;
+ property public final long packedValue;
+ property public final inline float second;
+ field public final long packedValue;
+ }
+
+ public abstract sealed class FloatIntMap {
+ method public final inline boolean all(kotlin.jvm.functions.Function2<? super java.lang.Float,? super java.lang.Integer,java.lang.Boolean> predicate);
+ method public final boolean any();
+ method public final inline boolean any(kotlin.jvm.functions.Function2<? super java.lang.Float,? super java.lang.Integer,java.lang.Boolean> predicate);
+ method public final inline operator boolean contains(float key);
+ method public final boolean containsKey(float key);
+ method public final boolean containsValue(int value);
+ method public final int count();
+ method public final inline int count(kotlin.jvm.functions.Function2<? super java.lang.Float,? super java.lang.Integer,java.lang.Boolean> predicate);
+ method public final inline void forEach(kotlin.jvm.functions.Function2<? super java.lang.Float,? super java.lang.Integer,kotlin.Unit> block);
+ method public final inline void forEachKey(kotlin.jvm.functions.Function1<? super java.lang.Float,kotlin.Unit> block);
+ method public final inline void forEachValue(kotlin.jvm.functions.Function1<? super java.lang.Integer,kotlin.Unit> block);
+ method public final operator int get(float key);
+ method public final int getCapacity();
+ method public final int getOrDefault(float key, int defaultValue);
+ method public final inline int getOrElse(float key, kotlin.jvm.functions.Function0<java.lang.Integer> defaultValue);
+ method public final int getSize();
+ method public final boolean isEmpty();
+ method public final boolean isNotEmpty();
+ method public final String joinToString();
+ method public final String joinToString(optional CharSequence separator);
+ method public final String joinToString(optional CharSequence separator, optional CharSequence prefix);
+ method public final String joinToString(optional CharSequence separator, optional CharSequence prefix, optional CharSequence postfix);
+ method public final String joinToString(optional CharSequence separator, optional CharSequence prefix, optional CharSequence postfix, optional int limit);
+ method public final String joinToString(optional CharSequence separator, optional CharSequence prefix, optional CharSequence postfix, optional int limit, optional CharSequence truncated);
+ method public final inline String joinToString(optional CharSequence separator, optional CharSequence prefix, optional CharSequence postfix, optional int limit, optional CharSequence truncated, kotlin.jvm.functions.Function2<? super java.lang.Float,? super java.lang.Integer,? extends java.lang.CharSequence> transform);
+ method public final inline String joinToString(optional CharSequence separator, optional CharSequence prefix, optional CharSequence postfix, optional int limit, kotlin.jvm.functions.Function2<? super java.lang.Float,? super java.lang.Integer,? extends java.lang.CharSequence> transform);
+ method public final inline String joinToString(optional CharSequence separator, optional CharSequence prefix, optional CharSequence postfix, kotlin.jvm.functions.Function2<? super java.lang.Float,? super java.lang.Integer,? extends java.lang.CharSequence> transform);
+ method public final inline String joinToString(optional CharSequence separator, optional CharSequence prefix, kotlin.jvm.functions.Function2<? super java.lang.Float,? super java.lang.Integer,? extends java.lang.CharSequence> transform);
+ method public final inline String joinToString(optional CharSequence separator, kotlin.jvm.functions.Function2<? super java.lang.Float,? super java.lang.Integer,? extends java.lang.CharSequence> transform);
+ method public final inline String joinToString(kotlin.jvm.functions.Function2<? super java.lang.Float,? super java.lang.Integer,? extends java.lang.CharSequence> transform);
+ method public final boolean none();
+ property public final int capacity;
+ property public final int size;
+ }
+
+ public final class FloatIntMapKt {
+ method public static inline androidx.collection.FloatIntMap buildFloatIntMap(int initialCapacity, kotlin.jvm.functions.Function1<? super androidx.collection.MutableFloatIntMap,kotlin.Unit> builderAction);
+ method public static inline androidx.collection.FloatIntMap buildFloatIntMap(kotlin.jvm.functions.Function1<? super androidx.collection.MutableFloatIntMap,kotlin.Unit> builderAction);
+ method public static androidx.collection.FloatIntMap emptyFloatIntMap();
+ method public static androidx.collection.FloatIntMap floatIntMapOf();
+ method public static androidx.collection.FloatIntMap floatIntMapOf(float key1, int value1);
+ method public static androidx.collection.FloatIntMap floatIntMapOf(float key1, int value1, float key2, int value2);
+ method public static androidx.collection.FloatIntMap floatIntMapOf(float key1, int value1, float key2, int value2, float key3, int value3);
+ method public static androidx.collection.FloatIntMap floatIntMapOf(float key1, int value1, float key2, int value2, float key3, int value3, float key4, int value4);
+ method public static androidx.collection.FloatIntMap floatIntMapOf(float key1, int value1, float key2, int value2, float key3, int value3, float key4, int value4, float key5, int value5);
+ method public static androidx.collection.MutableFloatIntMap mutableFloatIntMapOf();
+ method public static androidx.collection.MutableFloatIntMap mutableFloatIntMapOf(float key1, int value1);
+ method public static androidx.collection.MutableFloatIntMap mutableFloatIntMapOf(float key1, int value1, float key2, int value2);
+ method public static androidx.collection.MutableFloatIntMap mutableFloatIntMapOf(float key1, int value1, float key2, int value2, float key3, int value3);
+ method public static androidx.collection.MutableFloatIntMap mutableFloatIntMapOf(float key1, int value1, float key2, int value2, float key3, int value3, float key4, int value4);
+ method public static androidx.collection.MutableFloatIntMap mutableFloatIntMapOf(float key1, int value1, float key2, int value2, float key3, int value3, float key4, int value4, float key5, int value5);
+ }
+
+ public abstract sealed class FloatList {
+ method public final inline boolean any();
+ method public final inline boolean any(kotlin.jvm.functions.Function1<? super java.lang.Float,java.lang.Boolean> predicate);
+ method public final int binarySearch(int element);
+ method public final int binarySearch(int element, optional int fromIndex);
+ method public final int binarySearch(int element, optional int fromIndex, optional int toIndex);
+ method public final operator boolean contains(float element);
+ method public final boolean containsAll(androidx.collection.FloatList elements);
+ method public final inline int count();
+ method public final inline int count(kotlin.jvm.functions.Function1<? super java.lang.Float,java.lang.Boolean> predicate);
+ method public final float elementAt(@IntRange(from=0L) int index);
+ method public final inline float elementAtOrElse(@IntRange(from=0L) int index, kotlin.jvm.functions.Function1<? super java.lang.Integer,java.lang.Float> defaultValue);
+ method public final float first();
+ method public final inline float first(kotlin.jvm.functions.Function1<? super java.lang.Float,java.lang.Boolean> predicate);
+ method public final inline <R> R fold(R initial, kotlin.jvm.functions.Function2<? super R,? super java.lang.Float,? extends R> operation);
+ method public final inline <R> R foldIndexed(R initial, kotlin.jvm.functions.Function3<? super java.lang.Integer,? super R,? super java.lang.Float,? extends R> operation);
+ method public final inline <R> R foldRight(R initial, kotlin.jvm.functions.Function2<? super java.lang.Float,? super R,? extends R> operation);
+ method public final inline <R> R foldRightIndexed(R initial, kotlin.jvm.functions.Function3<? super java.lang.Integer,? super java.lang.Float,? super R,? extends R> operation);
+ method public final inline void forEach(kotlin.jvm.functions.Function1<? super java.lang.Float,kotlin.Unit> block);
+ method public final inline void forEachIndexed(kotlin.jvm.functions.Function2<? super java.lang.Integer,? super java.lang.Float,kotlin.Unit> block);
+ method public final inline void forEachReversed(kotlin.jvm.functions.Function1<? super java.lang.Float,kotlin.Unit> block);
+ method public final inline void forEachReversedIndexed(kotlin.jvm.functions.Function2<? super java.lang.Integer,? super java.lang.Float,kotlin.Unit> block);
+ method public final operator float get(@IntRange(from=0L) int index);
+ method public final inline kotlin.ranges.IntRange getIndices();
+ method @IntRange(from=-1L) public final inline int getLastIndex();
+ method @IntRange(from=0L) public final inline int getSize();
+ method public final int indexOf(float element);
+ method public final inline int indexOfFirst(kotlin.jvm.functions.Function1<? super java.lang.Float,java.lang.Boolean> predicate);
+ method public final inline int indexOfLast(kotlin.jvm.functions.Function1<? super java.lang.Float,java.lang.Boolean> predicate);
+ method public final inline boolean isEmpty();
+ method public final inline boolean isNotEmpty();
+ method public final String joinToString();
+ method public final String joinToString(optional CharSequence separator);
+ method public final String joinToString(optional CharSequence separator, optional CharSequence prefix);
+ method public final String joinToString(optional CharSequence separator, optional CharSequence prefix, optional CharSequence postfix);
+ method public final String joinToString(optional CharSequence separator, optional CharSequence prefix, optional CharSequence postfix, optional int limit);
+ method public final String joinToString(optional CharSequence separator, optional CharSequence prefix, optional CharSequence postfix, optional int limit, optional CharSequence truncated);
+ method public final inline String joinToString(optional CharSequence separator, optional CharSequence prefix, optional CharSequence postfix, optional int limit, optional CharSequence truncated, kotlin.jvm.functions.Function1<? super java.lang.Float,? extends java.lang.CharSequence> transform);
+ method public final inline String joinToString(optional CharSequence separator, optional CharSequence prefix, optional CharSequence postfix, optional int limit, kotlin.jvm.functions.Function1<? super java.lang.Float,? extends java.lang.CharSequence> transform);
+ method public final inline String joinToString(optional CharSequence separator, optional CharSequence prefix, optional CharSequence postfix, kotlin.jvm.functions.Function1<? super java.lang.Float,? extends java.lang.CharSequence> transform);
+ method public final inline String joinToString(optional CharSequence separator, optional CharSequence prefix, kotlin.jvm.functions.Function1<? super java.lang.Float,? extends java.lang.CharSequence> transform);
+ method public final inline String joinToString(optional CharSequence separator, kotlin.jvm.functions.Function1<? super java.lang.Float,? extends java.lang.CharSequence> transform);
+ method public final inline String joinToString(kotlin.jvm.functions.Function1<? super java.lang.Float,? extends java.lang.CharSequence> transform);
+ method public final float last();
+ method public final inline float last(kotlin.jvm.functions.Function1<? super java.lang.Float,java.lang.Boolean> predicate);
+ method public final int lastIndexOf(float element);
+ method public final inline boolean none();
+ method public final inline boolean reversedAny(kotlin.jvm.functions.Function1<? super java.lang.Float,java.lang.Boolean> predicate);
+ property public final inline kotlin.ranges.IntRange indices;
+ property @IntRange(from=-1L) public final inline int lastIndex;
+ property @IntRange(from=0L) public final inline int size;
+ }
+
+ public final class FloatListKt {
+ method public static inline androidx.collection.FloatList buildFloatList(int initialCapacity, kotlin.jvm.functions.Function1<? super androidx.collection.MutableFloatList,kotlin.Unit> builderAction);
+ method public static inline androidx.collection.FloatList buildFloatList(kotlin.jvm.functions.Function1<? super androidx.collection.MutableFloatList,kotlin.Unit> builderAction);
+ method public static androidx.collection.FloatList emptyFloatList();
+ method public static androidx.collection.FloatList floatListOf();
+ method public static androidx.collection.FloatList floatListOf(float element1);
+ method public static androidx.collection.FloatList floatListOf(float element1, float element2);
+ method public static androidx.collection.FloatList floatListOf(float element1, float element2, float element3);
+ method public static androidx.collection.FloatList floatListOf(float... elements);
+ method public static inline androidx.collection.MutableFloatList mutableFloatListOf();
+ method public static androidx.collection.MutableFloatList mutableFloatListOf(float element1);
+ method public static androidx.collection.MutableFloatList mutableFloatListOf(float element1, float element2);
+ method public static androidx.collection.MutableFloatList mutableFloatListOf(float element1, float element2, float element3);
+ method public static inline androidx.collection.MutableFloatList mutableFloatListOf(float... elements);
+ }
+
+ public abstract sealed class FloatLongMap {
+ method public final inline boolean all(kotlin.jvm.functions.Function2<? super java.lang.Float,? super java.lang.Long,java.lang.Boolean> predicate);
+ method public final boolean any();
+ method public final inline boolean any(kotlin.jvm.functions.Function2<? super java.lang.Float,? super java.lang.Long,java.lang.Boolean> predicate);
+ method public final inline operator boolean contains(float key);
+ method public final boolean containsKey(float key);
+ method public final boolean containsValue(long value);
+ method public final int count();
+ method public final inline int count(kotlin.jvm.functions.Function2<? super java.lang.Float,? super java.lang.Long,java.lang.Boolean> predicate);
+ method public final inline void forEach(kotlin.jvm.functions.Function2<? super java.lang.Float,? super java.lang.Long,kotlin.Unit> block);
+ method public final inline void forEachKey(kotlin.jvm.functions.Function1<? super java.lang.Float,kotlin.Unit> block);
+ method public final inline void forEachValue(kotlin.jvm.functions.Function1<? super java.lang.Long,kotlin.Unit> block);
+ method public final operator long get(float key);
+ method public final int getCapacity();
+ method public final long getOrDefault(float key, long defaultValue);
+ method public final inline long getOrElse(float key, kotlin.jvm.functions.Function0<java.lang.Long> defaultValue);
+ method public final int getSize();
+ method public final boolean isEmpty();
+ method public final boolean isNotEmpty();
+ method public final String joinToString();
+ method public final String joinToString(optional CharSequence separator);
+ method public final String joinToString(optional CharSequence separator, optional CharSequence prefix);
+ method public final String joinToString(optional CharSequence separator, optional CharSequence prefix, optional CharSequence postfix);
+ method public final String joinToString(optional CharSequence separator, optional CharSequence prefix, optional CharSequence postfix, optional int limit);
+ method public final String joinToString(optional CharSequence separator, optional CharSequence prefix, optional CharSequence postfix, optional int limit, optional CharSequence truncated);
+ method public final inline String joinToString(optional CharSequence separator, optional CharSequence prefix, optional CharSequence postfix, optional int limit, optional CharSequence truncated, kotlin.jvm.functions.Function2<? super java.lang.Float,? super java.lang.Long,? extends java.lang.CharSequence> transform);
+ method public final inline String joinToString(optional CharSequence separator, optional CharSequence prefix, optional CharSequence postfix, optional int limit, kotlin.jvm.functions.Function2<? super java.lang.Float,? super java.lang.Long,? extends java.lang.CharSequence> transform);
+ method public final inline String joinToString(optional CharSequence separator, optional CharSequence prefix, optional CharSequence postfix, kotlin.jvm.functions.Function2<? super java.lang.Float,? super java.lang.Long,? extends java.lang.CharSequence> transform);
+ method public final inline String joinToString(optional CharSequence separator, optional CharSequence prefix, kotlin.jvm.functions.Function2<? super java.lang.Float,? super java.lang.Long,? extends java.lang.CharSequence> transform);
+ method public final inline String joinToString(optional CharSequence separator, kotlin.jvm.functions.Function2<? super java.lang.Float,? super java.lang.Long,? extends java.lang.CharSequence> transform);
+ method public final inline String joinToString(kotlin.jvm.functions.Function2<? super java.lang.Float,? super java.lang.Long,? extends java.lang.CharSequence> transform);
+ method public final boolean none();
+ property public final int capacity;
+ property public final int size;
+ }
+
+ public final class FloatLongMapKt {
+ method public static inline androidx.collection.FloatLongMap buildFloatLongMap(int initialCapacity, kotlin.jvm.functions.Function1<? super androidx.collection.MutableFloatLongMap,kotlin.Unit> builderAction);
+ method public static inline androidx.collection.FloatLongMap buildFloatLongMap(kotlin.jvm.functions.Function1<? super androidx.collection.MutableFloatLongMap,kotlin.Unit> builderAction);
+ method public static androidx.collection.FloatLongMap emptyFloatLongMap();
+ method public static androidx.collection.FloatLongMap floatLongMapOf();
+ method public static androidx.collection.FloatLongMap floatLongMapOf(float key1, long value1);
+ method public static androidx.collection.FloatLongMap floatLongMapOf(float key1, long value1, float key2, long value2);
+ method public static androidx.collection.FloatLongMap floatLongMapOf(float key1, long value1, float key2, long value2, float key3, long value3);
+ method public static androidx.collection.FloatLongMap floatLongMapOf(float key1, long value1, float key2, long value2, float key3, long value3, float key4, long value4);
+ method public static androidx.collection.FloatLongMap floatLongMapOf(float key1, long value1, float key2, long value2, float key3, long value3, float key4, long value4, float key5, long value5);
+ method public static androidx.collection.MutableFloatLongMap mutableFloatLongMapOf();
+ method public static androidx.collection.MutableFloatLongMap mutableFloatLongMapOf(float key1, long value1);
+ method public static androidx.collection.MutableFloatLongMap mutableFloatLongMapOf(float key1, long value1, float key2, long value2);
+ method public static androidx.collection.MutableFloatLongMap mutableFloatLongMapOf(float key1, long value1, float key2, long value2, float key3, long value3);
+ method public static androidx.collection.MutableFloatLongMap mutableFloatLongMapOf(float key1, long value1, float key2, long value2, float key3, long value3, float key4, long value4);
+ method public static androidx.collection.MutableFloatLongMap mutableFloatLongMapOf(float key1, long value1, float key2, long value2, float key3, long value3, float key4, long value4, float key5, long value5);
+ }
+
+ public abstract sealed class FloatObjectMap<V> {
+ method public final inline boolean all(kotlin.jvm.functions.Function2<? super java.lang.Float,? super V,java.lang.Boolean> predicate);
+ method public final boolean any();
+ method public final inline boolean any(kotlin.jvm.functions.Function2<? super java.lang.Float,? super V,java.lang.Boolean> predicate);
+ method public final inline operator boolean contains(float key);
+ method public final boolean containsKey(float key);
+ method public final boolean containsValue(V value);
+ method public final int count();
+ method public final inline int count(kotlin.jvm.functions.Function2<? super java.lang.Float,? super V,java.lang.Boolean> predicate);
+ method public final inline void forEach(kotlin.jvm.functions.Function2<? super java.lang.Float,? super V,kotlin.Unit> block);
+ method public final inline void forEachKey(kotlin.jvm.functions.Function1<? super java.lang.Float,kotlin.Unit> block);
+ method public final inline void forEachValue(kotlin.jvm.functions.Function1<? super V,kotlin.Unit> block);
+ method public final operator V? get(float key);
+ method public final int getCapacity();
+ method public final V getOrDefault(float key, V defaultValue);
+ method public final inline V getOrElse(float key, kotlin.jvm.functions.Function0<? extends V> defaultValue);
+ method public final int getSize();
+ method public final boolean isEmpty();
+ method public final boolean isNotEmpty();
+ method public final String joinToString();
+ method public final String joinToString(optional CharSequence separator);
+ method public final String joinToString(optional CharSequence separator, optional CharSequence prefix);
+ method public final String joinToString(optional CharSequence separator, optional CharSequence prefix, optional CharSequence postfix);
+ method public final String joinToString(optional CharSequence separator, optional CharSequence prefix, optional CharSequence postfix, optional int limit);
+ method public final String joinToString(optional CharSequence separator, optional CharSequence prefix, optional CharSequence postfix, optional int limit, optional CharSequence truncated);
+ method public final inline String joinToString(optional CharSequence separator, optional CharSequence prefix, optional CharSequence postfix, optional int limit, optional CharSequence truncated, kotlin.jvm.functions.Function2<? super java.lang.Float,? super V,? extends java.lang.CharSequence> transform);
+ method public final inline String joinToString(optional CharSequence separator, optional CharSequence prefix, optional CharSequence postfix, optional int limit, kotlin.jvm.functions.Function2<? super java.lang.Float,? super V,? extends java.lang.CharSequence> transform);
+ method public final inline String joinToString(optional CharSequence separator, optional CharSequence prefix, optional CharSequence postfix, kotlin.jvm.functions.Function2<? super java.lang.Float,? super V,? extends java.lang.CharSequence> transform);
+ method public final inline String joinToString(optional CharSequence separator, optional CharSequence prefix, kotlin.jvm.functions.Function2<? super java.lang.Float,? super V,? extends java.lang.CharSequence> transform);
+ method public final inline String joinToString(optional CharSequence separator, kotlin.jvm.functions.Function2<? super java.lang.Float,? super V,? extends java.lang.CharSequence> transform);
+ method public final inline String joinToString(kotlin.jvm.functions.Function2<? super java.lang.Float,? super V,? extends java.lang.CharSequence> transform);
+ method public final boolean none();
+ property public final int capacity;
+ property public final int size;
+ }
+
+ public final class FloatObjectMapKt {
+ method public static inline <V> androidx.collection.FloatObjectMap<V> buildFloatObjectMap(int initialCapacity, kotlin.jvm.functions.Function1<? super androidx.collection.MutableFloatObjectMap<V>,kotlin.Unit> builderAction);
+ method public static inline <V> androidx.collection.FloatObjectMap<V> buildFloatObjectMap(kotlin.jvm.functions.Function1<? super androidx.collection.MutableFloatObjectMap<V>,kotlin.Unit> builderAction);
+ method public static <V> androidx.collection.FloatObjectMap<V> emptyFloatObjectMap();
+ method public static <V> androidx.collection.FloatObjectMap<V> floatObjectMapOf();
+ method public static <V> androidx.collection.FloatObjectMap<V> floatObjectMapOf(float key1, V value1);
+ method public static <V> androidx.collection.FloatObjectMap<V> floatObjectMapOf(float key1, V value1, float key2, V value2);
+ method public static <V> androidx.collection.FloatObjectMap<V> floatObjectMapOf(float key1, V value1, float key2, V value2, float key3, V value3);
+ method public static <V> androidx.collection.FloatObjectMap<V> floatObjectMapOf(float key1, V value1, float key2, V value2, float key3, V value3, float key4, V value4);
+ method public static <V> androidx.collection.FloatObjectMap<V> floatObjectMapOf(float key1, V value1, float key2, V value2, float key3, V value3, float key4, V value4, float key5, V value5);
+ method public static <V> androidx.collection.MutableFloatObjectMap<V> mutableFloatObjectMapOf();
+ method public static <V> androidx.collection.MutableFloatObjectMap<V> mutableFloatObjectMapOf(float key1, V value1);
+ method public static <V> androidx.collection.MutableFloatObjectMap<V> mutableFloatObjectMapOf(float key1, V value1, float key2, V value2);
+ method public static <V> androidx.collection.MutableFloatObjectMap<V> mutableFloatObjectMapOf(float key1, V value1, float key2, V value2, float key3, V value3);
+ method public static <V> androidx.collection.MutableFloatObjectMap<V> mutableFloatObjectMapOf(float key1, V value1, float key2, V value2, float key3, V value3, float key4, V value4);
+ method public static <V> androidx.collection.MutableFloatObjectMap<V> mutableFloatObjectMapOf(float key1, V value1, float key2, V value2, float key3, V value3, float key4, V value4, float key5, V value5);
+ }
+
+ public abstract sealed class FloatSet {
+ method public final inline boolean all(kotlin.jvm.functions.Function1<? super java.lang.Float,java.lang.Boolean> predicate);
+ method public final boolean any();
+ method public final inline boolean any(kotlin.jvm.functions.Function1<? super java.lang.Float,java.lang.Boolean> predicate);
+ method public final operator boolean contains(float element);
+ method @IntRange(from=0L) public final int count();
+ method @IntRange(from=0L) public final inline int count(kotlin.jvm.functions.Function1<? super java.lang.Float,java.lang.Boolean> predicate);
+ method public final inline float first();
+ method public final inline float first(kotlin.jvm.functions.Function1<? super java.lang.Float,java.lang.Boolean> predicate);
+ method public final inline void forEach(kotlin.jvm.functions.Function1<? super java.lang.Float,kotlin.Unit> block);
+ method @IntRange(from=0L) public final int getCapacity();
+ method @IntRange(from=0L) public final int getSize();
+ method public final boolean isEmpty();
+ method public final boolean isNotEmpty();
+ method public final String joinToString();
+ method public final String joinToString(optional CharSequence separator);
+ method public final String joinToString(optional CharSequence separator, optional CharSequence prefix);
+ method public final String joinToString(optional CharSequence separator, optional CharSequence prefix, optional CharSequence postfix);
+ method public final String joinToString(optional CharSequence separator, optional CharSequence prefix, optional CharSequence postfix, optional int limit);
+ method public final String joinToString(optional CharSequence separator, optional CharSequence prefix, optional CharSequence postfix, optional int limit, optional CharSequence truncated);
+ method public final inline String joinToString(optional CharSequence separator, optional CharSequence prefix, optional CharSequence postfix, optional int limit, optional CharSequence truncated, kotlin.jvm.functions.Function1<? super java.lang.Float,? extends java.lang.CharSequence> transform);
+ method public final inline String joinToString(optional CharSequence separator, optional CharSequence prefix, optional CharSequence postfix, optional int limit, kotlin.jvm.functions.Function1<? super java.lang.Float,? extends java.lang.CharSequence> transform);
+ method public final inline String joinToString(optional CharSequence separator, optional CharSequence prefix, optional CharSequence postfix, kotlin.jvm.functions.Function1<? super java.lang.Float,? extends java.lang.CharSequence> transform);
+ method public final inline String joinToString(optional CharSequence separator, optional CharSequence prefix, kotlin.jvm.functions.Function1<? super java.lang.Float,? extends java.lang.CharSequence> transform);
+ method public final inline String joinToString(optional CharSequence separator, kotlin.jvm.functions.Function1<? super java.lang.Float,? extends java.lang.CharSequence> transform);
+ method public final inline String joinToString(kotlin.jvm.functions.Function1<? super java.lang.Float,? extends java.lang.CharSequence> transform);
+ method public final boolean none();
+ property @IntRange(from=0L) public final int capacity;
+ property @IntRange(from=0L) public final int size;
+ }
+
+ public final class FloatSetKt {
+ method public static inline androidx.collection.FloatSet buildFloatSet(int initialCapacity, kotlin.jvm.functions.Function1<? super androidx.collection.MutableFloatSet,kotlin.Unit> builderAction);
+ method public static inline androidx.collection.FloatSet buildFloatSet(kotlin.jvm.functions.Function1<? super androidx.collection.MutableFloatSet,kotlin.Unit> builderAction);
+ method public static androidx.collection.FloatSet emptyFloatSet();
+ method public static androidx.collection.FloatSet floatSetOf();
+ method public static androidx.collection.FloatSet floatSetOf(float element1);
+ method public static androidx.collection.FloatSet floatSetOf(float element1, float element2);
+ method public static androidx.collection.FloatSet floatSetOf(float element1, float element2, float element3);
+ method public static androidx.collection.FloatSet floatSetOf(float... elements);
+ method public static androidx.collection.MutableFloatSet mutableFloatSetOf();
+ method public static androidx.collection.MutableFloatSet mutableFloatSetOf(float element1);
+ method public static androidx.collection.MutableFloatSet mutableFloatSetOf(float element1, float element2);
+ method public static androidx.collection.MutableFloatSet mutableFloatSetOf(float element1, float element2, float element3);
+ method public static androidx.collection.MutableFloatSet mutableFloatSetOf(float... elements);
+ }
+
+ public abstract sealed class IntFloatMap {
+ method public final inline boolean all(kotlin.jvm.functions.Function2<? super java.lang.Integer,? super java.lang.Float,java.lang.Boolean> predicate);
+ method public final boolean any();
+ method public final inline boolean any(kotlin.jvm.functions.Function2<? super java.lang.Integer,? super java.lang.Float,java.lang.Boolean> predicate);
+ method public final inline operator boolean contains(int key);
+ method public final boolean containsKey(int key);
+ method public final boolean containsValue(float value);
+ method public final int count();
+ method public final inline int count(kotlin.jvm.functions.Function2<? super java.lang.Integer,? super java.lang.Float,java.lang.Boolean> predicate);
+ method public final inline void forEach(kotlin.jvm.functions.Function2<? super java.lang.Integer,? super java.lang.Float,kotlin.Unit> block);
+ method public final inline void forEachKey(kotlin.jvm.functions.Function1<? super java.lang.Integer,kotlin.Unit> block);
+ method public final inline void forEachValue(kotlin.jvm.functions.Function1<? super java.lang.Float,kotlin.Unit> block);
+ method public final operator float get(int key);
+ method public final int getCapacity();
+ method public final float getOrDefault(int key, float defaultValue);
+ method public final inline float getOrElse(int key, kotlin.jvm.functions.Function0<java.lang.Float> defaultValue);
+ method public final int getSize();
+ method public final boolean isEmpty();
+ method public final boolean isNotEmpty();
+ method public final String joinToString();
+ method public final String joinToString(optional CharSequence separator);
+ method public final String joinToString(optional CharSequence separator, optional CharSequence prefix);
+ method public final String joinToString(optional CharSequence separator, optional CharSequence prefix, optional CharSequence postfix);
+ method public final String joinToString(optional CharSequence separator, optional CharSequence prefix, optional CharSequence postfix, optional int limit);
+ method public final String joinToString(optional CharSequence separator, optional CharSequence prefix, optional CharSequence postfix, optional int limit, optional CharSequence truncated);
+ method public final inline String joinToString(optional CharSequence separator, optional CharSequence prefix, optional CharSequence postfix, optional int limit, optional CharSequence truncated, kotlin.jvm.functions.Function2<? super java.lang.Integer,? super java.lang.Float,? extends java.lang.CharSequence> transform);
+ method public final inline String joinToString(optional CharSequence separator, optional CharSequence prefix, optional CharSequence postfix, optional int limit, kotlin.jvm.functions.Function2<? super java.lang.Integer,? super java.lang.Float,? extends java.lang.CharSequence> transform);
+ method public final inline String joinToString(optional CharSequence separator, optional CharSequence prefix, optional CharSequence postfix, kotlin.jvm.functions.Function2<? super java.lang.Integer,? super java.lang.Float,? extends java.lang.CharSequence> transform);
+ method public final inline String joinToString(optional CharSequence separator, optional CharSequence prefix, kotlin.jvm.functions.Function2<? super java.lang.Integer,? super java.lang.Float,? extends java.lang.CharSequence> transform);
+ method public final inline String joinToString(optional CharSequence separator, kotlin.jvm.functions.Function2<? super java.lang.Integer,? super java.lang.Float,? extends java.lang.CharSequence> transform);
+ method public final inline String joinToString(kotlin.jvm.functions.Function2<? super java.lang.Integer,? super java.lang.Float,? extends java.lang.CharSequence> transform);
+ method public final boolean none();
+ property public final int capacity;
+ property public final int size;
+ }
+
+ public final class IntFloatMapKt {
+ method public static inline androidx.collection.IntFloatMap buildIntFloatMap(int initialCapacity, kotlin.jvm.functions.Function1<? super androidx.collection.MutableIntFloatMap,kotlin.Unit> builderAction);
+ method public static inline androidx.collection.IntFloatMap buildIntFloatMap(kotlin.jvm.functions.Function1<? super androidx.collection.MutableIntFloatMap,kotlin.Unit> builderAction);
+ method public static androidx.collection.IntFloatMap emptyIntFloatMap();
+ method public static androidx.collection.IntFloatMap intFloatMapOf();
+ method public static androidx.collection.IntFloatMap intFloatMapOf(int key1, float value1);
+ method public static androidx.collection.IntFloatMap intFloatMapOf(int key1, float value1, int key2, float value2);
+ method public static androidx.collection.IntFloatMap intFloatMapOf(int key1, float value1, int key2, float value2, int key3, float value3);
+ method public static androidx.collection.IntFloatMap intFloatMapOf(int key1, float value1, int key2, float value2, int key3, float value3, int key4, float value4);
+ method public static androidx.collection.IntFloatMap intFloatMapOf(int key1, float value1, int key2, float value2, int key3, float value3, int key4, float value4, int key5, float value5);
+ method public static androidx.collection.MutableIntFloatMap mutableIntFloatMapOf();
+ method public static androidx.collection.MutableIntFloatMap mutableIntFloatMapOf(int key1, float value1);
+ method public static androidx.collection.MutableIntFloatMap mutableIntFloatMapOf(int key1, float value1, int key2, float value2);
+ method public static androidx.collection.MutableIntFloatMap mutableIntFloatMapOf(int key1, float value1, int key2, float value2, int key3, float value3);
+ method public static androidx.collection.MutableIntFloatMap mutableIntFloatMapOf(int key1, float value1, int key2, float value2, int key3, float value3, int key4, float value4);
+ method public static androidx.collection.MutableIntFloatMap mutableIntFloatMapOf(int key1, float value1, int key2, float value2, int key3, float value3, int key4, float value4, int key5, float value5);
+ }
+
+ public abstract sealed class IntIntMap {
+ method public final inline boolean all(kotlin.jvm.functions.Function2<? super java.lang.Integer,? super java.lang.Integer,java.lang.Boolean> predicate);
+ method public final boolean any();
+ method public final inline boolean any(kotlin.jvm.functions.Function2<? super java.lang.Integer,? super java.lang.Integer,java.lang.Boolean> predicate);
+ method public final inline operator boolean contains(int key);
+ method public final boolean containsKey(int key);
+ method public final boolean containsValue(int value);
+ method public final int count();
+ method public final inline int count(kotlin.jvm.functions.Function2<? super java.lang.Integer,? super java.lang.Integer,java.lang.Boolean> predicate);
+ method public final inline void forEach(kotlin.jvm.functions.Function2<? super java.lang.Integer,? super java.lang.Integer,kotlin.Unit> block);
+ method public final inline void forEachKey(kotlin.jvm.functions.Function1<? super java.lang.Integer,kotlin.Unit> block);
+ method public final inline void forEachValue(kotlin.jvm.functions.Function1<? super java.lang.Integer,kotlin.Unit> block);
+ method public final operator int get(int key);
+ method public final int getCapacity();
+ method public final int getOrDefault(int key, int defaultValue);
+ method public final inline int getOrElse(int key, kotlin.jvm.functions.Function0<java.lang.Integer> defaultValue);
+ method public final int getSize();
+ method public final boolean isEmpty();
+ method public final boolean isNotEmpty();
+ method public final String joinToString();
+ method public final String joinToString(optional CharSequence separator);
+ method public final String joinToString(optional CharSequence separator, optional CharSequence prefix);
+ method public final String joinToString(optional CharSequence separator, optional CharSequence prefix, optional CharSequence postfix);
+ method public final String joinToString(optional CharSequence separator, optional CharSequence prefix, optional CharSequence postfix, optional int limit);
+ method public final String joinToString(optional CharSequence separator, optional CharSequence prefix, optional CharSequence postfix, optional int limit, optional CharSequence truncated);
+ method public final inline String joinToString(optional CharSequence separator, optional CharSequence prefix, optional CharSequence postfix, optional int limit, optional CharSequence truncated, kotlin.jvm.functions.Function2<? super java.lang.Integer,? super java.lang.Integer,? extends java.lang.CharSequence> transform);
+ method public final inline String joinToString(optional CharSequence separator, optional CharSequence prefix, optional CharSequence postfix, optional int limit, kotlin.jvm.functions.Function2<? super java.lang.Integer,? super java.lang.Integer,? extends java.lang.CharSequence> transform);
+ method public final inline String joinToString(optional CharSequence separator, optional CharSequence prefix, optional CharSequence postfix, kotlin.jvm.functions.Function2<? super java.lang.Integer,? super java.lang.Integer,? extends java.lang.CharSequence> transform);
+ method public final inline String joinToString(optional CharSequence separator, optional CharSequence prefix, kotlin.jvm.functions.Function2<? super java.lang.Integer,? super java.lang.Integer,? extends java.lang.CharSequence> transform);
+ method public final inline String joinToString(optional CharSequence separator, kotlin.jvm.functions.Function2<? super java.lang.Integer,? super java.lang.Integer,? extends java.lang.CharSequence> transform);
+ method public final inline String joinToString(kotlin.jvm.functions.Function2<? super java.lang.Integer,? super java.lang.Integer,? extends java.lang.CharSequence> transform);
+ method public final boolean none();
+ property public final int capacity;
+ property public final int size;
+ }
+
+ public final class IntIntMapKt {
+ method public static inline androidx.collection.IntIntMap buildIntIntMap(int initialCapacity, kotlin.jvm.functions.Function1<? super androidx.collection.MutableIntIntMap,kotlin.Unit> builderAction);
+ method public static inline androidx.collection.IntIntMap buildIntIntMap(kotlin.jvm.functions.Function1<? super androidx.collection.MutableIntIntMap,kotlin.Unit> builderAction);
+ method public static androidx.collection.IntIntMap emptyIntIntMap();
+ method public static androidx.collection.IntIntMap intIntMapOf();
+ method public static androidx.collection.IntIntMap intIntMapOf(int key1, int value1);
+ method public static androidx.collection.IntIntMap intIntMapOf(int key1, int value1, int key2, int value2);
+ method public static androidx.collection.IntIntMap intIntMapOf(int key1, int value1, int key2, int value2, int key3, int value3);
+ method public static androidx.collection.IntIntMap intIntMapOf(int key1, int value1, int key2, int value2, int key3, int value3, int key4, int value4);
+ method public static androidx.collection.IntIntMap intIntMapOf(int key1, int value1, int key2, int value2, int key3, int value3, int key4, int value4, int key5, int value5);
+ method public static androidx.collection.MutableIntIntMap mutableIntIntMapOf();
+ method public static androidx.collection.MutableIntIntMap mutableIntIntMapOf(int key1, int value1);
+ method public static androidx.collection.MutableIntIntMap mutableIntIntMapOf(int key1, int value1, int key2, int value2);
+ method public static androidx.collection.MutableIntIntMap mutableIntIntMapOf(int key1, int value1, int key2, int value2, int key3, int value3);
+ method public static androidx.collection.MutableIntIntMap mutableIntIntMapOf(int key1, int value1, int key2, int value2, int key3, int value3, int key4, int value4);
+ method public static androidx.collection.MutableIntIntMap mutableIntIntMapOf(int key1, int value1, int key2, int value2, int key3, int value3, int key4, int value4, int key5, int value5);
+ }
+
+ @kotlin.jvm.JvmInline public final value class IntIntPair {
+ ctor public IntIntPair(int first, int second);
+ method public inline operator int component1();
+ method public inline operator int component2();
+ property public final int first;
+ property public final long packedValue;
+ property public final int second;
+ field public final long packedValue;
+ }
+
+ public abstract sealed class IntList {
+ method public final inline boolean any();
+ method public final inline boolean any(kotlin.jvm.functions.Function1<? super java.lang.Integer,java.lang.Boolean> predicate);
+ method public final int binarySearch(int element);
+ method public final int binarySearch(int element, optional int fromIndex);
+ method public final int binarySearch(int element, optional int fromIndex, optional int toIndex);
+ method public final operator boolean contains(int element);
+ method public final boolean containsAll(androidx.collection.IntList elements);
+ method public final inline int count();
+ method public final inline int count(kotlin.jvm.functions.Function1<? super java.lang.Integer,java.lang.Boolean> predicate);
+ method public final int elementAt(@IntRange(from=0L) int index);
+ method public final inline int elementAtOrElse(@IntRange(from=0L) int index, kotlin.jvm.functions.Function1<? super java.lang.Integer,java.lang.Integer> defaultValue);
+ method public final int first();
+ method public final inline int first(kotlin.jvm.functions.Function1<? super java.lang.Integer,java.lang.Boolean> predicate);
+ method public final inline <R> R fold(R initial, kotlin.jvm.functions.Function2<? super R,? super java.lang.Integer,? extends R> operation);
+ method public final inline <R> R foldIndexed(R initial, kotlin.jvm.functions.Function3<? super java.lang.Integer,? super R,? super java.lang.Integer,? extends R> operation);
+ method public final inline <R> R foldRight(R initial, kotlin.jvm.functions.Function2<? super java.lang.Integer,? super R,? extends R> operation);
+ method public final inline <R> R foldRightIndexed(R initial, kotlin.jvm.functions.Function3<? super java.lang.Integer,? super java.lang.Integer,? super R,? extends R> operation);
+ method public final inline void forEach(kotlin.jvm.functions.Function1<? super java.lang.Integer,kotlin.Unit> block);
+ method public final inline void forEachIndexed(kotlin.jvm.functions.Function2<? super java.lang.Integer,? super java.lang.Integer,kotlin.Unit> block);
+ method public final inline void forEachReversed(kotlin.jvm.functions.Function1<? super java.lang.Integer,kotlin.Unit> block);
+ method public final inline void forEachReversedIndexed(kotlin.jvm.functions.Function2<? super java.lang.Integer,? super java.lang.Integer,kotlin.Unit> block);
+ method public final operator int get(@IntRange(from=0L) int index);
+ method public final inline kotlin.ranges.IntRange getIndices();
+ method @IntRange(from=-1L) public final inline int getLastIndex();
+ method @IntRange(from=0L) public final inline int getSize();
+ method public final int indexOf(int element);
+ method public final inline int indexOfFirst(kotlin.jvm.functions.Function1<? super java.lang.Integer,java.lang.Boolean> predicate);
+ method public final inline int indexOfLast(kotlin.jvm.functions.Function1<? super java.lang.Integer,java.lang.Boolean> predicate);
+ method public final inline boolean isEmpty();
+ method public final inline boolean isNotEmpty();
+ method public final String joinToString();
+ method public final String joinToString(optional CharSequence separator);
+ method public final String joinToString(optional CharSequence separator, optional CharSequence prefix);
+ method public final String joinToString(optional CharSequence separator, optional CharSequence prefix, optional CharSequence postfix);
+ method public final String joinToString(optional CharSequence separator, optional CharSequence prefix, optional CharSequence postfix, optional int limit);
+ method public final String joinToString(optional CharSequence separator, optional CharSequence prefix, optional CharSequence postfix, optional int limit, optional CharSequence truncated);
+ method public final inline String joinToString(optional CharSequence separator, optional CharSequence prefix, optional CharSequence postfix, optional int limit, optional CharSequence truncated, kotlin.jvm.functions.Function1<? super java.lang.Integer,? extends java.lang.CharSequence> transform);
+ method public final inline String joinToString(optional CharSequence separator, optional CharSequence prefix, optional CharSequence postfix, optional int limit, kotlin.jvm.functions.Function1<? super java.lang.Integer,? extends java.lang.CharSequence> transform);
+ method public final inline String joinToString(optional CharSequence separator, optional CharSequence prefix, optional CharSequence postfix, kotlin.jvm.functions.Function1<? super java.lang.Integer,? extends java.lang.CharSequence> transform);
+ method public final inline String joinToString(optional CharSequence separator, optional CharSequence prefix, kotlin.jvm.functions.Function1<? super java.lang.Integer,? extends java.lang.CharSequence> transform);
+ method public final inline String joinToString(optional CharSequence separator, kotlin.jvm.functions.Function1<? super java.lang.Integer,? extends java.lang.CharSequence> transform);
+ method public final inline String joinToString(kotlin.jvm.functions.Function1<? super java.lang.Integer,? extends java.lang.CharSequence> transform);
+ method public final int last();
+ method public final inline int last(kotlin.jvm.functions.Function1<? super java.lang.Integer,java.lang.Boolean> predicate);
+ method public final int lastIndexOf(int element);
+ method public final inline boolean none();
+ method public final inline boolean reversedAny(kotlin.jvm.functions.Function1<? super java.lang.Integer,java.lang.Boolean> predicate);
+ property public final inline kotlin.ranges.IntRange indices;
+ property @IntRange(from=-1L) public final inline int lastIndex;
+ property @IntRange(from=0L) public final inline int size;
+ }
+
+ public final class IntListKt {
+ method public static inline androidx.collection.IntList buildIntList(int initialCapacity, kotlin.jvm.functions.Function1<? super androidx.collection.MutableIntList,kotlin.Unit> builderAction);
+ method public static inline androidx.collection.IntList buildIntList(kotlin.jvm.functions.Function1<? super androidx.collection.MutableIntList,kotlin.Unit> builderAction);
+ method public static androidx.collection.IntList emptyIntList();
+ method public static androidx.collection.IntList intListOf();
+ method public static androidx.collection.IntList intListOf(int element1);
+ method public static androidx.collection.IntList intListOf(int element1, int element2);
+ method public static androidx.collection.IntList intListOf(int element1, int element2, int element3);
+ method public static androidx.collection.IntList intListOf(int... elements);
+ method public static inline androidx.collection.MutableIntList mutableIntListOf();
+ method public static androidx.collection.MutableIntList mutableIntListOf(int element1);
+ method public static androidx.collection.MutableIntList mutableIntListOf(int element1, int element2);
+ method public static androidx.collection.MutableIntList mutableIntListOf(int element1, int element2, int element3);
+ method public static inline androidx.collection.MutableIntList mutableIntListOf(int... elements);
+ }
+
+ public abstract sealed class IntLongMap {
+ method public final inline boolean all(kotlin.jvm.functions.Function2<? super java.lang.Integer,? super java.lang.Long,java.lang.Boolean> predicate);
+ method public final boolean any();
+ method public final inline boolean any(kotlin.jvm.functions.Function2<? super java.lang.Integer,? super java.lang.Long,java.lang.Boolean> predicate);
+ method public final inline operator boolean contains(int key);
+ method public final boolean containsKey(int key);
+ method public final boolean containsValue(long value);
+ method public final int count();
+ method public final inline int count(kotlin.jvm.functions.Function2<? super java.lang.Integer,? super java.lang.Long,java.lang.Boolean> predicate);
+ method public final inline void forEach(kotlin.jvm.functions.Function2<? super java.lang.Integer,? super java.lang.Long,kotlin.Unit> block);
+ method public final inline void forEachKey(kotlin.jvm.functions.Function1<? super java.lang.Integer,kotlin.Unit> block);
+ method public final inline void forEachValue(kotlin.jvm.functions.Function1<? super java.lang.Long,kotlin.Unit> block);
+ method public final operator long get(int key);
+ method public final int getCapacity();
+ method public final long getOrDefault(int key, long defaultValue);
+ method public final inline long getOrElse(int key, kotlin.jvm.functions.Function0<java.lang.Long> defaultValue);
+ method public final int getSize();
+ method public final boolean isEmpty();
+ method public final boolean isNotEmpty();
+ method public final String joinToString();
+ method public final String joinToString(optional CharSequence separator);
+ method public final String joinToString(optional CharSequence separator, optional CharSequence prefix);
+ method public final String joinToString(optional CharSequence separator, optional CharSequence prefix, optional CharSequence postfix);
+ method public final String joinToString(optional CharSequence separator, optional CharSequence prefix, optional CharSequence postfix, optional int limit);
+ method public final String joinToString(optional CharSequence separator, optional CharSequence prefix, optional CharSequence postfix, optional int limit, optional CharSequence truncated);
+ method public final inline String joinToString(optional CharSequence separator, optional CharSequence prefix, optional CharSequence postfix, optional int limit, optional CharSequence truncated, kotlin.jvm.functions.Function2<? super java.lang.Integer,? super java.lang.Long,? extends java.lang.CharSequence> transform);
+ method public final inline String joinToString(optional CharSequence separator, optional CharSequence prefix, optional CharSequence postfix, optional int limit, kotlin.jvm.functions.Function2<? super java.lang.Integer,? super java.lang.Long,? extends java.lang.CharSequence> transform);
+ method public final inline String joinToString(optional CharSequence separator, optional CharSequence prefix, optional CharSequence postfix, kotlin.jvm.functions.Function2<? super java.lang.Integer,? super java.lang.Long,? extends java.lang.CharSequence> transform);
+ method public final inline String joinToString(optional CharSequence separator, optional CharSequence prefix, kotlin.jvm.functions.Function2<? super java.lang.Integer,? super java.lang.Long,? extends java.lang.CharSequence> transform);
+ method public final inline String joinToString(optional CharSequence separator, kotlin.jvm.functions.Function2<? super java.lang.Integer,? super java.lang.Long,? extends java.lang.CharSequence> transform);
+ method public final inline String joinToString(kotlin.jvm.functions.Function2<? super java.lang.Integer,? super java.lang.Long,? extends java.lang.CharSequence> transform);
+ method public final boolean none();
+ property public final int capacity;
+ property public final int size;
+ }
+
+ public final class IntLongMapKt {
+ method public static inline androidx.collection.IntLongMap buildIntLongMap(int initialCapacity, kotlin.jvm.functions.Function1<? super androidx.collection.MutableIntLongMap,kotlin.Unit> builderAction);
+ method public static inline androidx.collection.IntLongMap buildIntLongMap(kotlin.jvm.functions.Function1<? super androidx.collection.MutableIntLongMap,kotlin.Unit> builderAction);
+ method public static androidx.collection.IntLongMap emptyIntLongMap();
+ method public static androidx.collection.IntLongMap intLongMapOf();
+ method public static androidx.collection.IntLongMap intLongMapOf(int key1, long value1);
+ method public static androidx.collection.IntLongMap intLongMapOf(int key1, long value1, int key2, long value2);
+ method public static androidx.collection.IntLongMap intLongMapOf(int key1, long value1, int key2, long value2, int key3, long value3);
+ method public static androidx.collection.IntLongMap intLongMapOf(int key1, long value1, int key2, long value2, int key3, long value3, int key4, long value4);
+ method public static androidx.collection.IntLongMap intLongMapOf(int key1, long value1, int key2, long value2, int key3, long value3, int key4, long value4, int key5, long value5);
+ method public static androidx.collection.MutableIntLongMap mutableIntLongMapOf();
+ method public static androidx.collection.MutableIntLongMap mutableIntLongMapOf(int key1, long value1);
+ method public static androidx.collection.MutableIntLongMap mutableIntLongMapOf(int key1, long value1, int key2, long value2);
+ method public static androidx.collection.MutableIntLongMap mutableIntLongMapOf(int key1, long value1, int key2, long value2, int key3, long value3);
+ method public static androidx.collection.MutableIntLongMap mutableIntLongMapOf(int key1, long value1, int key2, long value2, int key3, long value3, int key4, long value4);
+ method public static androidx.collection.MutableIntLongMap mutableIntLongMapOf(int key1, long value1, int key2, long value2, int key3, long value3, int key4, long value4, int key5, long value5);
+ }
+
+ public abstract sealed class IntObjectMap<V> {
+ method public final inline boolean all(kotlin.jvm.functions.Function2<? super java.lang.Integer,? super V,java.lang.Boolean> predicate);
+ method public final boolean any();
+ method public final inline boolean any(kotlin.jvm.functions.Function2<? super java.lang.Integer,? super V,java.lang.Boolean> predicate);
+ method public final inline operator boolean contains(int key);
+ method public final boolean containsKey(int key);
+ method public final boolean containsValue(V value);
+ method public final int count();
+ method public final inline int count(kotlin.jvm.functions.Function2<? super java.lang.Integer,? super V,java.lang.Boolean> predicate);
+ method public final inline void forEach(kotlin.jvm.functions.Function2<? super java.lang.Integer,? super V,kotlin.Unit> block);
+ method public final inline void forEachKey(kotlin.jvm.functions.Function1<? super java.lang.Integer,kotlin.Unit> block);
+ method public final inline void forEachValue(kotlin.jvm.functions.Function1<? super V,kotlin.Unit> block);
+ method public final operator V? get(int key);
+ method public final int getCapacity();
+ method public final V getOrDefault(int key, V defaultValue);
+ method public final inline V getOrElse(int key, kotlin.jvm.functions.Function0<? extends V> defaultValue);
+ method public final int getSize();
+ method public final boolean isEmpty();
+ method public final boolean isNotEmpty();
+ method public final String joinToString();
+ method public final String joinToString(optional CharSequence separator);
+ method public final String joinToString(optional CharSequence separator, optional CharSequence prefix);
+ method public final String joinToString(optional CharSequence separator, optional CharSequence prefix, optional CharSequence postfix);
+ method public final String joinToString(optional CharSequence separator, optional CharSequence prefix, optional CharSequence postfix, optional int limit);
+ method public final String joinToString(optional CharSequence separator, optional CharSequence prefix, optional CharSequence postfix, optional int limit, optional CharSequence truncated);
+ method public final inline String joinToString(optional CharSequence separator, optional CharSequence prefix, optional CharSequence postfix, optional int limit, optional CharSequence truncated, kotlin.jvm.functions.Function2<? super java.lang.Integer,? super V,? extends java.lang.CharSequence> transform);
+ method public final inline String joinToString(optional CharSequence separator, optional CharSequence prefix, optional CharSequence postfix, optional int limit, kotlin.jvm.functions.Function2<? super java.lang.Integer,? super V,? extends java.lang.CharSequence> transform);
+ method public final inline String joinToString(optional CharSequence separator, optional CharSequence prefix, optional CharSequence postfix, kotlin.jvm.functions.Function2<? super java.lang.Integer,? super V,? extends java.lang.CharSequence> transform);
+ method public final inline String joinToString(optional CharSequence separator, optional CharSequence prefix, kotlin.jvm.functions.Function2<? super java.lang.Integer,? super V,? extends java.lang.CharSequence> transform);
+ method public final inline String joinToString(optional CharSequence separator, kotlin.jvm.functions.Function2<? super java.lang.Integer,? super V,? extends java.lang.CharSequence> transform);
+ method public final inline String joinToString(kotlin.jvm.functions.Function2<? super java.lang.Integer,? super V,? extends java.lang.CharSequence> transform);
+ method public final boolean none();
+ property public final int capacity;
+ property public final int size;
+ }
+
+ public final class IntObjectMapKt {
+ method public static inline <V> androidx.collection.IntObjectMap<V> buildIntObjectMap(int initialCapacity, kotlin.jvm.functions.Function1<? super androidx.collection.MutableIntObjectMap<V>,kotlin.Unit> builderAction);
+ method public static inline <V> androidx.collection.IntObjectMap<V> buildIntObjectMap(kotlin.jvm.functions.Function1<? super androidx.collection.MutableIntObjectMap<V>,kotlin.Unit> builderAction);
+ method public static <V> androidx.collection.IntObjectMap<V> emptyIntObjectMap();
+ method public static <V> androidx.collection.IntObjectMap<V> intObjectMapOf();
+ method public static <V> androidx.collection.IntObjectMap<V> intObjectMapOf(int key1, V value1);
+ method public static <V> androidx.collection.IntObjectMap<V> intObjectMapOf(int key1, V value1, int key2, V value2);
+ method public static <V> androidx.collection.IntObjectMap<V> intObjectMapOf(int key1, V value1, int key2, V value2, int key3, V value3);
+ method public static <V> androidx.collection.IntObjectMap<V> intObjectMapOf(int key1, V value1, int key2, V value2, int key3, V value3, int key4, V value4);
+ method public static <V> androidx.collection.IntObjectMap<V> intObjectMapOf(int key1, V value1, int key2, V value2, int key3, V value3, int key4, V value4, int key5, V value5);
+ method public static <V> androidx.collection.MutableIntObjectMap<V> mutableIntObjectMapOf();
+ method public static <V> androidx.collection.MutableIntObjectMap<V> mutableIntObjectMapOf(int key1, V value1);
+ method public static <V> androidx.collection.MutableIntObjectMap<V> mutableIntObjectMapOf(int key1, V value1, int key2, V value2);
+ method public static <V> androidx.collection.MutableIntObjectMap<V> mutableIntObjectMapOf(int key1, V value1, int key2, V value2, int key3, V value3);
+ method public static <V> androidx.collection.MutableIntObjectMap<V> mutableIntObjectMapOf(int key1, V value1, int key2, V value2, int key3, V value3, int key4, V value4);
+ method public static <V> androidx.collection.MutableIntObjectMap<V> mutableIntObjectMapOf(int key1, V value1, int key2, V value2, int key3, V value3, int key4, V value4, int key5, V value5);
+ }
+
+ public abstract sealed class IntSet {
+ method public final inline boolean all(kotlin.jvm.functions.Function1<? super java.lang.Integer,java.lang.Boolean> predicate);
+ method public final boolean any();
+ method public final inline boolean any(kotlin.jvm.functions.Function1<? super java.lang.Integer,java.lang.Boolean> predicate);
+ method public final operator boolean contains(int element);
+ method @IntRange(from=0L) public final int count();
+ method @IntRange(from=0L) public final inline int count(kotlin.jvm.functions.Function1<? super java.lang.Integer,java.lang.Boolean> predicate);
+ method public final inline int first();
+ method public final inline int first(kotlin.jvm.functions.Function1<? super java.lang.Integer,java.lang.Boolean> predicate);
+ method public final inline void forEach(kotlin.jvm.functions.Function1<? super java.lang.Integer,kotlin.Unit> block);
+ method @IntRange(from=0L) public final int getCapacity();
+ method @IntRange(from=0L) public final int getSize();
+ method public final boolean isEmpty();
+ method public final boolean isNotEmpty();
+ method public final String joinToString();
+ method public final String joinToString(optional CharSequence separator);
+ method public final String joinToString(optional CharSequence separator, optional CharSequence prefix);
+ method public final String joinToString(optional CharSequence separator, optional CharSequence prefix, optional CharSequence postfix);
+ method public final String joinToString(optional CharSequence separator, optional CharSequence prefix, optional CharSequence postfix, optional int limit);
+ method public final String joinToString(optional CharSequence separator, optional CharSequence prefix, optional CharSequence postfix, optional int limit, optional CharSequence truncated);
+ method public final inline String joinToString(optional CharSequence separator, optional CharSequence prefix, optional CharSequence postfix, optional int limit, optional CharSequence truncated, kotlin.jvm.functions.Function1<? super java.lang.Integer,? extends java.lang.CharSequence> transform);
+ method public final inline String joinToString(optional CharSequence separator, optional CharSequence prefix, optional CharSequence postfix, optional int limit, kotlin.jvm.functions.Function1<? super java.lang.Integer,? extends java.lang.CharSequence> transform);
+ method public final inline String joinToString(optional CharSequence separator, optional CharSequence prefix, optional CharSequence postfix, kotlin.jvm.functions.Function1<? super java.lang.Integer,? extends java.lang.CharSequence> transform);
+ method public final inline String joinToString(optional CharSequence separator, optional CharSequence prefix, kotlin.jvm.functions.Function1<? super java.lang.Integer,? extends java.lang.CharSequence> transform);
+ method public final inline String joinToString(optional CharSequence separator, kotlin.jvm.functions.Function1<? super java.lang.Integer,? extends java.lang.CharSequence> transform);
+ method public final inline String joinToString(kotlin.jvm.functions.Function1<? super java.lang.Integer,? extends java.lang.CharSequence> transform);
+ method public final boolean none();
+ property @IntRange(from=0L) public final int capacity;
+ property @IntRange(from=0L) public final int size;
+ }
+
+ public final class IntSetKt {
+ method public static inline androidx.collection.IntSet buildIntSet(int initialCapacity, kotlin.jvm.functions.Function1<? super androidx.collection.MutableIntSet,kotlin.Unit> builderAction);
+ method public static inline androidx.collection.IntSet buildIntSet(kotlin.jvm.functions.Function1<? super androidx.collection.MutableIntSet,kotlin.Unit> builderAction);
+ method public static androidx.collection.IntSet emptyIntSet();
+ method public static androidx.collection.IntSet intSetOf();
+ method public static androidx.collection.IntSet intSetOf(int element1);
+ method public static androidx.collection.IntSet intSetOf(int element1, int element2);
+ method public static androidx.collection.IntSet intSetOf(int element1, int element2, int element3);
+ method public static androidx.collection.IntSet intSetOf(int... elements);
+ method public static androidx.collection.MutableIntSet mutableIntSetOf();
+ method public static androidx.collection.MutableIntSet mutableIntSetOf(int element1);
+ method public static androidx.collection.MutableIntSet mutableIntSetOf(int element1, int element2);
+ method public static androidx.collection.MutableIntSet mutableIntSetOf(int element1, int element2, int element3);
+ method public static androidx.collection.MutableIntSet mutableIntSetOf(int... elements);
+ }
+
+ public abstract sealed class LongFloatMap {
+ method public final inline boolean all(kotlin.jvm.functions.Function2<? super java.lang.Long,? super java.lang.Float,java.lang.Boolean> predicate);
+ method public final boolean any();
+ method public final inline boolean any(kotlin.jvm.functions.Function2<? super java.lang.Long,? super java.lang.Float,java.lang.Boolean> predicate);
+ method public final inline operator boolean contains(long key);
+ method public final boolean containsKey(long key);
+ method public final boolean containsValue(float value);
+ method public final int count();
+ method public final inline int count(kotlin.jvm.functions.Function2<? super java.lang.Long,? super java.lang.Float,java.lang.Boolean> predicate);
+ method public final inline void forEach(kotlin.jvm.functions.Function2<? super java.lang.Long,? super java.lang.Float,kotlin.Unit> block);
+ method public final inline void forEachKey(kotlin.jvm.functions.Function1<? super java.lang.Long,kotlin.Unit> block);
+ method public final inline void forEachValue(kotlin.jvm.functions.Function1<? super java.lang.Float,kotlin.Unit> block);
+ method public final operator float get(long key);
+ method public final int getCapacity();
+ method public final float getOrDefault(long key, float defaultValue);
+ method public final inline float getOrElse(long key, kotlin.jvm.functions.Function0<java.lang.Float> defaultValue);
+ method public final int getSize();
+ method public final boolean isEmpty();
+ method public final boolean isNotEmpty();
+ method public final String joinToString();
+ method public final String joinToString(optional CharSequence separator);
+ method public final String joinToString(optional CharSequence separator, optional CharSequence prefix);
+ method public final String joinToString(optional CharSequence separator, optional CharSequence prefix, optional CharSequence postfix);
+ method public final String joinToString(optional CharSequence separator, optional CharSequence prefix, optional CharSequence postfix, optional int limit);
+ method public final String joinToString(optional CharSequence separator, optional CharSequence prefix, optional CharSequence postfix, optional int limit, optional CharSequence truncated);
+ method public final inline String joinToString(optional CharSequence separator, optional CharSequence prefix, optional CharSequence postfix, optional int limit, optional CharSequence truncated, kotlin.jvm.functions.Function2<? super java.lang.Long,? super java.lang.Float,? extends java.lang.CharSequence> transform);
+ method public final inline String joinToString(optional CharSequence separator, optional CharSequence prefix, optional CharSequence postfix, optional int limit, kotlin.jvm.functions.Function2<? super java.lang.Long,? super java.lang.Float,? extends java.lang.CharSequence> transform);
+ method public final inline String joinToString(optional CharSequence separator, optional CharSequence prefix, optional CharSequence postfix, kotlin.jvm.functions.Function2<? super java.lang.Long,? super java.lang.Float,? extends java.lang.CharSequence> transform);
+ method public final inline String joinToString(optional CharSequence separator, optional CharSequence prefix, kotlin.jvm.functions.Function2<? super java.lang.Long,? super java.lang.Float,? extends java.lang.CharSequence> transform);
+ method public final inline String joinToString(optional CharSequence separator, kotlin.jvm.functions.Function2<? super java.lang.Long,? super java.lang.Float,? extends java.lang.CharSequence> transform);
+ method public final inline String joinToString(kotlin.jvm.functions.Function2<? super java.lang.Long,? super java.lang.Float,? extends java.lang.CharSequence> transform);
+ method public final boolean none();
+ property public final int capacity;
+ property public final int size;
+ }
+
+ public final class LongFloatMapKt {
+ method public static inline androidx.collection.LongFloatMap buildLongFloatMap(int initialCapacity, kotlin.jvm.functions.Function1<? super androidx.collection.MutableLongFloatMap,kotlin.Unit> builderAction);
+ method public static inline androidx.collection.LongFloatMap buildLongFloatMap(kotlin.jvm.functions.Function1<? super androidx.collection.MutableLongFloatMap,kotlin.Unit> builderAction);
+ method public static androidx.collection.LongFloatMap emptyLongFloatMap();
+ method public static androidx.collection.LongFloatMap longFloatMapOf();
+ method public static androidx.collection.LongFloatMap longFloatMapOf(long key1, float value1);
+ method public static androidx.collection.LongFloatMap longFloatMapOf(long key1, float value1, long key2, float value2);
+ method public static androidx.collection.LongFloatMap longFloatMapOf(long key1, float value1, long key2, float value2, long key3, float value3);
+ method public static androidx.collection.LongFloatMap longFloatMapOf(long key1, float value1, long key2, float value2, long key3, float value3, long key4, float value4);
+ method public static androidx.collection.LongFloatMap longFloatMapOf(long key1, float value1, long key2, float value2, long key3, float value3, long key4, float value4, long key5, float value5);
+ method public static androidx.collection.MutableLongFloatMap mutableLongFloatMapOf();
+ method public static androidx.collection.MutableLongFloatMap mutableLongFloatMapOf(long key1, float value1);
+ method public static androidx.collection.MutableLongFloatMap mutableLongFloatMapOf(long key1, float value1, long key2, float value2);
+ method public static androidx.collection.MutableLongFloatMap mutableLongFloatMapOf(long key1, float value1, long key2, float value2, long key3, float value3);
+ method public static androidx.collection.MutableLongFloatMap mutableLongFloatMapOf(long key1, float value1, long key2, float value2, long key3, float value3, long key4, float value4);
+ method public static androidx.collection.MutableLongFloatMap mutableLongFloatMapOf(long key1, float value1, long key2, float value2, long key3, float value3, long key4, float value4, long key5, float value5);
+ }
+
+ public abstract sealed class LongIntMap {
+ method public final inline boolean all(kotlin.jvm.functions.Function2<? super java.lang.Long,? super java.lang.Integer,java.lang.Boolean> predicate);
+ method public final boolean any();
+ method public final inline boolean any(kotlin.jvm.functions.Function2<? super java.lang.Long,? super java.lang.Integer,java.lang.Boolean> predicate);
+ method public final inline operator boolean contains(long key);
+ method public final boolean containsKey(long key);
+ method public final boolean containsValue(int value);
+ method public final int count();
+ method public final inline int count(kotlin.jvm.functions.Function2<? super java.lang.Long,? super java.lang.Integer,java.lang.Boolean> predicate);
+ method public final inline void forEach(kotlin.jvm.functions.Function2<? super java.lang.Long,? super java.lang.Integer,kotlin.Unit> block);
+ method public final inline void forEachKey(kotlin.jvm.functions.Function1<? super java.lang.Long,kotlin.Unit> block);
+ method public final inline void forEachValue(kotlin.jvm.functions.Function1<? super java.lang.Integer,kotlin.Unit> block);
+ method public final operator int get(long key);
+ method public final int getCapacity();
+ method public final int getOrDefault(long key, int defaultValue);
+ method public final inline int getOrElse(long key, kotlin.jvm.functions.Function0<java.lang.Integer> defaultValue);
+ method public final int getSize();
+ method public final boolean isEmpty();
+ method public final boolean isNotEmpty();
+ method public final String joinToString();
+ method public final String joinToString(optional CharSequence separator);
+ method public final String joinToString(optional CharSequence separator, optional CharSequence prefix);
+ method public final String joinToString(optional CharSequence separator, optional CharSequence prefix, optional CharSequence postfix);
+ method public final String joinToString(optional CharSequence separator, optional CharSequence prefix, optional CharSequence postfix, optional int limit);
+ method public final String joinToString(optional CharSequence separator, optional CharSequence prefix, optional CharSequence postfix, optional int limit, optional CharSequence truncated);
+ method public final inline String joinToString(optional CharSequence separator, optional CharSequence prefix, optional CharSequence postfix, optional int limit, optional CharSequence truncated, kotlin.jvm.functions.Function2<? super java.lang.Long,? super java.lang.Integer,? extends java.lang.CharSequence> transform);
+ method public final inline String joinToString(optional CharSequence separator, optional CharSequence prefix, optional CharSequence postfix, optional int limit, kotlin.jvm.functions.Function2<? super java.lang.Long,? super java.lang.Integer,? extends java.lang.CharSequence> transform);
+ method public final inline String joinToString(optional CharSequence separator, optional CharSequence prefix, optional CharSequence postfix, kotlin.jvm.functions.Function2<? super java.lang.Long,? super java.lang.Integer,? extends java.lang.CharSequence> transform);
+ method public final inline String joinToString(optional CharSequence separator, optional CharSequence prefix, kotlin.jvm.functions.Function2<? super java.lang.Long,? super java.lang.Integer,? extends java.lang.CharSequence> transform);
+ method public final inline String joinToString(optional CharSequence separator, kotlin.jvm.functions.Function2<? super java.lang.Long,? super java.lang.Integer,? extends java.lang.CharSequence> transform);
+ method public final inline String joinToString(kotlin.jvm.functions.Function2<? super java.lang.Long,? super java.lang.Integer,? extends java.lang.CharSequence> transform);
+ method public final boolean none();
+ property public final int capacity;
+ property public final int size;
+ }
+
+ public final class LongIntMapKt {
+ method public static inline androidx.collection.LongIntMap buildLongIntMap(int initialCapacity, kotlin.jvm.functions.Function1<? super androidx.collection.MutableLongIntMap,kotlin.Unit> builderAction);
+ method public static inline androidx.collection.LongIntMap buildLongIntMap(kotlin.jvm.functions.Function1<? super androidx.collection.MutableLongIntMap,kotlin.Unit> builderAction);
+ method public static androidx.collection.LongIntMap emptyLongIntMap();
+ method public static androidx.collection.LongIntMap longIntMapOf();
+ method public static androidx.collection.LongIntMap longIntMapOf(long key1, int value1);
+ method public static androidx.collection.LongIntMap longIntMapOf(long key1, int value1, long key2, int value2);
+ method public static androidx.collection.LongIntMap longIntMapOf(long key1, int value1, long key2, int value2, long key3, int value3);
+ method public static androidx.collection.LongIntMap longIntMapOf(long key1, int value1, long key2, int value2, long key3, int value3, long key4, int value4);
+ method public static androidx.collection.LongIntMap longIntMapOf(long key1, int value1, long key2, int value2, long key3, int value3, long key4, int value4, long key5, int value5);
+ method public static androidx.collection.MutableLongIntMap mutableLongIntMapOf();
+ method public static androidx.collection.MutableLongIntMap mutableLongIntMapOf(long key1, int value1);
+ method public static androidx.collection.MutableLongIntMap mutableLongIntMapOf(long key1, int value1, long key2, int value2);
+ method public static androidx.collection.MutableLongIntMap mutableLongIntMapOf(long key1, int value1, long key2, int value2, long key3, int value3);
+ method public static androidx.collection.MutableLongIntMap mutableLongIntMapOf(long key1, int value1, long key2, int value2, long key3, int value3, long key4, int value4);
+ method public static androidx.collection.MutableLongIntMap mutableLongIntMapOf(long key1, int value1, long key2, int value2, long key3, int value3, long key4, int value4, long key5, int value5);
+ }
+
+ public abstract sealed class LongList {
+ method public final inline boolean any();
+ method public final inline boolean any(kotlin.jvm.functions.Function1<? super java.lang.Long,java.lang.Boolean> predicate);
+ method public final int binarySearch(int element);
+ method public final int binarySearch(int element, optional int fromIndex);
+ method public final int binarySearch(int element, optional int fromIndex, optional int toIndex);
+ method public final operator boolean contains(long element);
+ method public final boolean containsAll(androidx.collection.LongList elements);
+ method public final inline int count();
+ method public final inline int count(kotlin.jvm.functions.Function1<? super java.lang.Long,java.lang.Boolean> predicate);
+ method public final long elementAt(@IntRange(from=0L) int index);
+ method public final inline long elementAtOrElse(@IntRange(from=0L) int index, kotlin.jvm.functions.Function1<? super java.lang.Integer,java.lang.Long> defaultValue);
+ method public final long first();
+ method public final inline long first(kotlin.jvm.functions.Function1<? super java.lang.Long,java.lang.Boolean> predicate);
+ method public final inline <R> R fold(R initial, kotlin.jvm.functions.Function2<? super R,? super java.lang.Long,? extends R> operation);
+ method public final inline <R> R foldIndexed(R initial, kotlin.jvm.functions.Function3<? super java.lang.Integer,? super R,? super java.lang.Long,? extends R> operation);
+ method public final inline <R> R foldRight(R initial, kotlin.jvm.functions.Function2<? super java.lang.Long,? super R,? extends R> operation);
+ method public final inline <R> R foldRightIndexed(R initial, kotlin.jvm.functions.Function3<? super java.lang.Integer,? super java.lang.Long,? super R,? extends R> operation);
+ method public final inline void forEach(kotlin.jvm.functions.Function1<? super java.lang.Long,kotlin.Unit> block);
+ method public final inline void forEachIndexed(kotlin.jvm.functions.Function2<? super java.lang.Integer,? super java.lang.Long,kotlin.Unit> block);
+ method public final inline void forEachReversed(kotlin.jvm.functions.Function1<? super java.lang.Long,kotlin.Unit> block);
+ method public final inline void forEachReversedIndexed(kotlin.jvm.functions.Function2<? super java.lang.Integer,? super java.lang.Long,kotlin.Unit> block);
+ method public final operator long get(@IntRange(from=0L) int index);
+ method public final inline kotlin.ranges.IntRange getIndices();
+ method @IntRange(from=-1L) public final inline int getLastIndex();
+ method @IntRange(from=0L) public final inline int getSize();
+ method public final int indexOf(long element);
+ method public final inline int indexOfFirst(kotlin.jvm.functions.Function1<? super java.lang.Long,java.lang.Boolean> predicate);
+ method public final inline int indexOfLast(kotlin.jvm.functions.Function1<? super java.lang.Long,java.lang.Boolean> predicate);
+ method public final inline boolean isEmpty();
+ method public final inline boolean isNotEmpty();
+ method public final String joinToString();
+ method public final String joinToString(optional CharSequence separator);
+ method public final String joinToString(optional CharSequence separator, optional CharSequence prefix);
+ method public final String joinToString(optional CharSequence separator, optional CharSequence prefix, optional CharSequence postfix);
+ method public final String joinToString(optional CharSequence separator, optional CharSequence prefix, optional CharSequence postfix, optional int limit);
+ method public final String joinToString(optional CharSequence separator, optional CharSequence prefix, optional CharSequence postfix, optional int limit, optional CharSequence truncated);
+ method public final inline String joinToString(optional CharSequence separator, optional CharSequence prefix, optional CharSequence postfix, optional int limit, optional CharSequence truncated, kotlin.jvm.functions.Function1<? super java.lang.Long,? extends java.lang.CharSequence> transform);
+ method public final inline String joinToString(optional CharSequence separator, optional CharSequence prefix, optional CharSequence postfix, optional int limit, kotlin.jvm.functions.Function1<? super java.lang.Long,? extends java.lang.CharSequence> transform);
+ method public final inline String joinToString(optional CharSequence separator, optional CharSequence prefix, optional CharSequence postfix, kotlin.jvm.functions.Function1<? super java.lang.Long,? extends java.lang.CharSequence> transform);
+ method public final inline String joinToString(optional CharSequence separator, optional CharSequence prefix, kotlin.jvm.functions.Function1<? super java.lang.Long,? extends java.lang.CharSequence> transform);
+ method public final inline String joinToString(optional CharSequence separator, kotlin.jvm.functions.Function1<? super java.lang.Long,? extends java.lang.CharSequence> transform);
+ method public final inline String joinToString(kotlin.jvm.functions.Function1<? super java.lang.Long,? extends java.lang.CharSequence> transform);
+ method public final long last();
+ method public final inline long last(kotlin.jvm.functions.Function1<? super java.lang.Long,java.lang.Boolean> predicate);
+ method public final int lastIndexOf(long element);
+ method public final inline boolean none();
+ method public final inline boolean reversedAny(kotlin.jvm.functions.Function1<? super java.lang.Long,java.lang.Boolean> predicate);
+ property public final inline kotlin.ranges.IntRange indices;
+ property @IntRange(from=-1L) public final inline int lastIndex;
+ property @IntRange(from=0L) public final inline int size;
+ }
+
+ public final class LongListKt {
+ method public static inline androidx.collection.LongList buildLongList(int initialCapacity, kotlin.jvm.functions.Function1<? super androidx.collection.MutableLongList,kotlin.Unit> builderAction);
+ method public static inline androidx.collection.LongList buildLongList(kotlin.jvm.functions.Function1<? super androidx.collection.MutableLongList,kotlin.Unit> builderAction);
+ method public static androidx.collection.LongList emptyLongList();
+ method public static androidx.collection.LongList longListOf();
+ method public static androidx.collection.LongList longListOf(long element1);
+ method public static androidx.collection.LongList longListOf(long element1, long element2);
+ method public static androidx.collection.LongList longListOf(long element1, long element2, long element3);
+ method public static androidx.collection.LongList longListOf(long... elements);
+ method public static inline androidx.collection.MutableLongList mutableLongListOf();
+ method public static androidx.collection.MutableLongList mutableLongListOf(long element1);
+ method public static androidx.collection.MutableLongList mutableLongListOf(long element1, long element2);
+ method public static androidx.collection.MutableLongList mutableLongListOf(long element1, long element2, long element3);
+ method public static inline androidx.collection.MutableLongList mutableLongListOf(long... elements);
+ }
+
+ public abstract sealed class LongLongMap {
+ method public final inline boolean all(kotlin.jvm.functions.Function2<? super java.lang.Long,? super java.lang.Long,java.lang.Boolean> predicate);
+ method public final boolean any();
+ method public final inline boolean any(kotlin.jvm.functions.Function2<? super java.lang.Long,? super java.lang.Long,java.lang.Boolean> predicate);
+ method public final inline operator boolean contains(long key);
+ method public final boolean containsKey(long key);
+ method public final boolean containsValue(long value);
+ method public final int count();
+ method public final inline int count(kotlin.jvm.functions.Function2<? super java.lang.Long,? super java.lang.Long,java.lang.Boolean> predicate);
+ method public final inline void forEach(kotlin.jvm.functions.Function2<? super java.lang.Long,? super java.lang.Long,kotlin.Unit> block);
+ method public final inline void forEachKey(kotlin.jvm.functions.Function1<? super java.lang.Long,kotlin.Unit> block);
+ method public final inline void forEachValue(kotlin.jvm.functions.Function1<? super java.lang.Long,kotlin.Unit> block);
+ method public final operator long get(long key);
+ method public final int getCapacity();
+ method public final long getOrDefault(long key, long defaultValue);
+ method public final inline long getOrElse(long key, kotlin.jvm.functions.Function0<java.lang.Long> defaultValue);
+ method public final int getSize();
+ method public final boolean isEmpty();
+ method public final boolean isNotEmpty();
+ method public final String joinToString();
+ method public final String joinToString(optional CharSequence separator);
+ method public final String joinToString(optional CharSequence separator, optional CharSequence prefix);
+ method public final String joinToString(optional CharSequence separator, optional CharSequence prefix, optional CharSequence postfix);
+ method public final String joinToString(optional CharSequence separator, optional CharSequence prefix, optional CharSequence postfix, optional int limit);
+ method public final String joinToString(optional CharSequence separator, optional CharSequence prefix, optional CharSequence postfix, optional int limit, optional CharSequence truncated);
+ method public final inline String joinToString(optional CharSequence separator, optional CharSequence prefix, optional CharSequence postfix, optional int limit, optional CharSequence truncated, kotlin.jvm.functions.Function2<? super java.lang.Long,? super java.lang.Long,? extends java.lang.CharSequence> transform);
+ method public final inline String joinToString(optional CharSequence separator, optional CharSequence prefix, optional CharSequence postfix, optional int limit, kotlin.jvm.functions.Function2<? super java.lang.Long,? super java.lang.Long,? extends java.lang.CharSequence> transform);
+ method public final inline String joinToString(optional CharSequence separator, optional CharSequence prefix, optional CharSequence postfix, kotlin.jvm.functions.Function2<? super java.lang.Long,? super java.lang.Long,? extends java.lang.CharSequence> transform);
+ method public final inline String joinToString(optional CharSequence separator, optional CharSequence prefix, kotlin.jvm.functions.Function2<? super java.lang.Long,? super java.lang.Long,? extends java.lang.CharSequence> transform);
+ method public final inline String joinToString(optional CharSequence separator, kotlin.jvm.functions.Function2<? super java.lang.Long,? super java.lang.Long,? extends java.lang.CharSequence> transform);
+ method public final inline String joinToString(kotlin.jvm.functions.Function2<? super java.lang.Long,? super java.lang.Long,? extends java.lang.CharSequence> transform);
+ method public final boolean none();
+ property public final int capacity;
+ property public final int size;
+ }
+
+ public final class LongLongMapKt {
+ method public static inline androidx.collection.LongLongMap buildLongLongMap(int initialCapacity, kotlin.jvm.functions.Function1<? super androidx.collection.MutableLongLongMap,kotlin.Unit> builderAction);
+ method public static inline androidx.collection.LongLongMap buildLongLongMap(kotlin.jvm.functions.Function1<? super androidx.collection.MutableLongLongMap,kotlin.Unit> builderAction);
+ method public static androidx.collection.LongLongMap emptyLongLongMap();
+ method public static androidx.collection.LongLongMap longLongMapOf();
+ method public static androidx.collection.LongLongMap longLongMapOf(long key1, long value1);
+ method public static androidx.collection.LongLongMap longLongMapOf(long key1, long value1, long key2, long value2);
+ method public static androidx.collection.LongLongMap longLongMapOf(long key1, long value1, long key2, long value2, long key3, long value3);
+ method public static androidx.collection.LongLongMap longLongMapOf(long key1, long value1, long key2, long value2, long key3, long value3, long key4, long value4);
+ method public static androidx.collection.LongLongMap longLongMapOf(long key1, long value1, long key2, long value2, long key3, long value3, long key4, long value4, long key5, long value5);
+ method public static androidx.collection.MutableLongLongMap mutableLongLongMapOf();
+ method public static androidx.collection.MutableLongLongMap mutableLongLongMapOf(long key1, long value1);
+ method public static androidx.collection.MutableLongLongMap mutableLongLongMapOf(long key1, long value1, long key2, long value2);
+ method public static androidx.collection.MutableLongLongMap mutableLongLongMapOf(long key1, long value1, long key2, long value2, long key3, long value3);
+ method public static androidx.collection.MutableLongLongMap mutableLongLongMapOf(long key1, long value1, long key2, long value2, long key3, long value3, long key4, long value4);
+ method public static androidx.collection.MutableLongLongMap mutableLongLongMapOf(long key1, long value1, long key2, long value2, long key3, long value3, long key4, long value4, long key5, long value5);
+ }
+
+ public final class LongLongPair {
+ ctor public LongLongPair(long first, long second);
+ method public inline operator long component1();
+ method public inline operator long component2();
+ method public long getFirst();
+ method public long getSecond();
+ property public final long first;
+ property public final long second;
+ }
+
+ public abstract sealed class LongObjectMap<V> {
+ method public final inline boolean all(kotlin.jvm.functions.Function2<? super java.lang.Long,? super V,java.lang.Boolean> predicate);
+ method public final boolean any();
+ method public final inline boolean any(kotlin.jvm.functions.Function2<? super java.lang.Long,? super V,java.lang.Boolean> predicate);
+ method public final inline operator boolean contains(long key);
+ method public final boolean containsKey(long key);
+ method public final boolean containsValue(V value);
+ method public final int count();
+ method public final inline int count(kotlin.jvm.functions.Function2<? super java.lang.Long,? super V,java.lang.Boolean> predicate);
+ method public final inline void forEach(kotlin.jvm.functions.Function2<? super java.lang.Long,? super V,kotlin.Unit> block);
+ method public final inline void forEachKey(kotlin.jvm.functions.Function1<? super java.lang.Long,kotlin.Unit> block);
+ method public final inline void forEachValue(kotlin.jvm.functions.Function1<? super V,kotlin.Unit> block);
+ method public final operator V? get(long key);
+ method public final int getCapacity();
+ method public final V getOrDefault(long key, V defaultValue);
+ method public final inline V getOrElse(long key, kotlin.jvm.functions.Function0<? extends V> defaultValue);
+ method public final int getSize();
+ method public final boolean isEmpty();
+ method public final boolean isNotEmpty();
+ method public final String joinToString();
+ method public final String joinToString(optional CharSequence separator);
+ method public final String joinToString(optional CharSequence separator, optional CharSequence prefix);
+ method public final String joinToString(optional CharSequence separator, optional CharSequence prefix, optional CharSequence postfix);
+ method public final String joinToString(optional CharSequence separator, optional CharSequence prefix, optional CharSequence postfix, optional int limit);
+ method public final String joinToString(optional CharSequence separator, optional CharSequence prefix, optional CharSequence postfix, optional int limit, optional CharSequence truncated);
+ method public final inline String joinToString(optional CharSequence separator, optional CharSequence prefix, optional CharSequence postfix, optional int limit, optional CharSequence truncated, kotlin.jvm.functions.Function2<? super java.lang.Long,? super V,? extends java.lang.CharSequence> transform);
+ method public final inline String joinToString(optional CharSequence separator, optional CharSequence prefix, optional CharSequence postfix, optional int limit, kotlin.jvm.functions.Function2<? super java.lang.Long,? super V,? extends java.lang.CharSequence> transform);
+ method public final inline String joinToString(optional CharSequence separator, optional CharSequence prefix, optional CharSequence postfix, kotlin.jvm.functions.Function2<? super java.lang.Long,? super V,? extends java.lang.CharSequence> transform);
+ method public final inline String joinToString(optional CharSequence separator, optional CharSequence prefix, kotlin.jvm.functions.Function2<? super java.lang.Long,? super V,? extends java.lang.CharSequence> transform);
+ method public final inline String joinToString(optional CharSequence separator, kotlin.jvm.functions.Function2<? super java.lang.Long,? super V,? extends java.lang.CharSequence> transform);
+ method public final inline String joinToString(kotlin.jvm.functions.Function2<? super java.lang.Long,? super V,? extends java.lang.CharSequence> transform);
+ method public final boolean none();
+ property public final int capacity;
+ property public final int size;
+ }
+
+ public final class LongObjectMapKt {
+ method public static inline <V> androidx.collection.LongObjectMap<V> buildLongObjectMap(int initialCapacity, kotlin.jvm.functions.Function1<? super androidx.collection.MutableLongObjectMap<V>,kotlin.Unit> builderAction);
+ method public static inline <V> androidx.collection.LongObjectMap<V> buildLongObjectMap(kotlin.jvm.functions.Function1<? super androidx.collection.MutableLongObjectMap<V>,kotlin.Unit> builderAction);
+ method public static <V> androidx.collection.LongObjectMap<V> emptyLongObjectMap();
+ method public static <V> androidx.collection.LongObjectMap<V> longObjectMapOf();
+ method public static <V> androidx.collection.LongObjectMap<V> longObjectMapOf(long key1, V value1);
+ method public static <V> androidx.collection.LongObjectMap<V> longObjectMapOf(long key1, V value1, long key2, V value2);
+ method public static <V> androidx.collection.LongObjectMap<V> longObjectMapOf(long key1, V value1, long key2, V value2, long key3, V value3);
+ method public static <V> androidx.collection.LongObjectMap<V> longObjectMapOf(long key1, V value1, long key2, V value2, long key3, V value3, long key4, V value4);
+ method public static <V> androidx.collection.LongObjectMap<V> longObjectMapOf(long key1, V value1, long key2, V value2, long key3, V value3, long key4, V value4, long key5, V value5);
+ method public static <V> androidx.collection.MutableLongObjectMap<V> mutableLongObjectMapOf();
+ method public static <V> androidx.collection.MutableLongObjectMap<V> mutableLongObjectMapOf(long key1, V value1);
+ method public static <V> androidx.collection.MutableLongObjectMap<V> mutableLongObjectMapOf(long key1, V value1, long key2, V value2);
+ method public static <V> androidx.collection.MutableLongObjectMap<V> mutableLongObjectMapOf(long key1, V value1, long key2, V value2, long key3, V value3);
+ method public static <V> androidx.collection.MutableLongObjectMap<V> mutableLongObjectMapOf(long key1, V value1, long key2, V value2, long key3, V value3, long key4, V value4);
+ method public static <V> androidx.collection.MutableLongObjectMap<V> mutableLongObjectMapOf(long key1, V value1, long key2, V value2, long key3, V value3, long key4, V value4, long key5, V value5);
+ }
+
+ public abstract sealed class LongSet {
+ method public final inline boolean all(kotlin.jvm.functions.Function1<? super java.lang.Long,java.lang.Boolean> predicate);
+ method public final boolean any();
+ method public final inline boolean any(kotlin.jvm.functions.Function1<? super java.lang.Long,java.lang.Boolean> predicate);
+ method public final operator boolean contains(long element);
+ method @IntRange(from=0L) public final int count();
+ method @IntRange(from=0L) public final inline int count(kotlin.jvm.functions.Function1<? super java.lang.Long,java.lang.Boolean> predicate);
+ method public final inline long first();
+ method public final inline long first(kotlin.jvm.functions.Function1<? super java.lang.Long,java.lang.Boolean> predicate);
+ method public final inline void forEach(kotlin.jvm.functions.Function1<? super java.lang.Long,kotlin.Unit> block);
+ method @IntRange(from=0L) public final int getCapacity();
+ method @IntRange(from=0L) public final int getSize();
+ method public final boolean isEmpty();
+ method public final boolean isNotEmpty();
+ method public final String joinToString();
+ method public final String joinToString(optional CharSequence separator);
+ method public final String joinToString(optional CharSequence separator, optional CharSequence prefix);
+ method public final String joinToString(optional CharSequence separator, optional CharSequence prefix, optional CharSequence postfix);
+ method public final String joinToString(optional CharSequence separator, optional CharSequence prefix, optional CharSequence postfix, optional int limit);
+ method public final String joinToString(optional CharSequence separator, optional CharSequence prefix, optional CharSequence postfix, optional int limit, optional CharSequence truncated);
+ method public final inline String joinToString(optional CharSequence separator, optional CharSequence prefix, optional CharSequence postfix, optional int limit, optional CharSequence truncated, kotlin.jvm.functions.Function1<? super java.lang.Long,? extends java.lang.CharSequence> transform);
+ method public final inline String joinToString(optional CharSequence separator, optional CharSequence prefix, optional CharSequence postfix, optional int limit, kotlin.jvm.functions.Function1<? super java.lang.Long,? extends java.lang.CharSequence> transform);
+ method public final inline String joinToString(optional CharSequence separator, optional CharSequence prefix, optional CharSequence postfix, kotlin.jvm.functions.Function1<? super java.lang.Long,? extends java.lang.CharSequence> transform);
+ method public final inline String joinToString(optional CharSequence separator, optional CharSequence prefix, kotlin.jvm.functions.Function1<? super java.lang.Long,? extends java.lang.CharSequence> transform);
+ method public final inline String joinToString(optional CharSequence separator, kotlin.jvm.functions.Function1<? super java.lang.Long,? extends java.lang.CharSequence> transform);
+ method public final inline String joinToString(kotlin.jvm.functions.Function1<? super java.lang.Long,? extends java.lang.CharSequence> transform);
+ method public final boolean none();
+ property @IntRange(from=0L) public final int capacity;
+ property @IntRange(from=0L) public final int size;
+ }
+
+ public final class LongSetKt {
+ method public static inline androidx.collection.LongSet buildLongSet(int initialCapacity, kotlin.jvm.functions.Function1<? super androidx.collection.MutableLongSet,kotlin.Unit> builderAction);
+ method public static inline androidx.collection.LongSet buildLongSet(kotlin.jvm.functions.Function1<? super androidx.collection.MutableLongSet,kotlin.Unit> builderAction);
+ method public static androidx.collection.LongSet emptyLongSet();
+ method public static androidx.collection.LongSet longSetOf();
+ method public static androidx.collection.LongSet longSetOf(long element1);
+ method public static androidx.collection.LongSet longSetOf(long element1, long element2);
+ method public static androidx.collection.LongSet longSetOf(long element1, long element2, long element3);
+ method public static androidx.collection.LongSet longSetOf(long... elements);
+ method public static androidx.collection.MutableLongSet mutableLongSetOf();
+ method public static androidx.collection.MutableLongSet mutableLongSetOf(long element1);
+ method public static androidx.collection.MutableLongSet mutableLongSetOf(long element1, long element2);
+ method public static androidx.collection.MutableLongSet mutableLongSetOf(long element1, long element2, long element3);
+ method public static androidx.collection.MutableLongSet mutableLongSetOf(long... elements);
+ }
+
+ public class LongSparseArray<E> implements java.lang.Cloneable {
+ ctor public LongSparseArray();
+ ctor public LongSparseArray(optional int initialCapacity);
+ method public void append(long key, E value);
+ method public void clear();
+ method public androidx.collection.LongSparseArray<E> clone();
+ method public boolean containsKey(long key);
+ method public boolean containsValue(E value);
+ method @Deprecated public void delete(long key);
+ method public operator E? get(long key);
+ method public E get(long key, E defaultValue);
+ method public int indexOfKey(long key);
+ method public int indexOfValue(E value);
+ method public boolean isEmpty();
+ method public long keyAt(int index);
+ method public void put(long key, E value);
+ method public void putAll(androidx.collection.LongSparseArray<? extends E> other);
+ method public E? putIfAbsent(long key, E value);
+ method public void remove(long key);
+ method public boolean remove(long key, E value);
+ method public void removeAt(int index);
+ method public E? replace(long key, E value);
+ method public boolean replace(long key, E oldValue, E newValue);
+ method public void setValueAt(int index, E value);
+ method public int size();
+ method public E valueAt(int index);
+ }
+
+ public final class LongSparseArrayKt {
+ method public static inline operator <T> boolean contains(androidx.collection.LongSparseArray<T>, long key);
+ method public static inline <T> void forEach(androidx.collection.LongSparseArray<T>, kotlin.jvm.functions.Function2<? super java.lang.Long,? super T,kotlin.Unit> action);
+ method public static inline <T> T getOrDefault(androidx.collection.LongSparseArray<T>, long key, T defaultValue);
+ method public static inline <T> T getOrElse(androidx.collection.LongSparseArray<T>, long key, kotlin.jvm.functions.Function0<? extends T> defaultValue);
+ method public static inline <T> int getSize(androidx.collection.LongSparseArray<T>);
+ method public static inline <T> boolean isNotEmpty(androidx.collection.LongSparseArray<T>);
+ method public static <T> kotlin.collections.LongIterator keyIterator(androidx.collection.LongSparseArray<T>);
+ method public static operator <T> androidx.collection.LongSparseArray<T> plus(androidx.collection.LongSparseArray<T>, androidx.collection.LongSparseArray<T> other);
+ method @Deprecated public static <T> boolean remove(androidx.collection.LongSparseArray<T>, long key, T value);
+ method public static inline operator <T> void set(androidx.collection.LongSparseArray<T>, long key, T value);
+ method public static <T> java.util.Iterator<T> valueIterator(androidx.collection.LongSparseArray<T>);
+ }
+
+ public class LruCache<K, V> {
+ ctor public LruCache(@IntRange(from=1L, to=androidx.collection.LruCacheKt.MAX_SIZE) int maxSize);
+ method protected V? create(K key);
+ method public final int createCount();
+ method protected void entryRemoved(boolean evicted, K key, V oldValue, V? newValue);
+ method public final void evictAll();
+ method public final int evictionCount();
+ method public final operator V? get(K key);
+ method public final int hitCount();
+ method public final int maxSize();
+ method public final int missCount();
+ method public final V? put(K key, V value);
+ method public final int putCount();
+ method public final V? remove(K key);
+ method public void resize(@IntRange(from=1L, to=androidx.collection.LruCacheKt.MAX_SIZE) int maxSize);
+ method public final int size();
+ method protected int sizeOf(K key, V value);
+ method public final java.util.Map<K,V> snapshot();
+ method public void trimToSize(int maxSize);
+ }
+
+ public final class LruCacheKt {
+ method public static inline <K, V> androidx.collection.LruCache<K,V> lruCache(int maxSize, optional kotlin.jvm.functions.Function2<? super K,? super V,java.lang.Integer> sizeOf, optional kotlin.jvm.functions.Function1<? super K,? extends V?> create, optional kotlin.jvm.functions.Function4<? super java.lang.Boolean,? super K,? super V,? super V?,kotlin.Unit> onEntryRemoved);
+ }
+
+ public final class MutableDoubleList extends androidx.collection.DoubleList {
+ ctor public MutableDoubleList();
+ ctor public MutableDoubleList(optional int initialCapacity);
+ method public boolean add(double element);
+ method public void add(@IntRange(from=0L) int index, double element);
+ method public inline boolean addAll(androidx.collection.DoubleList elements);
+ method public inline boolean addAll(double[] elements);
+ method public boolean addAll(@IntRange(from=0L) int index, androidx.collection.DoubleList elements);
+ method public boolean addAll(@IntRange(from=0L) int index, double[] elements);
+ method public void clear();
+ method public void ensureCapacity(int capacity);
+ method public inline int getCapacity();
+ method public operator void minusAssign(androidx.collection.DoubleList elements);
+ method public inline operator void minusAssign(double element);
+ method public operator void minusAssign(double[] elements);
+ method public inline operator void plusAssign(androidx.collection.DoubleList elements);
+ method public inline operator void plusAssign(double element);
+ method public inline operator void plusAssign(double[] elements);
+ method public boolean remove(double element);
+ method public boolean removeAll(androidx.collection.DoubleList elements);
+ method public boolean removeAll(double[] elements);
+ method public double removeAt(@IntRange(from=0L) int index);
+ method public void removeRange(@IntRange(from=0L) int start, @IntRange(from=0L) int end);
+ method public boolean retainAll(androidx.collection.DoubleList elements);
+ method public boolean retainAll(double[] elements);
+ method public operator double set(@IntRange(from=0L) int index, double element);
+ method public void sort();
+ method public void sortDescending();
+ method public void trim(optional int minCapacity);
+ property public final inline int capacity;
+ }
+
+ public final class MutableFloatFloatMap extends androidx.collection.FloatFloatMap {
+ ctor public MutableFloatFloatMap();
+ ctor public MutableFloatFloatMap(optional int initialCapacity);
+ method public void clear();
+ method public inline float getOrPut(float key, kotlin.jvm.functions.Function0<java.lang.Float> defaultValue);
+ method public inline operator void minusAssign(androidx.collection.FloatList keys);
+ method public inline operator void minusAssign(androidx.collection.FloatSet keys);
+ method public inline operator void minusAssign(float key);
+ method public inline operator void minusAssign(float[] keys);
+ method public inline operator void plusAssign(androidx.collection.FloatFloatMap from);
+ method public void put(float key, float value);
+ method public float put(float key, float value, float default);
+ method public void putAll(androidx.collection.FloatFloatMap from);
+ method public void remove(float key);
+ method public boolean remove(float key, float value);
+ method public inline void removeIf(kotlin.jvm.functions.Function2<? super java.lang.Float,? super java.lang.Float,java.lang.Boolean> predicate);
+ method public operator void set(float key, float value);
+ method public int trim();
+ }
+
+ public final class MutableFloatIntMap extends androidx.collection.FloatIntMap {
+ ctor public MutableFloatIntMap();
+ ctor public MutableFloatIntMap(optional int initialCapacity);
+ method public void clear();
+ method public inline int getOrPut(float key, kotlin.jvm.functions.Function0<java.lang.Integer> defaultValue);
+ method public inline operator void minusAssign(androidx.collection.FloatList keys);
+ method public inline operator void minusAssign(androidx.collection.FloatSet keys);
+ method public inline operator void minusAssign(float key);
+ method public inline operator void minusAssign(float[] keys);
+ method public inline operator void plusAssign(androidx.collection.FloatIntMap from);
+ method public void put(float key, int value);
+ method public int put(float key, int value, int default);
+ method public void putAll(androidx.collection.FloatIntMap from);
+ method public void remove(float key);
+ method public boolean remove(float key, int value);
+ method public inline void removeIf(kotlin.jvm.functions.Function2<? super java.lang.Float,? super java.lang.Integer,java.lang.Boolean> predicate);
+ method public operator void set(float key, int value);
+ method public int trim();
+ }
+
+ public final class MutableFloatList extends androidx.collection.FloatList {
+ ctor public MutableFloatList();
+ ctor public MutableFloatList(optional int initialCapacity);
+ method public boolean add(float element);
+ method public void add(@IntRange(from=0L) int index, float element);
+ method public inline boolean addAll(androidx.collection.FloatList elements);
+ method public inline boolean addAll(float[] elements);
+ method public boolean addAll(@IntRange(from=0L) int index, androidx.collection.FloatList elements);
+ method public boolean addAll(@IntRange(from=0L) int index, float[] elements);
+ method public void clear();
+ method public void ensureCapacity(int capacity);
+ method public inline int getCapacity();
+ method public operator void minusAssign(androidx.collection.FloatList elements);
+ method public inline operator void minusAssign(float element);
+ method public operator void minusAssign(float[] elements);
+ method public inline operator void plusAssign(androidx.collection.FloatList elements);
+ method public inline operator void plusAssign(float element);
+ method public inline operator void plusAssign(float[] elements);
+ method public boolean remove(float element);
+ method public boolean removeAll(androidx.collection.FloatList elements);
+ method public boolean removeAll(float[] elements);
+ method public float removeAt(@IntRange(from=0L) int index);
+ method public void removeRange(@IntRange(from=0L) int start, @IntRange(from=0L) int end);
+ method public boolean retainAll(androidx.collection.FloatList elements);
+ method public boolean retainAll(float[] elements);
+ method public operator float set(@IntRange(from=0L) int index, float element);
+ method public void sort();
+ method public void sortDescending();
+ method public void trim(optional int minCapacity);
+ property public final inline int capacity;
+ }
+
+ public final class MutableFloatLongMap extends androidx.collection.FloatLongMap {
+ ctor public MutableFloatLongMap();
+ ctor public MutableFloatLongMap(optional int initialCapacity);
+ method public void clear();
+ method public inline long getOrPut(float key, kotlin.jvm.functions.Function0<java.lang.Long> defaultValue);
+ method public inline operator void minusAssign(androidx.collection.FloatList keys);
+ method public inline operator void minusAssign(androidx.collection.FloatSet keys);
+ method public inline operator void minusAssign(float key);
+ method public inline operator void minusAssign(float[] keys);
+ method public inline operator void plusAssign(androidx.collection.FloatLongMap from);
+ method public void put(float key, long value);
+ method public long put(float key, long value, long default);
+ method public void putAll(androidx.collection.FloatLongMap from);
+ method public void remove(float key);
+ method public boolean remove(float key, long value);
+ method public inline void removeIf(kotlin.jvm.functions.Function2<? super java.lang.Float,? super java.lang.Long,java.lang.Boolean> predicate);
+ method public operator void set(float key, long value);
+ method public int trim();
+ }
+
+ public final class MutableFloatObjectMap<V> extends androidx.collection.FloatObjectMap<V> {
+ ctor public MutableFloatObjectMap();
+ ctor public MutableFloatObjectMap(optional int initialCapacity);
+ method public void clear();
+ method public inline V getOrPut(float key, kotlin.jvm.functions.Function0<? extends V> defaultValue);
+ method public inline operator void minusAssign(androidx.collection.FloatList keys);
+ method public inline operator void minusAssign(androidx.collection.FloatSet keys);
+ method public inline operator void minusAssign(float key);
+ method public inline operator void minusAssign(float[] keys);
+ method public inline operator void plusAssign(androidx.collection.FloatObjectMap<V> from);
+ method public V? put(float key, V value);
+ method public void putAll(androidx.collection.FloatObjectMap<V> from);
+ method public V? remove(float key);
+ method public boolean remove(float key, V value);
+ method public inline void removeIf(kotlin.jvm.functions.Function2<? super java.lang.Float,? super V,java.lang.Boolean> predicate);
+ method public operator void set(float key, V value);
+ method public int trim();
+ }
+
+ public final class MutableFloatSet extends androidx.collection.FloatSet {
+ ctor public MutableFloatSet();
+ ctor public MutableFloatSet(optional int initialCapacity);
+ method public boolean add(float element);
+ method public boolean addAll(androidx.collection.FloatSet elements);
+ method public boolean addAll(float[] elements);
+ method public void clear();
+ method public operator void minusAssign(androidx.collection.FloatSet elements);
+ method public operator void minusAssign(float element);
+ method public operator void minusAssign(float[] elements);
+ method public operator void plusAssign(androidx.collection.FloatSet elements);
+ method public operator void plusAssign(float element);
+ method public operator void plusAssign(float[] elements);
+ method public boolean remove(float element);
+ method public boolean removeAll(androidx.collection.FloatSet elements);
+ method public boolean removeAll(float[] elements);
+ method @IntRange(from=0L) public int trim();
+ }
+
+ public final class MutableIntFloatMap extends androidx.collection.IntFloatMap {
+ ctor public MutableIntFloatMap();
+ ctor public MutableIntFloatMap(optional int initialCapacity);
+ method public void clear();
+ method public inline float getOrPut(int key, kotlin.jvm.functions.Function0<java.lang.Float> defaultValue);
+ method public inline operator void minusAssign(androidx.collection.IntList keys);
+ method public inline operator void minusAssign(androidx.collection.IntSet keys);
+ method public inline operator void minusAssign(int key);
+ method public inline operator void minusAssign(int[] keys);
+ method public inline operator void plusAssign(androidx.collection.IntFloatMap from);
+ method public void put(int key, float value);
+ method public float put(int key, float value, float default);
+ method public void putAll(androidx.collection.IntFloatMap from);
+ method public void remove(int key);
+ method public boolean remove(int key, float value);
+ method public inline void removeIf(kotlin.jvm.functions.Function2<? super java.lang.Integer,? super java.lang.Float,java.lang.Boolean> predicate);
+ method public operator void set(int key, float value);
+ method public int trim();
+ }
+
+ public final class MutableIntIntMap extends androidx.collection.IntIntMap {
+ ctor public MutableIntIntMap();
+ ctor public MutableIntIntMap(optional int initialCapacity);
+ method public void clear();
+ method public inline int getOrPut(int key, kotlin.jvm.functions.Function0<java.lang.Integer> defaultValue);
+ method public inline operator void minusAssign(androidx.collection.IntList keys);
+ method public inline operator void minusAssign(androidx.collection.IntSet keys);
+ method public inline operator void minusAssign(int key);
+ method public inline operator void minusAssign(int[] keys);
+ method public inline operator void plusAssign(androidx.collection.IntIntMap from);
+ method public void put(int key, int value);
+ method public int put(int key, int value, int default);
+ method public void putAll(androidx.collection.IntIntMap from);
+ method public void remove(int key);
+ method public boolean remove(int key, int value);
+ method public inline void removeIf(kotlin.jvm.functions.Function2<? super java.lang.Integer,? super java.lang.Integer,java.lang.Boolean> predicate);
+ method public operator void set(int key, int value);
+ method public int trim();
+ }
+
+ public final class MutableIntList extends androidx.collection.IntList {
+ ctor public MutableIntList();
+ ctor public MutableIntList(optional int initialCapacity);
+ method public boolean add(int element);
+ method public void add(@IntRange(from=0L) int index, int element);
+ method public inline boolean addAll(androidx.collection.IntList elements);
+ method public boolean addAll(@IntRange(from=0L) int index, androidx.collection.IntList elements);
+ method public boolean addAll(@IntRange(from=0L) int index, int[] elements);
+ method public inline boolean addAll(int[] elements);
+ method public void clear();
+ method public void ensureCapacity(int capacity);
+ method public inline int getCapacity();
+ method public operator void minusAssign(androidx.collection.IntList elements);
+ method public inline operator void minusAssign(int element);
+ method public operator void minusAssign(int[] elements);
+ method public inline operator void plusAssign(androidx.collection.IntList elements);
+ method public inline operator void plusAssign(int element);
+ method public inline operator void plusAssign(int[] elements);
+ method public boolean remove(int element);
+ method public boolean removeAll(androidx.collection.IntList elements);
+ method public boolean removeAll(int[] elements);
+ method public int removeAt(@IntRange(from=0L) int index);
+ method public void removeRange(@IntRange(from=0L) int start, @IntRange(from=0L) int end);
+ method public boolean retainAll(androidx.collection.IntList elements);
+ method public boolean retainAll(int[] elements);
+ method public operator int set(@IntRange(from=0L) int index, int element);
+ method public void sort();
+ method public void sortDescending();
+ method public void trim(optional int minCapacity);
+ property public final inline int capacity;
+ }
+
+ public final class MutableIntLongMap extends androidx.collection.IntLongMap {
+ ctor public MutableIntLongMap();
+ ctor public MutableIntLongMap(optional int initialCapacity);
+ method public void clear();
+ method public inline long getOrPut(int key, kotlin.jvm.functions.Function0<java.lang.Long> defaultValue);
+ method public inline operator void minusAssign(androidx.collection.IntList keys);
+ method public inline operator void minusAssign(androidx.collection.IntSet keys);
+ method public inline operator void minusAssign(int key);
+ method public inline operator void minusAssign(int[] keys);
+ method public inline operator void plusAssign(androidx.collection.IntLongMap from);
+ method public void put(int key, long value);
+ method public long put(int key, long value, long default);
+ method public void putAll(androidx.collection.IntLongMap from);
+ method public void remove(int key);
+ method public boolean remove(int key, long value);
+ method public inline void removeIf(kotlin.jvm.functions.Function2<? super java.lang.Integer,? super java.lang.Long,java.lang.Boolean> predicate);
+ method public operator void set(int key, long value);
+ method public int trim();
+ }
+
+ public final class MutableIntObjectMap<V> extends androidx.collection.IntObjectMap<V> {
+ ctor public MutableIntObjectMap();
+ ctor public MutableIntObjectMap(optional int initialCapacity);
+ method public void clear();
+ method public inline V getOrPut(int key, kotlin.jvm.functions.Function0<? extends V> defaultValue);
+ method public inline operator void minusAssign(androidx.collection.IntList keys);
+ method public inline operator void minusAssign(androidx.collection.IntSet keys);
+ method public inline operator void minusAssign(int key);
+ method public inline operator void minusAssign(int[] keys);
+ method public inline operator void plusAssign(androidx.collection.IntObjectMap<V> from);
+ method public V? put(int key, V value);
+ method public void putAll(androidx.collection.IntObjectMap<V> from);
+ method public V? remove(int key);
+ method public boolean remove(int key, V value);
+ method public inline void removeIf(kotlin.jvm.functions.Function2<? super java.lang.Integer,? super V,java.lang.Boolean> predicate);
+ method public operator void set(int key, V value);
+ method public int trim();
+ }
+
+ public final class MutableIntSet extends androidx.collection.IntSet {
+ ctor public MutableIntSet();
+ ctor public MutableIntSet(optional int initialCapacity);
+ method public boolean add(int element);
+ method public boolean addAll(androidx.collection.IntSet elements);
+ method public boolean addAll(int[] elements);
+ method public void clear();
+ method public operator void minusAssign(androidx.collection.IntSet elements);
+ method public operator void minusAssign(int element);
+ method public operator void minusAssign(int[] elements);
+ method public operator void plusAssign(androidx.collection.IntSet elements);
+ method public operator void plusAssign(int element);
+ method public operator void plusAssign(int[] elements);
+ method public boolean remove(int element);
+ method public boolean removeAll(androidx.collection.IntSet elements);
+ method public boolean removeAll(int[] elements);
+ method @IntRange(from=0L) public int trim();
+ }
+
+ public final class MutableLongFloatMap extends androidx.collection.LongFloatMap {
+ ctor public MutableLongFloatMap();
+ ctor public MutableLongFloatMap(optional int initialCapacity);
+ method public void clear();
+ method public inline float getOrPut(long key, kotlin.jvm.functions.Function0<java.lang.Float> defaultValue);
+ method public inline operator void minusAssign(androidx.collection.LongList keys);
+ method public inline operator void minusAssign(androidx.collection.LongSet keys);
+ method public inline operator void minusAssign(long key);
+ method public inline operator void minusAssign(long[] keys);
+ method public inline operator void plusAssign(androidx.collection.LongFloatMap from);
+ method public void put(long key, float value);
+ method public float put(long key, float value, float default);
+ method public void putAll(androidx.collection.LongFloatMap from);
+ method public void remove(long key);
+ method public boolean remove(long key, float value);
+ method public inline void removeIf(kotlin.jvm.functions.Function2<? super java.lang.Long,? super java.lang.Float,java.lang.Boolean> predicate);
+ method public operator void set(long key, float value);
+ method public int trim();
+ }
+
+ public final class MutableLongIntMap extends androidx.collection.LongIntMap {
+ ctor public MutableLongIntMap();
+ ctor public MutableLongIntMap(optional int initialCapacity);
+ method public void clear();
+ method public inline int getOrPut(long key, kotlin.jvm.functions.Function0<java.lang.Integer> defaultValue);
+ method public inline operator void minusAssign(androidx.collection.LongList keys);
+ method public inline operator void minusAssign(androidx.collection.LongSet keys);
+ method public inline operator void minusAssign(long key);
+ method public inline operator void minusAssign(long[] keys);
+ method public inline operator void plusAssign(androidx.collection.LongIntMap from);
+ method public void put(long key, int value);
+ method public int put(long key, int value, int default);
+ method public void putAll(androidx.collection.LongIntMap from);
+ method public void remove(long key);
+ method public boolean remove(long key, int value);
+ method public inline void removeIf(kotlin.jvm.functions.Function2<? super java.lang.Long,? super java.lang.Integer,java.lang.Boolean> predicate);
+ method public operator void set(long key, int value);
+ method public int trim();
+ }
+
+ public final class MutableLongList extends androidx.collection.LongList {
+ ctor public MutableLongList();
+ ctor public MutableLongList(optional int initialCapacity);
+ method public void add(@IntRange(from=0L) int index, long element);
+ method public boolean add(long element);
+ method public inline boolean addAll(androidx.collection.LongList elements);
+ method public boolean addAll(@IntRange(from=0L) int index, androidx.collection.LongList elements);
+ method public boolean addAll(@IntRange(from=0L) int index, long[] elements);
+ method public inline boolean addAll(long[] elements);
+ method public void clear();
+ method public void ensureCapacity(int capacity);
+ method public inline int getCapacity();
+ method public operator void minusAssign(androidx.collection.LongList elements);
+ method public inline operator void minusAssign(long element);
+ method public operator void minusAssign(long[] elements);
+ method public inline operator void plusAssign(androidx.collection.LongList elements);
+ method public inline operator void plusAssign(long element);
+ method public inline operator void plusAssign(long[] elements);
+ method public boolean remove(long element);
+ method public boolean removeAll(androidx.collection.LongList elements);
+ method public boolean removeAll(long[] elements);
+ method public long removeAt(@IntRange(from=0L) int index);
+ method public void removeRange(@IntRange(from=0L) int start, @IntRange(from=0L) int end);
+ method public boolean retainAll(androidx.collection.LongList elements);
+ method public boolean retainAll(long[] elements);
+ method public operator long set(@IntRange(from=0L) int index, long element);
+ method public void sort();
+ method public void sortDescending();
+ method public void trim(optional int minCapacity);
+ property public final inline int capacity;
+ }
+
+ public final class MutableLongLongMap extends androidx.collection.LongLongMap {
+ ctor public MutableLongLongMap();
+ ctor public MutableLongLongMap(optional int initialCapacity);
+ method public void clear();
+ method public inline long getOrPut(long key, kotlin.jvm.functions.Function0<java.lang.Long> defaultValue);
+ method public inline operator void minusAssign(androidx.collection.LongList keys);
+ method public inline operator void minusAssign(androidx.collection.LongSet keys);
+ method public inline operator void minusAssign(long key);
+ method public inline operator void minusAssign(long[] keys);
+ method public inline operator void plusAssign(androidx.collection.LongLongMap from);
+ method public void put(long key, long value);
+ method public long put(long key, long value, long default);
+ method public void putAll(androidx.collection.LongLongMap from);
+ method public void remove(long key);
+ method public boolean remove(long key, long value);
+ method public inline void removeIf(kotlin.jvm.functions.Function2<? super java.lang.Long,? super java.lang.Long,java.lang.Boolean> predicate);
+ method public operator void set(long key, long value);
+ method public int trim();
+ }
+
+ public final class MutableLongObjectMap<V> extends androidx.collection.LongObjectMap<V> {
+ ctor public MutableLongObjectMap();
+ ctor public MutableLongObjectMap(optional int initialCapacity);
+ method public void clear();
+ method public inline V getOrPut(long key, kotlin.jvm.functions.Function0<? extends V> defaultValue);
+ method public inline operator void minusAssign(androidx.collection.LongList keys);
+ method public inline operator void minusAssign(androidx.collection.LongSet keys);
+ method public inline operator void minusAssign(long key);
+ method public inline operator void minusAssign(long[] keys);
+ method public inline operator void plusAssign(androidx.collection.LongObjectMap<V> from);
+ method public V? put(long key, V value);
+ method public void putAll(androidx.collection.LongObjectMap<V> from);
+ method public V? remove(long key);
+ method public boolean remove(long key, V value);
+ method public inline void removeIf(kotlin.jvm.functions.Function2<? super java.lang.Long,? super V,java.lang.Boolean> predicate);
+ method public operator void set(long key, V value);
+ method public int trim();
+ }
+
+ public final class MutableLongSet extends androidx.collection.LongSet {
+ ctor public MutableLongSet();
+ ctor public MutableLongSet(optional int initialCapacity);
+ method public boolean add(long element);
+ method public boolean addAll(androidx.collection.LongSet elements);
+ method public boolean addAll(long[] elements);
+ method public void clear();
+ method public operator void minusAssign(androidx.collection.LongSet elements);
+ method public operator void minusAssign(long element);
+ method public operator void minusAssign(long[] elements);
+ method public operator void plusAssign(androidx.collection.LongSet elements);
+ method public operator void plusAssign(long element);
+ method public operator void plusAssign(long[] elements);
+ method public boolean remove(long element);
+ method public boolean removeAll(androidx.collection.LongSet elements);
+ method public boolean removeAll(long[] elements);
+ method @IntRange(from=0L) public int trim();
+ }
+
+ public final class MutableObjectFloatMap<K> extends androidx.collection.ObjectFloatMap<K> {
+ ctor public MutableObjectFloatMap();
+ ctor public MutableObjectFloatMap(optional int initialCapacity);
+ method public void clear();
+ method public inline float getOrPut(K key, kotlin.jvm.functions.Function0<java.lang.Float> defaultValue);
+ method public inline operator void minusAssign(androidx.collection.ScatterSet<K> keys);
+ method public inline operator void minusAssign(Iterable<? extends K> keys);
+ method public inline operator void minusAssign(K key);
+ method public inline operator void minusAssign(K[] keys);
+ method public inline operator void minusAssign(kotlin.sequences.Sequence<? extends K> keys);
+ method public inline operator void plusAssign(androidx.collection.ObjectFloatMap<K> from);
+ method public void put(K key, float value);
+ method public float put(K key, float value, float default);
+ method public void putAll(androidx.collection.ObjectFloatMap<K> from);
+ method public void remove(K key);
+ method public boolean remove(K key, float value);
+ method public inline void removeIf(kotlin.jvm.functions.Function2<? super K,? super java.lang.Float,java.lang.Boolean> predicate);
+ method public operator void set(K key, float value);
+ method public int trim();
+ }
+
+ public final class MutableObjectIntMap<K> extends androidx.collection.ObjectIntMap<K> {
+ ctor public MutableObjectIntMap();
+ ctor public MutableObjectIntMap(optional int initialCapacity);
+ method public void clear();
+ method public inline int getOrPut(K key, kotlin.jvm.functions.Function0<java.lang.Integer> defaultValue);
+ method public inline operator void minusAssign(androidx.collection.ScatterSet<K> keys);
+ method public inline operator void minusAssign(Iterable<? extends K> keys);
+ method public inline operator void minusAssign(K key);
+ method public inline operator void minusAssign(K[] keys);
+ method public inline operator void minusAssign(kotlin.sequences.Sequence<? extends K> keys);
+ method public inline operator void plusAssign(androidx.collection.ObjectIntMap<K> from);
+ method public void put(K key, int value);
+ method public int put(K key, int value, int default);
+ method public void putAll(androidx.collection.ObjectIntMap<K> from);
+ method public void remove(K key);
+ method public boolean remove(K key, int value);
+ method public inline void removeIf(kotlin.jvm.functions.Function2<? super K,? super java.lang.Integer,java.lang.Boolean> predicate);
+ method public operator void set(K key, int value);
+ method public int trim();
+ }
+
+ public final class MutableObjectList<E> extends androidx.collection.ObjectList<E> {
+ ctor public MutableObjectList();
+ ctor public MutableObjectList(optional int initialCapacity);
+ method public boolean add(E element);
+ method public void add(@IntRange(from=0L) int index, E element);
+ method public boolean addAll(androidx.collection.ObjectList<E> elements);
+ method public boolean addAll(androidx.collection.ScatterSet<E> elements);
+ method public boolean addAll(E[] elements);
+ method public boolean addAll(@IntRange(from=0L) int index, androidx.collection.ObjectList<E> elements);
+ method public boolean addAll(@IntRange(from=0L) int index, E[] elements);
+ method public boolean addAll(@IntRange(from=0L) int index, java.util.Collection<? extends E> elements);
+ method public boolean addAll(Iterable<? extends E> elements);
+ method public boolean addAll(java.util.List<? extends E> elements);
+ method public boolean addAll(kotlin.sequences.Sequence<? extends E> elements);
+ method public java.util.List<E> asList();
+ method public java.util.List<E> asMutableList();
+ method public void clear();
+ method public inline void ensureCapacity(int capacity);
+ method public inline int getCapacity();
+ method public operator void minusAssign(androidx.collection.ObjectList<E> elements);
+ method public operator void minusAssign(androidx.collection.ScatterSet<E> elements);
+ method public inline operator void minusAssign(E element);
+ method public operator void minusAssign(E[] elements);
+ method public operator void minusAssign(Iterable<? extends E> elements);
+ method public operator void minusAssign(java.util.List<? extends E> elements);
+ method public operator void minusAssign(kotlin.sequences.Sequence<? extends E> elements);
+ method public operator void plusAssign(androidx.collection.ObjectList<E> elements);
+ method public operator void plusAssign(androidx.collection.ScatterSet<E> elements);
+ method public inline operator void plusAssign(E element);
+ method public operator void plusAssign(E[] elements);
+ method public operator void plusAssign(Iterable<? extends E> elements);
+ method public operator void plusAssign(java.util.List<? extends E> elements);
+ method public operator void plusAssign(kotlin.sequences.Sequence<? extends E> elements);
+ method public boolean remove(E element);
+ method public boolean removeAll(androidx.collection.ObjectList<E> elements);
+ method public boolean removeAll(androidx.collection.ScatterSet<E> elements);
+ method public boolean removeAll(E[] elements);
+ method public boolean removeAll(Iterable<? extends E> elements);
+ method public boolean removeAll(java.util.List<? extends E> elements);
+ method public boolean removeAll(kotlin.sequences.Sequence<? extends E> elements);
+ method public E removeAt(@IntRange(from=0L) int index);
+ method public inline void removeIf(kotlin.jvm.functions.Function1<? super E,java.lang.Boolean> predicate);
+ method public void removeRange(@IntRange(from=0L) int start, @IntRange(from=0L) int end);
+ method public boolean retainAll(androidx.collection.ObjectList<E> elements);
+ method public boolean retainAll(E[] elements);
+ method public boolean retainAll(Iterable<? extends E> elements);
+ method public boolean retainAll(java.util.Collection<? extends E> elements);
+ method public boolean retainAll(kotlin.sequences.Sequence<? extends E> elements);
+ method public operator E set(@IntRange(from=0L) int index, E element);
+ method public void trim(optional int minCapacity);
+ property public final inline int capacity;
+ }
+
+ public final class MutableObjectLongMap<K> extends androidx.collection.ObjectLongMap<K> {
+ ctor public MutableObjectLongMap();
+ ctor public MutableObjectLongMap(optional int initialCapacity);
+ method public void clear();
+ method public inline long getOrPut(K key, kotlin.jvm.functions.Function0<java.lang.Long> defaultValue);
+ method public inline operator void minusAssign(androidx.collection.ScatterSet<K> keys);
+ method public inline operator void minusAssign(Iterable<? extends K> keys);
+ method public inline operator void minusAssign(K key);
+ method public inline operator void minusAssign(K[] keys);
+ method public inline operator void minusAssign(kotlin.sequences.Sequence<? extends K> keys);
+ method public inline operator void plusAssign(androidx.collection.ObjectLongMap<K> from);
+ method public void put(K key, long value);
+ method public long put(K key, long value, long default);
+ method public void putAll(androidx.collection.ObjectLongMap<K> from);
+ method public void remove(K key);
+ method public boolean remove(K key, long value);
+ method public inline void removeIf(kotlin.jvm.functions.Function2<? super K,? super java.lang.Long,java.lang.Boolean> predicate);
+ method public operator void set(K key, long value);
+ method public int trim();
+ }
+
+ public final class MutableOrderedScatterSet<E> extends androidx.collection.OrderedScatterSet<E> {
+ ctor public MutableOrderedScatterSet();
+ ctor public MutableOrderedScatterSet(optional int initialCapacity);
+ method public boolean add(E element);
+ method public boolean addAll(androidx.collection.ObjectList<E> elements);
+ method public boolean addAll(androidx.collection.OrderedScatterSet<E> elements);
+ method public boolean addAll(androidx.collection.ScatterSet<E> elements);
+ method public boolean addAll(E[] elements);
+ method public boolean addAll(Iterable<? extends E> elements);
+ method public boolean addAll(kotlin.sequences.Sequence<? extends E> elements);
+ method public java.util.Set<E> asMutableSet();
+ method public void clear();
+ method public operator void minusAssign(androidx.collection.ObjectList<E> elements);
+ method public operator void minusAssign(androidx.collection.OrderedScatterSet<E> elements);
+ method public operator void minusAssign(androidx.collection.ScatterSet<E> elements);
+ method public operator void minusAssign(E element);
+ method public operator void minusAssign(E[] elements);
+ method public operator void minusAssign(Iterable<? extends E> elements);
+ method public operator void minusAssign(kotlin.sequences.Sequence<? extends E> elements);
+ method public operator void plusAssign(androidx.collection.ObjectList<E> elements);
+ method public operator void plusAssign(androidx.collection.OrderedScatterSet<E> elements);
+ method public operator void plusAssign(androidx.collection.ScatterSet<E> elements);
+ method public operator void plusAssign(E element);
+ method public operator void plusAssign(E[] elements);
+ method public operator void plusAssign(Iterable<? extends E> elements);
+ method public operator void plusAssign(kotlin.sequences.Sequence<? extends E> elements);
+ method public boolean remove(E element);
+ method public boolean removeAll(androidx.collection.ObjectList<E> elements);
+ method public boolean removeAll(androidx.collection.OrderedScatterSet<E> elements);
+ method public boolean removeAll(androidx.collection.ScatterSet<E> elements);
+ method public boolean removeAll(E[] elements);
+ method public boolean removeAll(Iterable<? extends E> elements);
+ method public boolean removeAll(kotlin.sequences.Sequence<? extends E> elements);
+ method public inline void removeIf(kotlin.jvm.functions.Function1<? super E,java.lang.Boolean> predicate);
+ method public boolean retainAll(androidx.collection.OrderedScatterSet<E> elements);
+ method public boolean retainAll(androidx.collection.ScatterSet<E> elements);
+ method public boolean retainAll(java.util.Collection<? extends E> elements);
+ method public inline boolean retainAll(kotlin.jvm.functions.Function1<? super E,java.lang.Boolean> predicate);
+ method @IntRange(from=0L) public int trim();
+ method public void trimToSize(int maxSize);
+ }
+
+ public final class MutableScatterMap<K, V> extends androidx.collection.ScatterMap<K,V> {
+ ctor public MutableScatterMap();
+ ctor public MutableScatterMap(optional int initialCapacity);
+ method public java.util.Map<K,V> asMutableMap();
+ method public void clear();
+ method public inline V compute(K key, kotlin.jvm.functions.Function2<? super K,? super V?,? extends V> computeBlock);
+ method public inline V getOrPut(K key, kotlin.jvm.functions.Function0<? extends V> defaultValue);
+ method public inline operator void minusAssign(androidx.collection.ObjectList<K> keys);
+ method public inline operator void minusAssign(androidx.collection.ScatterSet<K> keys);
+ method public inline operator void minusAssign(Iterable<? extends K> keys);
+ method public inline operator void minusAssign(K key);
+ method public inline operator void minusAssign(K[] keys);
+ method public inline operator void minusAssign(kotlin.sequences.Sequence<? extends K> keys);
+ method public inline operator void plusAssign(androidx.collection.ScatterMap<K,V> from);
+ method public inline operator void plusAssign(Iterable<? extends kotlin.Pair<? extends K,? extends V>> pairs);
+ method public inline operator void plusAssign(java.util.Map<K,? extends V> from);
+ method public inline operator void plusAssign(kotlin.Pair<? extends K,? extends V> pair);
+ method public inline operator void plusAssign(kotlin.Pair<? extends K,? extends V>[] pairs);
+ method public inline operator void plusAssign(kotlin.sequences.Sequence<? extends kotlin.Pair<? extends K,? extends V>> pairs);
+ method public V? put(K key, V value);
+ method public void putAll(androidx.collection.ScatterMap<K,V> from);
+ method public void putAll(Iterable<? extends kotlin.Pair<? extends K,? extends V>> pairs);
+ method public void putAll(java.util.Map<K,? extends V> from);
+ method public void putAll(kotlin.Pair<? extends K,? extends V>[] pairs);
+ method public void putAll(kotlin.sequences.Sequence<? extends kotlin.Pair<? extends K,? extends V>> pairs);
+ method public V? remove(K key);
+ method public boolean remove(K key, V value);
+ method public inline void removeIf(kotlin.jvm.functions.Function2<? super K,? super V,java.lang.Boolean> predicate);
+ method public operator void set(K key, V value);
+ method public int trim();
+ }
+
+ public final class MutableScatterSet<E> extends androidx.collection.ScatterSet<E> {
+ ctor public MutableScatterSet();
+ ctor public MutableScatterSet(optional int initialCapacity);
+ method public boolean add(E element);
+ method public boolean addAll(androidx.collection.ObjectList<E> elements);
+ method public boolean addAll(androidx.collection.OrderedScatterSet<E> elements);
+ method public boolean addAll(androidx.collection.ScatterSet<E> elements);
+ method public boolean addAll(E[] elements);
+ method public boolean addAll(Iterable<? extends E> elements);
+ method public boolean addAll(kotlin.sequences.Sequence<? extends E> elements);
+ method public java.util.Set<E> asMutableSet();
+ method public void clear();
+ method public operator void minusAssign(androidx.collection.ObjectList<E> elements);
+ method public operator void minusAssign(androidx.collection.OrderedScatterSet<E> elements);
+ method public operator void minusAssign(androidx.collection.ScatterSet<E> elements);
+ method public operator void minusAssign(E element);
+ method public operator void minusAssign(E[] elements);
+ method public operator void minusAssign(Iterable<? extends E> elements);
+ method public operator void minusAssign(kotlin.sequences.Sequence<? extends E> elements);
+ method public operator void plusAssign(androidx.collection.ObjectList<E> elements);
+ method public operator void plusAssign(androidx.collection.OrderedScatterSet<E> elements);
+ method public operator void plusAssign(androidx.collection.ScatterSet<E> elements);
+ method public operator void plusAssign(E element);
+ method public operator void plusAssign(E[] elements);
+ method public operator void plusAssign(Iterable<? extends E> elements);
+ method public operator void plusAssign(kotlin.sequences.Sequence<? extends E> elements);
+ method public boolean remove(E element);
+ method public boolean removeAll(androidx.collection.ObjectList<E> elements);
+ method public boolean removeAll(androidx.collection.OrderedScatterSet<E> elements);
+ method public boolean removeAll(androidx.collection.ScatterSet<E> elements);
+ method public boolean removeAll(E[] elements);
+ method public boolean removeAll(Iterable<? extends E> elements);
+ method public boolean removeAll(kotlin.sequences.Sequence<? extends E> elements);
+ method public inline void removeIf(kotlin.jvm.functions.Function1<? super E,java.lang.Boolean> predicate);
+ method public boolean retainAll(androidx.collection.OrderedScatterSet<E> elements);
+ method public boolean retainAll(androidx.collection.ScatterSet<E> elements);
+ method public boolean retainAll(java.util.Collection<? extends E> elements);
+ method public boolean retainAll(kotlin.jvm.functions.Function1<? super E,java.lang.Boolean> predicate);
+ method @IntRange(from=0L) public int trim();
+ }
+
+ public abstract sealed class ObjectFloatMap<K> {
+ method public final inline boolean all(kotlin.jvm.functions.Function2<? super K,? super java.lang.Float,java.lang.Boolean> predicate);
+ method public final boolean any();
+ method public final inline boolean any(kotlin.jvm.functions.Function2<? super K,? super java.lang.Float,java.lang.Boolean> predicate);
+ method public final inline operator boolean contains(K key);
+ method public final boolean containsKey(K key);
+ method public final boolean containsValue(float value);
+ method public final int count();
+ method public final inline int count(kotlin.jvm.functions.Function2<? super K,? super java.lang.Float,java.lang.Boolean> predicate);
+ method public final inline void forEach(kotlin.jvm.functions.Function2<? super K,? super java.lang.Float,kotlin.Unit> block);
+ method public final inline void forEachKey(kotlin.jvm.functions.Function1<? super K,kotlin.Unit> block);
+ method public final inline void forEachValue(kotlin.jvm.functions.Function1<? super java.lang.Float,kotlin.Unit> block);
+ method public final operator float get(K key);
+ method public final int getCapacity();
+ method public final float getOrDefault(K key, float defaultValue);
+ method public final inline float getOrElse(K key, kotlin.jvm.functions.Function0<java.lang.Float> defaultValue);
+ method public final int getSize();
+ method public final boolean isEmpty();
+ method public final boolean isNotEmpty();
+ method public final String joinToString();
+ method public final String joinToString(optional CharSequence separator);
+ method public final String joinToString(optional CharSequence separator, optional CharSequence prefix);
+ method public final String joinToString(optional CharSequence separator, optional CharSequence prefix, optional CharSequence postfix);
+ method public final String joinToString(optional CharSequence separator, optional CharSequence prefix, optional CharSequence postfix, optional int limit);
+ method public final String joinToString(optional CharSequence separator, optional CharSequence prefix, optional CharSequence postfix, optional int limit, optional CharSequence truncated);
+ method public final inline String joinToString(optional CharSequence separator, optional CharSequence prefix, optional CharSequence postfix, optional int limit, optional CharSequence truncated, kotlin.jvm.functions.Function2<? super K,? super java.lang.Float,? extends java.lang.CharSequence> transform);
+ method public final inline String joinToString(optional CharSequence separator, optional CharSequence prefix, optional CharSequence postfix, optional int limit, kotlin.jvm.functions.Function2<? super K,? super java.lang.Float,? extends java.lang.CharSequence> transform);
+ method public final inline String joinToString(optional CharSequence separator, optional CharSequence prefix, optional CharSequence postfix, kotlin.jvm.functions.Function2<? super K,? super java.lang.Float,? extends java.lang.CharSequence> transform);
+ method public final inline String joinToString(optional CharSequence separator, optional CharSequence prefix, kotlin.jvm.functions.Function2<? super K,? super java.lang.Float,? extends java.lang.CharSequence> transform);
+ method public final inline String joinToString(optional CharSequence separator, kotlin.jvm.functions.Function2<? super K,? super java.lang.Float,? extends java.lang.CharSequence> transform);
+ method public final inline String joinToString(kotlin.jvm.functions.Function2<? super K,? super java.lang.Float,? extends java.lang.CharSequence> transform);
+ method public final boolean none();
+ property public final int capacity;
+ property public final int size;
+ }
+
+ public final class ObjectFloatMapKt {
+ method public static inline <K> androidx.collection.ObjectFloatMap<K> buildObjectFloatMap(int initialCapacity, kotlin.jvm.functions.Function1<? super androidx.collection.MutableObjectFloatMap<K>,kotlin.Unit> builderAction);
+ method public static inline <K> androidx.collection.ObjectFloatMap<K> buildObjectFloatMap(kotlin.jvm.functions.Function1<? super androidx.collection.MutableObjectFloatMap<K>,kotlin.Unit> builderAction);
+ method public static <K> androidx.collection.ObjectFloatMap<K> emptyObjectFloatMap();
+ method public static <K> androidx.collection.MutableObjectFloatMap<K> mutableObjectFloatMapOf();
+ method public static <K> androidx.collection.MutableObjectFloatMap<K> mutableObjectFloatMapOf(K key1, float value1);
+ method public static <K> androidx.collection.MutableObjectFloatMap<K> mutableObjectFloatMapOf(K key1, float value1, K key2, float value2);
+ method public static <K> androidx.collection.MutableObjectFloatMap<K> mutableObjectFloatMapOf(K key1, float value1, K key2, float value2, K key3, float value3);
+ method public static <K> androidx.collection.MutableObjectFloatMap<K> mutableObjectFloatMapOf(K key1, float value1, K key2, float value2, K key3, float value3, K key4, float value4);
+ method public static <K> androidx.collection.MutableObjectFloatMap<K> mutableObjectFloatMapOf(K key1, float value1, K key2, float value2, K key3, float value3, K key4, float value4, K key5, float value5);
+ method public static <K> androidx.collection.ObjectFloatMap<K> objectFloatMap();
+ method public static <K> androidx.collection.ObjectFloatMap<K> objectFloatMapOf(K key1, float value1);
+ method public static <K> androidx.collection.ObjectFloatMap<K> objectFloatMapOf(K key1, float value1, K key2, float value2);
+ method public static <K> androidx.collection.ObjectFloatMap<K> objectFloatMapOf(K key1, float value1, K key2, float value2, K key3, float value3);
+ method public static <K> androidx.collection.ObjectFloatMap<K> objectFloatMapOf(K key1, float value1, K key2, float value2, K key3, float value3, K key4, float value4);
+ method public static <K> androidx.collection.ObjectFloatMap<K> objectFloatMapOf(K key1, float value1, K key2, float value2, K key3, float value3, K key4, float value4, K key5, float value5);
+ }
+
+ public abstract sealed class ObjectIntMap<K> {
+ method public final inline boolean all(kotlin.jvm.functions.Function2<? super K,? super java.lang.Integer,java.lang.Boolean> predicate);
+ method public final boolean any();
+ method public final inline boolean any(kotlin.jvm.functions.Function2<? super K,? super java.lang.Integer,java.lang.Boolean> predicate);
+ method public final inline operator boolean contains(K key);
+ method public final boolean containsKey(K key);
+ method public final boolean containsValue(int value);
+ method public final int count();
+ method public final inline int count(kotlin.jvm.functions.Function2<? super K,? super java.lang.Integer,java.lang.Boolean> predicate);
+ method public final inline void forEach(kotlin.jvm.functions.Function2<? super K,? super java.lang.Integer,kotlin.Unit> block);
+ method public final inline void forEachKey(kotlin.jvm.functions.Function1<? super K,kotlin.Unit> block);
+ method public final inline void forEachValue(kotlin.jvm.functions.Function1<? super java.lang.Integer,kotlin.Unit> block);
+ method public final operator int get(K key);
+ method public final int getCapacity();
+ method public final int getOrDefault(K key, int defaultValue);
+ method public final inline int getOrElse(K key, kotlin.jvm.functions.Function0<java.lang.Integer> defaultValue);
+ method public final int getSize();
+ method public final boolean isEmpty();
+ method public final boolean isNotEmpty();
+ method public final String joinToString();
+ method public final String joinToString(optional CharSequence separator);
+ method public final String joinToString(optional CharSequence separator, optional CharSequence prefix);
+ method public final String joinToString(optional CharSequence separator, optional CharSequence prefix, optional CharSequence postfix);
+ method public final String joinToString(optional CharSequence separator, optional CharSequence prefix, optional CharSequence postfix, optional int limit);
+ method public final String joinToString(optional CharSequence separator, optional CharSequence prefix, optional CharSequence postfix, optional int limit, optional CharSequence truncated);
+ method public final inline String joinToString(optional CharSequence separator, optional CharSequence prefix, optional CharSequence postfix, optional int limit, optional CharSequence truncated, kotlin.jvm.functions.Function2<? super K,? super java.lang.Integer,? extends java.lang.CharSequence> transform);
+ method public final inline String joinToString(optional CharSequence separator, optional CharSequence prefix, optional CharSequence postfix, optional int limit, kotlin.jvm.functions.Function2<? super K,? super java.lang.Integer,? extends java.lang.CharSequence> transform);
+ method public final inline String joinToString(optional CharSequence separator, optional CharSequence prefix, optional CharSequence postfix, kotlin.jvm.functions.Function2<? super K,? super java.lang.Integer,? extends java.lang.CharSequence> transform);
+ method public final inline String joinToString(optional CharSequence separator, optional CharSequence prefix, kotlin.jvm.functions.Function2<? super K,? super java.lang.Integer,? extends java.lang.CharSequence> transform);
+ method public final inline String joinToString(optional CharSequence separator, kotlin.jvm.functions.Function2<? super K,? super java.lang.Integer,? extends java.lang.CharSequence> transform);
+ method public final inline String joinToString(kotlin.jvm.functions.Function2<? super K,? super java.lang.Integer,? extends java.lang.CharSequence> transform);
+ method public final boolean none();
+ property public final int capacity;
+ property public final int size;
+ }
+
+ public final class ObjectIntMapKt {
+ method public static inline <K> androidx.collection.ObjectIntMap<K> buildObjectIntMap(int initialCapacity, kotlin.jvm.functions.Function1<? super androidx.collection.MutableObjectIntMap<K>,kotlin.Unit> builderAction);
+ method public static inline <K> androidx.collection.ObjectIntMap<K> buildObjectIntMap(kotlin.jvm.functions.Function1<? super androidx.collection.MutableObjectIntMap<K>,kotlin.Unit> builderAction);
+ method public static <K> androidx.collection.ObjectIntMap<K> emptyObjectIntMap();
+ method public static <K> androidx.collection.MutableObjectIntMap<K> mutableObjectIntMapOf();
+ method public static <K> androidx.collection.MutableObjectIntMap<K> mutableObjectIntMapOf(K key1, int value1);
+ method public static <K> androidx.collection.MutableObjectIntMap<K> mutableObjectIntMapOf(K key1, int value1, K key2, int value2);
+ method public static <K> androidx.collection.MutableObjectIntMap<K> mutableObjectIntMapOf(K key1, int value1, K key2, int value2, K key3, int value3);
+ method public static <K> androidx.collection.MutableObjectIntMap<K> mutableObjectIntMapOf(K key1, int value1, K key2, int value2, K key3, int value3, K key4, int value4);
+ method public static <K> androidx.collection.MutableObjectIntMap<K> mutableObjectIntMapOf(K key1, int value1, K key2, int value2, K key3, int value3, K key4, int value4, K key5, int value5);
+ method public static <K> androidx.collection.ObjectIntMap<K> objectIntMap();
+ method public static <K> androidx.collection.ObjectIntMap<K> objectIntMapOf(K key1, int value1);
+ method public static <K> androidx.collection.ObjectIntMap<K> objectIntMapOf(K key1, int value1, K key2, int value2);
+ method public static <K> androidx.collection.ObjectIntMap<K> objectIntMapOf(K key1, int value1, K key2, int value2, K key3, int value3);
+ method public static <K> androidx.collection.ObjectIntMap<K> objectIntMapOf(K key1, int value1, K key2, int value2, K key3, int value3, K key4, int value4);
+ method public static <K> androidx.collection.ObjectIntMap<K> objectIntMapOf(K key1, int value1, K key2, int value2, K key3, int value3, K key4, int value4, K key5, int value5);
+ }
+
+ public abstract sealed class ObjectList<E> {
+ method public final boolean any();
+ method public final inline boolean any(kotlin.jvm.functions.Function1<? super E,java.lang.Boolean> predicate);
+ method public abstract java.util.List<E> asList();
+ method public final operator boolean contains(E element);
+ method public final boolean containsAll(androidx.collection.ObjectList<E> elements);
+ method public final boolean containsAll(E[] elements);
+ method public final boolean containsAll(Iterable<? extends E> elements);
+ method public final boolean containsAll(java.util.List<? extends E> elements);
+ method public final int count();
+ method public final inline int count(kotlin.jvm.functions.Function1<? super E,java.lang.Boolean> predicate);
+ method public final E elementAt(@IntRange(from=0L) int index);
+ method public final inline E elementAtOrElse(@IntRange(from=0L) int index, kotlin.jvm.functions.Function1<? super java.lang.Integer,? extends E> defaultValue);
+ method public final E first();
+ method public final inline E first(kotlin.jvm.functions.Function1<? super E,java.lang.Boolean> predicate);
+ method public final inline E? firstOrNull();
+ method public final inline E? firstOrNull(kotlin.jvm.functions.Function1<? super E,java.lang.Boolean> predicate);
+ method public final inline <R> R fold(R initial, kotlin.jvm.functions.Function2<? super R,? super E,? extends R> operation);
+ method public final inline <R> R foldIndexed(R initial, kotlin.jvm.functions.Function3<? super java.lang.Integer,? super R,? super E,? extends R> operation);
+ method public final inline <R> R foldRight(R initial, kotlin.jvm.functions.Function2<? super E,? super R,? extends R> operation);
+ method public final inline <R> R foldRightIndexed(R initial, kotlin.jvm.functions.Function3<? super java.lang.Integer,? super E,? super R,? extends R> operation);
+ method public final inline void forEach(kotlin.jvm.functions.Function1<? super E,kotlin.Unit> block);
+ method public final inline void forEachIndexed(kotlin.jvm.functions.Function2<? super java.lang.Integer,? super E,kotlin.Unit> block);
+ method public final inline void forEachReversed(kotlin.jvm.functions.Function1<? super E,kotlin.Unit> block);
+ method public final inline void forEachReversedIndexed(kotlin.jvm.functions.Function2<? super java.lang.Integer,? super E,kotlin.Unit> block);
+ method public final operator E get(@IntRange(from=0L) int index);
+ method public final inline kotlin.ranges.IntRange getIndices();
+ method @IntRange(from=-1L) public final inline int getLastIndex();
+ method @IntRange(from=0L) public final int getSize();
+ method public final int indexOf(E element);
+ method public final inline int indexOfFirst(kotlin.jvm.functions.Function1<? super E,java.lang.Boolean> predicate);
+ method public final inline int indexOfLast(kotlin.jvm.functions.Function1<? super E,java.lang.Boolean> predicate);
+ method public final boolean isEmpty();
+ method public final boolean isNotEmpty();
+ method public final String joinToString();
+ method public final String joinToString(optional CharSequence separator);
+ method public final String joinToString(optional CharSequence separator, optional CharSequence prefix);
+ method public final String joinToString(optional CharSequence separator, optional CharSequence prefix, optional CharSequence postfix);
+ method public final String joinToString(optional CharSequence separator, optional CharSequence prefix, optional CharSequence postfix, optional int limit);
+ method public final String joinToString(optional CharSequence separator, optional CharSequence prefix, optional CharSequence postfix, optional int limit, optional CharSequence truncated);
+ method public final String joinToString(optional CharSequence separator, optional CharSequence prefix, optional CharSequence postfix, optional int limit, optional CharSequence truncated, optional kotlin.jvm.functions.Function1<? super E,? extends java.lang.CharSequence>? transform);
+ method public final E last();
+ method public final inline E last(kotlin.jvm.functions.Function1<? super E,java.lang.Boolean> predicate);
+ method public final int lastIndexOf(E element);
+ method public final inline E? lastOrNull();
+ method public final inline E? lastOrNull(kotlin.jvm.functions.Function1<? super E,java.lang.Boolean> predicate);
+ method public final boolean none();
+ method public final inline boolean reversedAny(kotlin.jvm.functions.Function1<? super E,java.lang.Boolean> predicate);
+ property public final inline kotlin.ranges.IntRange indices;
+ property @IntRange(from=-1L) public final inline int lastIndex;
+ property @IntRange(from=0L) public final int size;
+ }
+
+ public final class ObjectListKt {
+ method public static <E> androidx.collection.ObjectList<E> emptyObjectList();
+ method public static inline <E> androidx.collection.MutableObjectList<E> mutableObjectListOf();
+ method public static <E> androidx.collection.MutableObjectList<E> mutableObjectListOf(E element1);
+ method public static <E> androidx.collection.MutableObjectList<E> mutableObjectListOf(E element1, E element2);
+ method public static <E> androidx.collection.MutableObjectList<E> mutableObjectListOf(E element1, E element2, E element3);
+ method public static inline <E> androidx.collection.MutableObjectList<E> mutableObjectListOf(E... elements);
+ method public static <E> androidx.collection.ObjectList<E> objectListOf();
+ method public static <E> androidx.collection.ObjectList<E> objectListOf(E element1);
+ method public static <E> androidx.collection.ObjectList<E> objectListOf(E element1, E element2);
+ method public static <E> androidx.collection.ObjectList<E> objectListOf(E element1, E element2, E element3);
+ method public static <E> androidx.collection.ObjectList<E> objectListOf(E... elements);
+ }
+
+ public abstract sealed class ObjectLongMap<K> {
+ method public final inline boolean all(kotlin.jvm.functions.Function2<? super K,? super java.lang.Long,java.lang.Boolean> predicate);
+ method public final boolean any();
+ method public final inline boolean any(kotlin.jvm.functions.Function2<? super K,? super java.lang.Long,java.lang.Boolean> predicate);
+ method public final inline operator boolean contains(K key);
+ method public final boolean containsKey(K key);
+ method public final boolean containsValue(long value);
+ method public final int count();
+ method public final inline int count(kotlin.jvm.functions.Function2<? super K,? super java.lang.Long,java.lang.Boolean> predicate);
+ method public final inline void forEach(kotlin.jvm.functions.Function2<? super K,? super java.lang.Long,kotlin.Unit> block);
+ method public final inline void forEachKey(kotlin.jvm.functions.Function1<? super K,kotlin.Unit> block);
+ method public final inline void forEachValue(kotlin.jvm.functions.Function1<? super java.lang.Long,kotlin.Unit> block);
+ method public final operator long get(K key);
+ method public final int getCapacity();
+ method public final long getOrDefault(K key, long defaultValue);
+ method public final inline long getOrElse(K key, kotlin.jvm.functions.Function0<java.lang.Long> defaultValue);
+ method public final int getSize();
+ method public final boolean isEmpty();
+ method public final boolean isNotEmpty();
+ method public final String joinToString();
+ method public final String joinToString(optional CharSequence separator);
+ method public final String joinToString(optional CharSequence separator, optional CharSequence prefix);
+ method public final String joinToString(optional CharSequence separator, optional CharSequence prefix, optional CharSequence postfix);
+ method public final String joinToString(optional CharSequence separator, optional CharSequence prefix, optional CharSequence postfix, optional int limit);
+ method public final String joinToString(optional CharSequence separator, optional CharSequence prefix, optional CharSequence postfix, optional int limit, optional CharSequence truncated);
+ method public final inline String joinToString(optional CharSequence separator, optional CharSequence prefix, optional CharSequence postfix, optional int limit, optional CharSequence truncated, kotlin.jvm.functions.Function2<? super K,? super java.lang.Long,? extends java.lang.CharSequence> transform);
+ method public final inline String joinToString(optional CharSequence separator, optional CharSequence prefix, optional CharSequence postfix, optional int limit, kotlin.jvm.functions.Function2<? super K,? super java.lang.Long,? extends java.lang.CharSequence> transform);
+ method public final inline String joinToString(optional CharSequence separator, optional CharSequence prefix, optional CharSequence postfix, kotlin.jvm.functions.Function2<? super K,? super java.lang.Long,? extends java.lang.CharSequence> transform);
+ method public final inline String joinToString(optional CharSequence separator, optional CharSequence prefix, kotlin.jvm.functions.Function2<? super K,? super java.lang.Long,? extends java.lang.CharSequence> transform);
+ method public final inline String joinToString(optional CharSequence separator, kotlin.jvm.functions.Function2<? super K,? super java.lang.Long,? extends java.lang.CharSequence> transform);
+ method public final inline String joinToString(kotlin.jvm.functions.Function2<? super K,? super java.lang.Long,? extends java.lang.CharSequence> transform);
+ method public final boolean none();
+ property public final int capacity;
+ property public final int size;
+ }
+
+ public final class ObjectLongMapKt {
+ method public static inline <K> androidx.collection.ObjectLongMap<K> buildObjectLongMap(int initialCapacity, kotlin.jvm.functions.Function1<? super androidx.collection.MutableObjectLongMap<K>,kotlin.Unit> builderAction);
+ method public static inline <K> androidx.collection.ObjectLongMap<K> buildObjectLongMap(kotlin.jvm.functions.Function1<? super androidx.collection.MutableObjectLongMap<K>,kotlin.Unit> builderAction);
+ method public static <K> androidx.collection.ObjectLongMap<K> emptyObjectLongMap();
+ method public static <K> androidx.collection.MutableObjectLongMap<K> mutableObjectLongMapOf();
+ method public static <K> androidx.collection.MutableObjectLongMap<K> mutableObjectLongMapOf(K key1, long value1);
+ method public static <K> androidx.collection.MutableObjectLongMap<K> mutableObjectLongMapOf(K key1, long value1, K key2, long value2);
+ method public static <K> androidx.collection.MutableObjectLongMap<K> mutableObjectLongMapOf(K key1, long value1, K key2, long value2, K key3, long value3);
+ method public static <K> androidx.collection.MutableObjectLongMap<K> mutableObjectLongMapOf(K key1, long value1, K key2, long value2, K key3, long value3, K key4, long value4);
+ method public static <K> androidx.collection.MutableObjectLongMap<K> mutableObjectLongMapOf(K key1, long value1, K key2, long value2, K key3, long value3, K key4, long value4, K key5, long value5);
+ method public static <K> androidx.collection.ObjectLongMap<K> objectLongMap();
+ method public static <K> androidx.collection.ObjectLongMap<K> objectLongMapOf(K key1, long value1);
+ method public static <K> androidx.collection.ObjectLongMap<K> objectLongMapOf(K key1, long value1, K key2, long value2);
+ method public static <K> androidx.collection.ObjectLongMap<K> objectLongMapOf(K key1, long value1, K key2, long value2, K key3, long value3);
+ method public static <K> androidx.collection.ObjectLongMap<K> objectLongMapOf(K key1, long value1, K key2, long value2, K key3, long value3, K key4, long value4);
+ method public static <K> androidx.collection.ObjectLongMap<K> objectLongMapOf(K key1, long value1, K key2, long value2, K key3, long value3, K key4, long value4, K key5, long value5);
+ }
+
+ public abstract sealed class OrderedScatterSet<E> {
+ method public final inline boolean all(kotlin.jvm.functions.Function1<? super E,java.lang.Boolean> predicate);
+ method public final boolean any();
+ method public final inline boolean any(kotlin.jvm.functions.Function1<? super E,java.lang.Boolean> predicate);
+ method public final java.util.Set<E> asSet();
+ method public final operator boolean contains(E element);
+ method @IntRange(from=0L) public final int count();
+ method @IntRange(from=0L) public final inline int count(kotlin.jvm.functions.Function1<? super E,java.lang.Boolean> predicate);
+ method public final E first();
+ method public final inline E first(kotlin.jvm.functions.Function1<? super E,java.lang.Boolean> predicate);
+ method public final inline E? firstOrNull(kotlin.jvm.functions.Function1<? super E,java.lang.Boolean> predicate);
+ method public final inline void forEach(kotlin.jvm.functions.Function1<? super E,kotlin.Unit> block);
+ method public final inline void forEachReverse(kotlin.jvm.functions.Function1<? super E,kotlin.Unit> block);
+ method @IntRange(from=0L) public final int getCapacity();
+ method @IntRange(from=0L) public final int getSize();
+ method public final boolean isEmpty();
+ method public final boolean isNotEmpty();
+ method public final String joinToString();
+ method public final String joinToString(optional CharSequence separator);
+ method public final String joinToString(optional CharSequence separator, optional CharSequence prefix);
+ method public final String joinToString(optional CharSequence separator, optional CharSequence prefix, optional CharSequence postfix);
+ method public final String joinToString(optional CharSequence separator, optional CharSequence prefix, optional CharSequence postfix, optional int limit);
+ method public final String joinToString(optional CharSequence separator, optional CharSequence prefix, optional CharSequence postfix, optional int limit, optional CharSequence truncated);
+ method public final String joinToString(optional CharSequence separator, optional CharSequence prefix, optional CharSequence postfix, optional int limit, optional CharSequence truncated, optional kotlin.jvm.functions.Function1<? super E,? extends java.lang.CharSequence>? transform);
+ method public final E last();
+ method public final inline E last(kotlin.jvm.functions.Function1<? super E,java.lang.Boolean> predicate);
+ method public final inline E? lastOrNull(kotlin.jvm.functions.Function1<? super E,java.lang.Boolean> predicate);
+ method public final boolean none();
+ method public final inline java.util.List<E> toList();
+ property @IntRange(from=0L) public final int capacity;
+ property @IntRange(from=0L) public final int size;
+ }
+
+ public final class OrderedScatterSetKt {
+ method public static <E> androidx.collection.OrderedScatterSet<E> emptyOrderedScatterSet();
+ method public static <E> androidx.collection.MutableOrderedScatterSet<E> mutableOrderedScatterSetOf();
+ method public static <E> androidx.collection.MutableOrderedScatterSet<E> mutableOrderedScatterSetOf(E element1);
+ method public static <E> androidx.collection.MutableOrderedScatterSet<E> mutableOrderedScatterSetOf(E element1, E element2);
+ method public static <E> androidx.collection.MutableOrderedScatterSet<E> mutableOrderedScatterSetOf(E element1, E element2, E element3);
+ method public static <E> androidx.collection.MutableOrderedScatterSet<E> mutableOrderedScatterSetOf(E... elements);
+ method public static <E> androidx.collection.OrderedScatterSet<E> orderedScatterSetOf();
+ method public static <E> androidx.collection.OrderedScatterSet<E> orderedScatterSetOf(E element1);
+ method public static <E> androidx.collection.OrderedScatterSet<E> orderedScatterSetOf(E element1, E element2);
+ method public static <E> androidx.collection.OrderedScatterSet<E> orderedScatterSetOf(E element1, E element2, E element3);
+ method public static <E> androidx.collection.OrderedScatterSet<E> orderedScatterSetOf(E... elements);
+ }
+
+ public abstract sealed class ScatterMap<K, V> {
+ method public final inline boolean all(kotlin.jvm.functions.Function2<? super K,? super V,java.lang.Boolean> predicate);
+ method public final boolean any();
+ method public final inline boolean any(kotlin.jvm.functions.Function2<? super K,? super V,java.lang.Boolean> predicate);
+ method public final java.util.Map<K,V> asMap();
+ method public final operator boolean contains(K key);
+ method public final boolean containsKey(K key);
+ method public final boolean containsValue(V value);
+ method public final int count();
+ method public final inline int count(kotlin.jvm.functions.Function2<? super K,? super V,java.lang.Boolean> predicate);
+ method public final inline void forEach(kotlin.jvm.functions.Function2<? super K,? super V,kotlin.Unit> block);
+ method public final inline void forEachKey(kotlin.jvm.functions.Function1<? super K,kotlin.Unit> block);
+ method public final inline void forEachValue(kotlin.jvm.functions.Function1<? super V,kotlin.Unit> block);
+ method public final operator V? get(K key);
+ method public final int getCapacity();
+ method public final V getOrDefault(K key, V defaultValue);
+ method public final inline V getOrElse(K key, kotlin.jvm.functions.Function0<? extends V> defaultValue);
+ method public final int getSize();
+ method public final boolean isEmpty();
+ method public final boolean isNotEmpty();
+ method public final String joinToString();
+ method public final String joinToString(optional CharSequence separator);
+ method public final String joinToString(optional CharSequence separator, optional CharSequence prefix);
+ method public final String joinToString(optional CharSequence separator, optional CharSequence prefix, optional CharSequence postfix);
+ method public final String joinToString(optional CharSequence separator, optional CharSequence prefix, optional CharSequence postfix, optional int limit);
+ method public final String joinToString(optional CharSequence separator, optional CharSequence prefix, optional CharSequence postfix, optional int limit, optional CharSequence truncated);
+ method public final String joinToString(optional CharSequence separator, optional CharSequence prefix, optional CharSequence postfix, optional int limit, optional CharSequence truncated, optional kotlin.jvm.functions.Function2<? super K,? super V,? extends java.lang.CharSequence>? transform);
+ method public final boolean none();
+ property public final int capacity;
+ property public final int size;
+ }
+
+ public final class ScatterMapKt {
+ method public static <K, V> androidx.collection.ScatterMap<K,V> emptyScatterMap();
+ method public static <K, V> androidx.collection.MutableScatterMap<K,V> mutableScatterMapOf();
+ method public static <K, V> androidx.collection.MutableScatterMap<K,V> mutableScatterMapOf(kotlin.Pair<? extends K,? extends V>... pairs);
+ }
+
+ public abstract sealed class ScatterSet<E> {
+ method public final inline boolean all(kotlin.jvm.functions.Function1<? super E,java.lang.Boolean> predicate);
+ method public final boolean any();
+ method public final inline boolean any(kotlin.jvm.functions.Function1<? super E,java.lang.Boolean> predicate);
+ method public final java.util.Set<E> asSet();
+ method public final operator boolean contains(E element);
+ method @IntRange(from=0L) public final int count();
+ method @IntRange(from=0L) public final inline int count(kotlin.jvm.functions.Function1<? super E,java.lang.Boolean> predicate);
+ method public final E first();
+ method public final inline E first(kotlin.jvm.functions.Function1<? super E,java.lang.Boolean> predicate);
+ method public final inline E? firstOrNull(kotlin.jvm.functions.Function1<? super E,java.lang.Boolean> predicate);
+ method public final inline void forEach(kotlin.jvm.functions.Function1<? super E,kotlin.Unit> block);
+ method @IntRange(from=0L) public final int getCapacity();
+ method @IntRange(from=0L) public final int getSize();
+ method public final boolean isEmpty();
+ method public final boolean isNotEmpty();
+ method public final String joinToString();
+ method public final String joinToString(optional CharSequence separator);
+ method public final String joinToString(optional CharSequence separator, optional CharSequence prefix);
+ method public final String joinToString(optional CharSequence separator, optional CharSequence prefix, optional CharSequence postfix);
+ method public final String joinToString(optional CharSequence separator, optional CharSequence prefix, optional CharSequence postfix, optional int limit);
+ method public final String joinToString(optional CharSequence separator, optional CharSequence prefix, optional CharSequence postfix, optional int limit, optional CharSequence truncated);
+ method public final String joinToString(optional CharSequence separator, optional CharSequence prefix, optional CharSequence postfix, optional int limit, optional CharSequence truncated, optional kotlin.jvm.functions.Function1<? super E,? extends java.lang.CharSequence>? transform);
+ method public final boolean none();
+ property @IntRange(from=0L) public final int capacity;
+ property @IntRange(from=0L) public final int size;
+ }
+
+ public final class ScatterSetKt {
+ method public static <E> androidx.collection.ScatterSet<E> emptyScatterSet();
+ method public static <E> androidx.collection.MutableScatterSet<E> mutableScatterSetOf();
+ method public static <E> androidx.collection.MutableScatterSet<E> mutableScatterSetOf(E element1);
+ method public static <E> androidx.collection.MutableScatterSet<E> mutableScatterSetOf(E element1, E element2);
+ method public static <E> androidx.collection.MutableScatterSet<E> mutableScatterSetOf(E element1, E element2, E element3);
+ method public static <E> androidx.collection.MutableScatterSet<E> mutableScatterSetOf(E... elements);
+ method public static <E> androidx.collection.ScatterSet<E> scatterSetOf();
+ method public static <E> androidx.collection.ScatterSet<E> scatterSetOf(E element1);
+ method public static <E> androidx.collection.ScatterSet<E> scatterSetOf(E element1, E element2);
+ method public static <E> androidx.collection.ScatterSet<E> scatterSetOf(E element1, E element2, E element3);
+ method public static <E> androidx.collection.ScatterSet<E> scatterSetOf(E... elements);
+ }
+
+ public final class SieveCache<K, V> {
+ ctor public SieveCache(@IntRange(from=1L, to=androidx.collection.SieveCacheKt.MaxSize) int maxSize, optional @IntRange(from=0L, to=androidx.collection.SieveCacheKt.MaxSize) int initialCapacity, optional kotlin.jvm.functions.Function2<? super K,? super V,java.lang.Integer> sizeOf, optional kotlin.jvm.functions.Function1<? super K,? extends V?> createValueFromKey, optional kotlin.jvm.functions.Function4<? super K,? super V,? super V?,? super java.lang.Boolean,kotlin.Unit> onEntryRemoved);
+ method public inline boolean all(kotlin.jvm.functions.Function2<? super K,? super V,java.lang.Boolean> predicate);
+ method public boolean any();
+ method public inline boolean any(kotlin.jvm.functions.Function2<? super K,? super V,java.lang.Boolean> predicate);
+ method public operator boolean contains(K key);
+ method public boolean containsKey(K key);
+ method public boolean containsValue(V value);
+ method public int count();
+ method public inline int count(kotlin.jvm.functions.Function2<? super K,? super V,java.lang.Boolean> predicate);
+ method public void evictAll();
+ method public inline void forEach(kotlin.jvm.functions.Function2<? super K,? super V,kotlin.Unit> block);
+ method public inline void forEachKey(kotlin.jvm.functions.Function1<? super K,kotlin.Unit> block);
+ method public inline void forEachValue(kotlin.jvm.functions.Function1<? super V,kotlin.Unit> block);
+ method public operator V? get(K key);
+ method public int getCapacity();
+ method public int getCount();
+ method public int getMaxSize();
+ method public int getSize();
+ method public boolean isEmpty();
+ method public boolean isNotEmpty();
+ method public inline operator void minusAssign(androidx.collection.ObjectList<K> keys);
+ method public inline operator void minusAssign(androidx.collection.ScatterSet<K> keys);
+ method public inline operator void minusAssign(Iterable<? extends K> keys);
+ method public inline operator void minusAssign(K key);
+ method public inline operator void minusAssign(K[] keys);
+ method public inline operator void minusAssign(kotlin.sequences.Sequence<? extends K> keys);
+ method public boolean none();
+ method public inline operator void plusAssign(androidx.collection.ScatterMap<K,V> from);
+ method public inline operator void plusAssign(androidx.collection.SieveCache<K,V> from);
+ method public inline operator void plusAssign(Iterable<? extends kotlin.Pair<? extends K,? extends V>> pairs);
+ method public inline operator void plusAssign(java.util.Map<K,? extends V> from);
+ method public inline operator void plusAssign(kotlin.Pair<? extends K,? extends V> pair);
+ method public inline operator void plusAssign(kotlin.Pair<? extends K,? extends V>[] pairs);
+ method public inline operator void plusAssign(kotlin.sequences.Sequence<? extends kotlin.Pair<? extends K,? extends V>> pairs);
+ method public V? put(K key, V value);
+ method public void putAll(androidx.collection.ScatterMap<K,V> from);
+ method public void putAll(androidx.collection.SieveCache<K,V> from);
+ method public void putAll(Iterable<? extends kotlin.Pair<? extends K,? extends V>> pairs);
+ method public void putAll(java.util.Map<K,? extends V> from);
+ method public void putAll(kotlin.Pair<? extends K,? extends V>[] pairs);
+ method public void putAll(kotlin.sequences.Sequence<? extends kotlin.Pair<? extends K,? extends V>> pairs);
+ method public V? remove(K key);
+ method public boolean remove(K key, V value);
+ method public void removeIf(kotlin.jvm.functions.Function2<? super K,? super V,java.lang.Boolean> predicate);
+ method public void resize(@IntRange(from=1L, to=androidx.collection.SieveCacheKt.MaxSize) int maxSize);
+ method public inline operator void set(K key, V value);
+ method public void trimToSize(int maxSize);
+ property public final int capacity;
+ property public final int count;
+ property public final int maxSize;
+ property public final int size;
+ }
+
+ public class SimpleArrayMap<K, V> {
+ ctor public SimpleArrayMap();
+ ctor public SimpleArrayMap(androidx.collection.SimpleArrayMap<? extends K,? extends V>? map);
+ ctor public SimpleArrayMap(optional int capacity);
+ method public void clear();
+ method public boolean containsKey(K key);
+ method public boolean containsValue(V value);
+ method public void ensureCapacity(int minimumCapacity);
+ method public operator V? get(K key);
+ method public V getOrDefault(Object? key, V defaultValue);
+ method public int indexOfKey(K key);
+ method public boolean isEmpty();
+ method public K keyAt(int index);
+ method public V? put(K key, V value);
+ method public void putAll(androidx.collection.SimpleArrayMap<? extends K,? extends V> map);
+ method public V? putIfAbsent(K key, V value);
+ method public V? remove(K key);
+ method public boolean remove(K key, V value);
+ method public V removeAt(int index);
+ method public V? replace(K key, V value);
+ method public boolean replace(K key, V oldValue, V newValue);
+ method public V setValueAt(int index, V value);
+ method public int size();
+ method public V valueAt(int index);
+ }
+
+ public class SparseArrayCompat<E> implements java.lang.Cloneable {
+ ctor public SparseArrayCompat();
+ ctor public SparseArrayCompat(optional int initialCapacity);
+ method public void append(int key, E value);
+ method public void clear();
+ method public androidx.collection.SparseArrayCompat<E> clone();
+ method public boolean containsKey(int key);
+ method public boolean containsValue(E value);
+ method @Deprecated public void delete(int key);
+ method public operator E? get(int key);
+ method public E get(int key, E defaultValue);
+ method public final boolean getIsEmpty();
+ method public int indexOfKey(int key);
+ method public int indexOfValue(E value);
+ method public boolean isEmpty();
+ method public int keyAt(int index);
+ method public void put(int key, E value);
+ method public void putAll(androidx.collection.SparseArrayCompat<? extends E> other);
+ method public E? putIfAbsent(int key, E value);
+ method public void remove(int key);
+ method public boolean remove(int key, Object? value);
+ method public void removeAt(int index);
+ method public void removeAtRange(int index, int size);
+ method public E? replace(int key, E value);
+ method public boolean replace(int key, E oldValue, E newValue);
+ method public void setValueAt(int index, E value);
+ method public int size();
+ method public E valueAt(int index);
+ property public final boolean isEmpty;
+ }
+
+ public final class SparseArrayKt {
+ method public static inline operator <T> boolean contains(androidx.collection.SparseArrayCompat<T>, int key);
+ method public static inline <T> void forEach(androidx.collection.SparseArrayCompat<T>, kotlin.jvm.functions.Function2<? super java.lang.Integer,? super T,kotlin.Unit> action);
+ method public static inline <T> T getOrDefault(androidx.collection.SparseArrayCompat<T>, int key, T defaultValue);
+ method public static inline <T> T getOrElse(androidx.collection.SparseArrayCompat<T>, int key, kotlin.jvm.functions.Function0<? extends T> defaultValue);
+ method public static inline <T> int getSize(androidx.collection.SparseArrayCompat<T>);
+ method public static inline <T> boolean isNotEmpty(androidx.collection.SparseArrayCompat<T>);
+ method public static <T> kotlin.collections.IntIterator keyIterator(androidx.collection.SparseArrayCompat<T>);
+ method public static operator <T> androidx.collection.SparseArrayCompat<T> plus(androidx.collection.SparseArrayCompat<T>, androidx.collection.SparseArrayCompat<T> other);
+ method @Deprecated public static <T> boolean remove(androidx.collection.SparseArrayCompat<T>, int key, T value);
+ method public static inline operator <T> void set(androidx.collection.SparseArrayCompat<T>, int key, T value);
+ method public static <T> java.util.Iterator<T> valueIterator(androidx.collection.SparseArrayCompat<T>);
+ }
+
+}
+
diff --git a/collection/collection/api/restricted_1.5.0-beta02.txt b/collection/collection/api/restricted_1.5.0-beta02.txt
new file mode 100644
index 0000000..385c7f5
--- /dev/null
+++ b/collection/collection/api/restricted_1.5.0-beta02.txt
@@ -0,0 +1,2627 @@
+// Signature format: 4.0
+package androidx.collection {
+
+ public class ArrayMap<K, V> extends androidx.collection.SimpleArrayMap<K!,V!> implements java.util.Map<K!,V!> {
+ ctor public ArrayMap();
+ ctor public ArrayMap(androidx.collection.SimpleArrayMap?);
+ ctor public ArrayMap(int);
+ method public boolean containsAll(java.util.Collection<? extends java.lang.Object!>);
+ method public boolean containsKey(Object?);
+ method public boolean containsValue(Object?);
+ method public java.util.Set<java.util.Map.Entry<K!,V!>!> entrySet();
+ method public V! get(Object?);
+ method public java.util.Set<K!> keySet();
+ method public void putAll(java.util.Map<? extends K!,? extends V!>);
+ method public V! remove(Object?);
+ method public boolean removeAll(java.util.Collection<? extends java.lang.Object!>);
+ method public boolean retainAll(java.util.Collection<? extends java.lang.Object!>);
+ method public java.util.Collection<V!> values();
+ }
+
+ public final class ArrayMapKt {
+ method public static inline <K, V> androidx.collection.ArrayMap<K,V> arrayMapOf();
+ method public static <K, V> androidx.collection.ArrayMap<K,V> arrayMapOf(kotlin.Pair<? extends K,? extends V>... pairs);
+ }
+
+ public final class ArraySet<E> implements java.util.Collection<E> kotlin.jvm.internal.markers.KMutableCollection kotlin.jvm.internal.markers.KMutableSet java.util.Set<E> {
+ ctor public ArraySet();
+ ctor public ArraySet(androidx.collection.ArraySet<? extends E>? set);
+ ctor public ArraySet(E[]? array);
+ ctor public ArraySet(optional int capacity);
+ ctor public ArraySet(java.util.Collection<? extends E>? set);
+ method public boolean add(E element);
+ method public void addAll(androidx.collection.ArraySet<? extends E> array);
+ method public boolean addAll(java.util.Collection<? extends E> elements);
+ method public void clear();
+ method public operator boolean contains(E element);
+ method public boolean containsAll(java.util.Collection<? extends E> elements);
+ method public void ensureCapacity(int minimumCapacity);
+ method public int getSize();
+ method public int indexOf(Object? key);
+ method public boolean isEmpty();
+ method public java.util.Iterator<E> iterator();
+ method public boolean remove(E element);
+ method public boolean removeAll(androidx.collection.ArraySet<? extends E> array);
+ method public boolean removeAll(java.util.Collection<? extends E> elements);
+ method public E removeAt(int index);
+ method public boolean retainAll(java.util.Collection<? extends E> elements);
+ method public Object?[] toArray();
+ method public <T> T[] toArray(T[] array);
+ method public E valueAt(int index);
+ property public int size;
+ }
+
+ public final class ArraySetKt {
+ method public static inline <T> androidx.collection.ArraySet<T> arraySetOf();
+ method public static <T> androidx.collection.ArraySet<T> arraySetOf(T... values);
+ }
+
+ public final class CircularArray<E> {
+ ctor public CircularArray();
+ ctor public CircularArray(optional int minCapacity);
+ method public void addFirst(E element);
+ method public void addLast(E element);
+ method public void clear();
+ method public operator E get(int index);
+ method public E getFirst();
+ method public E getLast();
+ method public boolean isEmpty();
+ method public E popFirst();
+ method public E popLast();
+ method public void removeFromEnd(int count);
+ method public void removeFromStart(int count);
+ method public int size();
+ property public final E first;
+ property public final E last;
+ }
+
+ public final class CircularIntArray {
+ ctor public CircularIntArray();
+ ctor public CircularIntArray(optional int minCapacity);
+ method public void addFirst(int element);
+ method public void addLast(int element);
+ method public void clear();
+ method public operator int get(int index);
+ method public int getFirst();
+ method public int getLast();
+ method public boolean isEmpty();
+ method public int popFirst();
+ method public int popLast();
+ method public void removeFromEnd(int count);
+ method public void removeFromStart(int count);
+ method public int size();
+ property public final int first;
+ property public final int last;
+ }
+
+ public abstract sealed class DoubleList {
+ method public final inline boolean any();
+ method public final inline boolean any(kotlin.jvm.functions.Function1<? super java.lang.Double,java.lang.Boolean> predicate);
+ method public final int binarySearch(int element);
+ method public final int binarySearch(int element, optional int fromIndex);
+ method public final int binarySearch(int element, optional int fromIndex, optional int toIndex);
+ method public final operator boolean contains(double element);
+ method public final boolean containsAll(androidx.collection.DoubleList elements);
+ method public final inline int count();
+ method public final inline int count(kotlin.jvm.functions.Function1<? super java.lang.Double,java.lang.Boolean> predicate);
+ method public final double elementAt(@IntRange(from=0L) int index);
+ method public final inline double elementAtOrElse(@IntRange(from=0L) int index, kotlin.jvm.functions.Function1<? super java.lang.Integer,java.lang.Double> defaultValue);
+ method public final double first();
+ method public final inline double first(kotlin.jvm.functions.Function1<? super java.lang.Double,java.lang.Boolean> predicate);
+ method public final inline <R> R fold(R initial, kotlin.jvm.functions.Function2<? super R,? super java.lang.Double,? extends R> operation);
+ method public final inline <R> R foldIndexed(R initial, kotlin.jvm.functions.Function3<? super java.lang.Integer,? super R,? super java.lang.Double,? extends R> operation);
+ method public final inline <R> R foldRight(R initial, kotlin.jvm.functions.Function2<? super java.lang.Double,? super R,? extends R> operation);
+ method public final inline <R> R foldRightIndexed(R initial, kotlin.jvm.functions.Function3<? super java.lang.Integer,? super java.lang.Double,? super R,? extends R> operation);
+ method public final inline void forEach(kotlin.jvm.functions.Function1<? super java.lang.Double,kotlin.Unit> block);
+ method public final inline void forEachIndexed(kotlin.jvm.functions.Function2<? super java.lang.Integer,? super java.lang.Double,kotlin.Unit> block);
+ method public final inline void forEachReversed(kotlin.jvm.functions.Function1<? super java.lang.Double,kotlin.Unit> block);
+ method public final inline void forEachReversedIndexed(kotlin.jvm.functions.Function2<? super java.lang.Integer,? super java.lang.Double,kotlin.Unit> block);
+ method public final operator double get(@IntRange(from=0L) int index);
+ method public final inline kotlin.ranges.IntRange getIndices();
+ method @IntRange(from=-1L) public final inline int getLastIndex();
+ method @IntRange(from=0L) public final inline int getSize();
+ method public final int indexOf(double element);
+ method public final inline int indexOfFirst(kotlin.jvm.functions.Function1<? super java.lang.Double,java.lang.Boolean> predicate);
+ method public final inline int indexOfLast(kotlin.jvm.functions.Function1<? super java.lang.Double,java.lang.Boolean> predicate);
+ method public final inline boolean isEmpty();
+ method public final inline boolean isNotEmpty();
+ method public final String joinToString();
+ method public final String joinToString(optional CharSequence separator);
+ method public final String joinToString(optional CharSequence separator, optional CharSequence prefix);
+ method public final String joinToString(optional CharSequence separator, optional CharSequence prefix, optional CharSequence postfix);
+ method public final String joinToString(optional CharSequence separator, optional CharSequence prefix, optional CharSequence postfix, optional int limit);
+ method public final String joinToString(optional CharSequence separator, optional CharSequence prefix, optional CharSequence postfix, optional int limit, optional CharSequence truncated);
+ method public final inline String joinToString(optional CharSequence separator, optional CharSequence prefix, optional CharSequence postfix, optional int limit, optional CharSequence truncated, kotlin.jvm.functions.Function1<? super java.lang.Double,? extends java.lang.CharSequence> transform);
+ method public final inline String joinToString(optional CharSequence separator, optional CharSequence prefix, optional CharSequence postfix, optional int limit, kotlin.jvm.functions.Function1<? super java.lang.Double,? extends java.lang.CharSequence> transform);
+ method public final inline String joinToString(optional CharSequence separator, optional CharSequence prefix, optional CharSequence postfix, kotlin.jvm.functions.Function1<? super java.lang.Double,? extends java.lang.CharSequence> transform);
+ method public final inline String joinToString(optional CharSequence separator, optional CharSequence prefix, kotlin.jvm.functions.Function1<? super java.lang.Double,? extends java.lang.CharSequence> transform);
+ method public final inline String joinToString(optional CharSequence separator, kotlin.jvm.functions.Function1<? super java.lang.Double,? extends java.lang.CharSequence> transform);
+ method public final inline String joinToString(kotlin.jvm.functions.Function1<? super java.lang.Double,? extends java.lang.CharSequence> transform);
+ method public final double last();
+ method public final inline double last(kotlin.jvm.functions.Function1<? super java.lang.Double,java.lang.Boolean> predicate);
+ method public final int lastIndexOf(double element);
+ method public final inline boolean none();
+ method public final inline boolean reversedAny(kotlin.jvm.functions.Function1<? super java.lang.Double,java.lang.Boolean> predicate);
+ property @kotlin.PublishedApi internal final int _size;
+ property @kotlin.PublishedApi internal final double[] content;
+ property public final inline kotlin.ranges.IntRange indices;
+ property @IntRange(from=-1L) public final inline int lastIndex;
+ property @IntRange(from=0L) public final inline int size;
+ field @kotlin.PublishedApi internal int _size;
+ field @kotlin.PublishedApi internal double[] content;
+ }
+
+ public final class DoubleListKt {
+ method public static inline androidx.collection.DoubleList buildDoubleList(int initialCapacity, kotlin.jvm.functions.Function1<? super androidx.collection.MutableDoubleList,kotlin.Unit> builderAction);
+ method public static inline androidx.collection.DoubleList buildDoubleList(kotlin.jvm.functions.Function1<? super androidx.collection.MutableDoubleList,kotlin.Unit> builderAction);
+ method public static androidx.collection.DoubleList doubleListOf();
+ method public static androidx.collection.DoubleList doubleListOf(double element1);
+ method public static androidx.collection.DoubleList doubleListOf(double element1, double element2);
+ method public static androidx.collection.DoubleList doubleListOf(double element1, double element2, double element3);
+ method public static androidx.collection.DoubleList doubleListOf(double... elements);
+ method public static androidx.collection.DoubleList emptyDoubleList();
+ method public static inline androidx.collection.MutableDoubleList mutableDoubleListOf();
+ method public static androidx.collection.MutableDoubleList mutableDoubleListOf(double element1);
+ method public static androidx.collection.MutableDoubleList mutableDoubleListOf(double element1, double element2);
+ method public static androidx.collection.MutableDoubleList mutableDoubleListOf(double element1, double element2, double element3);
+ method public static inline androidx.collection.MutableDoubleList mutableDoubleListOf(double... elements);
+ }
+
+ public abstract sealed class FloatFloatMap {
+ method public final inline boolean all(kotlin.jvm.functions.Function2<? super java.lang.Float,? super java.lang.Float,java.lang.Boolean> predicate);
+ method public final boolean any();
+ method public final inline boolean any(kotlin.jvm.functions.Function2<? super java.lang.Float,? super java.lang.Float,java.lang.Boolean> predicate);
+ method public final inline operator boolean contains(float key);
+ method public final boolean containsKey(float key);
+ method public final boolean containsValue(float value);
+ method public final int count();
+ method public final inline int count(kotlin.jvm.functions.Function2<? super java.lang.Float,? super java.lang.Float,java.lang.Boolean> predicate);
+ method @kotlin.PublishedApi internal final int findKeyIndex(float key);
+ method public final inline void forEach(kotlin.jvm.functions.Function2<? super java.lang.Float,? super java.lang.Float,kotlin.Unit> block);
+ method @kotlin.PublishedApi internal final inline void forEachIndexed(kotlin.jvm.functions.Function1<? super java.lang.Integer,kotlin.Unit> block);
+ method public final inline void forEachKey(kotlin.jvm.functions.Function1<? super java.lang.Float,kotlin.Unit> block);
+ method public final inline void forEachValue(kotlin.jvm.functions.Function1<? super java.lang.Float,kotlin.Unit> block);
+ method public final operator float get(float key);
+ method public final int getCapacity();
+ method public final float getOrDefault(float key, float defaultValue);
+ method public final inline float getOrElse(float key, kotlin.jvm.functions.Function0<java.lang.Float> defaultValue);
+ method public final int getSize();
+ method public final boolean isEmpty();
+ method public final boolean isNotEmpty();
+ method public final String joinToString();
+ method public final String joinToString(optional CharSequence separator);
+ method public final String joinToString(optional CharSequence separator, optional CharSequence prefix);
+ method public final String joinToString(optional CharSequence separator, optional CharSequence prefix, optional CharSequence postfix);
+ method public final String joinToString(optional CharSequence separator, optional CharSequence prefix, optional CharSequence postfix, optional int limit);
+ method public final String joinToString(optional CharSequence separator, optional CharSequence prefix, optional CharSequence postfix, optional int limit, optional CharSequence truncated);
+ method public final inline String joinToString(optional CharSequence separator, optional CharSequence prefix, optional CharSequence postfix, optional int limit, optional CharSequence truncated, kotlin.jvm.functions.Function2<? super java.lang.Float,? super java.lang.Float,? extends java.lang.CharSequence> transform);
+ method public final inline String joinToString(optional CharSequence separator, optional CharSequence prefix, optional CharSequence postfix, optional int limit, kotlin.jvm.functions.Function2<? super java.lang.Float,? super java.lang.Float,? extends java.lang.CharSequence> transform);
+ method public final inline String joinToString(optional CharSequence separator, optional CharSequence prefix, optional CharSequence postfix, kotlin.jvm.functions.Function2<? super java.lang.Float,? super java.lang.Float,? extends java.lang.CharSequence> transform);
+ method public final inline String joinToString(optional CharSequence separator, optional CharSequence prefix, kotlin.jvm.functions.Function2<? super java.lang.Float,? super java.lang.Float,? extends java.lang.CharSequence> transform);
+ method public final inline String joinToString(optional CharSequence separator, kotlin.jvm.functions.Function2<? super java.lang.Float,? super java.lang.Float,? extends java.lang.CharSequence> transform);
+ method public final inline String joinToString(kotlin.jvm.functions.Function2<? super java.lang.Float,? super java.lang.Float,? extends java.lang.CharSequence> transform);
+ method public final boolean none();
+ property public final int capacity;
+ property @kotlin.PublishedApi internal final float[] keys;
+ property @kotlin.PublishedApi internal final long[] metadata;
+ property public final int size;
+ property @kotlin.PublishedApi internal final float[] values;
+ field @kotlin.PublishedApi internal float[] keys;
+ field @kotlin.PublishedApi internal long[] metadata;
+ field @kotlin.PublishedApi internal float[] values;
+ }
+
+ public final class FloatFloatMapKt {
+ method public static inline androidx.collection.FloatFloatMap buildFloatFloatMap(int initialCapacity, kotlin.jvm.functions.Function1<? super androidx.collection.MutableFloatFloatMap,kotlin.Unit> builderAction);
+ method public static inline androidx.collection.FloatFloatMap buildFloatFloatMap(kotlin.jvm.functions.Function1<? super androidx.collection.MutableFloatFloatMap,kotlin.Unit> builderAction);
+ method public static androidx.collection.FloatFloatMap emptyFloatFloatMap();
+ method public static androidx.collection.FloatFloatMap floatFloatMapOf();
+ method public static androidx.collection.FloatFloatMap floatFloatMapOf(float key1, float value1);
+ method public static androidx.collection.FloatFloatMap floatFloatMapOf(float key1, float value1, float key2, float value2);
+ method public static androidx.collection.FloatFloatMap floatFloatMapOf(float key1, float value1, float key2, float value2, float key3, float value3);
+ method public static androidx.collection.FloatFloatMap floatFloatMapOf(float key1, float value1, float key2, float value2, float key3, float value3, float key4, float value4);
+ method public static androidx.collection.FloatFloatMap floatFloatMapOf(float key1, float value1, float key2, float value2, float key3, float value3, float key4, float value4, float key5, float value5);
+ method public static androidx.collection.MutableFloatFloatMap mutableFloatFloatMapOf();
+ method public static androidx.collection.MutableFloatFloatMap mutableFloatFloatMapOf(float key1, float value1);
+ method public static androidx.collection.MutableFloatFloatMap mutableFloatFloatMapOf(float key1, float value1, float key2, float value2);
+ method public static androidx.collection.MutableFloatFloatMap mutableFloatFloatMapOf(float key1, float value1, float key2, float value2, float key3, float value3);
+ method public static androidx.collection.MutableFloatFloatMap mutableFloatFloatMapOf(float key1, float value1, float key2, float value2, float key3, float value3, float key4, float value4);
+ method public static androidx.collection.MutableFloatFloatMap mutableFloatFloatMapOf(float key1, float value1, float key2, float value2, float key3, float value3, float key4, float value4, float key5, float value5);
+ }
+
+ @kotlin.jvm.JvmInline public final value class FloatFloatPair {
+ ctor public FloatFloatPair(float first, float second);
+ method public inline operator float component1();
+ method public inline operator float component2();
+ property public final inline float first;
+ property public final long packedValue;
+ property public final inline float second;
+ field public final long packedValue;
+ }
+
+ public abstract sealed class FloatIntMap {
+ method public final inline boolean all(kotlin.jvm.functions.Function2<? super java.lang.Float,? super java.lang.Integer,java.lang.Boolean> predicate);
+ method public final boolean any();
+ method public final inline boolean any(kotlin.jvm.functions.Function2<? super java.lang.Float,? super java.lang.Integer,java.lang.Boolean> predicate);
+ method public final inline operator boolean contains(float key);
+ method public final boolean containsKey(float key);
+ method public final boolean containsValue(int value);
+ method public final int count();
+ method public final inline int count(kotlin.jvm.functions.Function2<? super java.lang.Float,? super java.lang.Integer,java.lang.Boolean> predicate);
+ method @kotlin.PublishedApi internal final int findKeyIndex(float key);
+ method public final inline void forEach(kotlin.jvm.functions.Function2<? super java.lang.Float,? super java.lang.Integer,kotlin.Unit> block);
+ method @kotlin.PublishedApi internal final inline void forEachIndexed(kotlin.jvm.functions.Function1<? super java.lang.Integer,kotlin.Unit> block);
+ method public final inline void forEachKey(kotlin.jvm.functions.Function1<? super java.lang.Float,kotlin.Unit> block);
+ method public final inline void forEachValue(kotlin.jvm.functions.Function1<? super java.lang.Integer,kotlin.Unit> block);
+ method public final operator int get(float key);
+ method public final int getCapacity();
+ method public final int getOrDefault(float key, int defaultValue);
+ method public final inline int getOrElse(float key, kotlin.jvm.functions.Function0<java.lang.Integer> defaultValue);
+ method public final int getSize();
+ method public final boolean isEmpty();
+ method public final boolean isNotEmpty();
+ method public final String joinToString();
+ method public final String joinToString(optional CharSequence separator);
+ method public final String joinToString(optional CharSequence separator, optional CharSequence prefix);
+ method public final String joinToString(optional CharSequence separator, optional CharSequence prefix, optional CharSequence postfix);
+ method public final String joinToString(optional CharSequence separator, optional CharSequence prefix, optional CharSequence postfix, optional int limit);
+ method public final String joinToString(optional CharSequence separator, optional CharSequence prefix, optional CharSequence postfix, optional int limit, optional CharSequence truncated);
+ method public final inline String joinToString(optional CharSequence separator, optional CharSequence prefix, optional CharSequence postfix, optional int limit, optional CharSequence truncated, kotlin.jvm.functions.Function2<? super java.lang.Float,? super java.lang.Integer,? extends java.lang.CharSequence> transform);
+ method public final inline String joinToString(optional CharSequence separator, optional CharSequence prefix, optional CharSequence postfix, optional int limit, kotlin.jvm.functions.Function2<? super java.lang.Float,? super java.lang.Integer,? extends java.lang.CharSequence> transform);
+ method public final inline String joinToString(optional CharSequence separator, optional CharSequence prefix, optional CharSequence postfix, kotlin.jvm.functions.Function2<? super java.lang.Float,? super java.lang.Integer,? extends java.lang.CharSequence> transform);
+ method public final inline String joinToString(optional CharSequence separator, optional CharSequence prefix, kotlin.jvm.functions.Function2<? super java.lang.Float,? super java.lang.Integer,? extends java.lang.CharSequence> transform);
+ method public final inline String joinToString(optional CharSequence separator, kotlin.jvm.functions.Function2<? super java.lang.Float,? super java.lang.Integer,? extends java.lang.CharSequence> transform);
+ method public final inline String joinToString(kotlin.jvm.functions.Function2<? super java.lang.Float,? super java.lang.Integer,? extends java.lang.CharSequence> transform);
+ method public final boolean none();
+ property public final int capacity;
+ property @kotlin.PublishedApi internal final float[] keys;
+ property @kotlin.PublishedApi internal final long[] metadata;
+ property public final int size;
+ property @kotlin.PublishedApi internal final int[] values;
+ field @kotlin.PublishedApi internal float[] keys;
+ field @kotlin.PublishedApi internal long[] metadata;
+ field @kotlin.PublishedApi internal int[] values;
+ }
+
+ public final class FloatIntMapKt {
+ method public static inline androidx.collection.FloatIntMap buildFloatIntMap(int initialCapacity, kotlin.jvm.functions.Function1<? super androidx.collection.MutableFloatIntMap,kotlin.Unit> builderAction);
+ method public static inline androidx.collection.FloatIntMap buildFloatIntMap(kotlin.jvm.functions.Function1<? super androidx.collection.MutableFloatIntMap,kotlin.Unit> builderAction);
+ method public static androidx.collection.FloatIntMap emptyFloatIntMap();
+ method public static androidx.collection.FloatIntMap floatIntMapOf();
+ method public static androidx.collection.FloatIntMap floatIntMapOf(float key1, int value1);
+ method public static androidx.collection.FloatIntMap floatIntMapOf(float key1, int value1, float key2, int value2);
+ method public static androidx.collection.FloatIntMap floatIntMapOf(float key1, int value1, float key2, int value2, float key3, int value3);
+ method public static androidx.collection.FloatIntMap floatIntMapOf(float key1, int value1, float key2, int value2, float key3, int value3, float key4, int value4);
+ method public static androidx.collection.FloatIntMap floatIntMapOf(float key1, int value1, float key2, int value2, float key3, int value3, float key4, int value4, float key5, int value5);
+ method public static androidx.collection.MutableFloatIntMap mutableFloatIntMapOf();
+ method public static androidx.collection.MutableFloatIntMap mutableFloatIntMapOf(float key1, int value1);
+ method public static androidx.collection.MutableFloatIntMap mutableFloatIntMapOf(float key1, int value1, float key2, int value2);
+ method public static androidx.collection.MutableFloatIntMap mutableFloatIntMapOf(float key1, int value1, float key2, int value2, float key3, int value3);
+ method public static androidx.collection.MutableFloatIntMap mutableFloatIntMapOf(float key1, int value1, float key2, int value2, float key3, int value3, float key4, int value4);
+ method public static androidx.collection.MutableFloatIntMap mutableFloatIntMapOf(float key1, int value1, float key2, int value2, float key3, int value3, float key4, int value4, float key5, int value5);
+ }
+
+ public abstract sealed class FloatList {
+ method public final inline boolean any();
+ method public final inline boolean any(kotlin.jvm.functions.Function1<? super java.lang.Float,java.lang.Boolean> predicate);
+ method public final int binarySearch(int element);
+ method public final int binarySearch(int element, optional int fromIndex);
+ method public final int binarySearch(int element, optional int fromIndex, optional int toIndex);
+ method public final operator boolean contains(float element);
+ method public final boolean containsAll(androidx.collection.FloatList elements);
+ method public final inline int count();
+ method public final inline int count(kotlin.jvm.functions.Function1<? super java.lang.Float,java.lang.Boolean> predicate);
+ method public final float elementAt(@IntRange(from=0L) int index);
+ method public final inline float elementAtOrElse(@IntRange(from=0L) int index, kotlin.jvm.functions.Function1<? super java.lang.Integer,java.lang.Float> defaultValue);
+ method public final float first();
+ method public final inline float first(kotlin.jvm.functions.Function1<? super java.lang.Float,java.lang.Boolean> predicate);
+ method public final inline <R> R fold(R initial, kotlin.jvm.functions.Function2<? super R,? super java.lang.Float,? extends R> operation);
+ method public final inline <R> R foldIndexed(R initial, kotlin.jvm.functions.Function3<? super java.lang.Integer,? super R,? super java.lang.Float,? extends R> operation);
+ method public final inline <R> R foldRight(R initial, kotlin.jvm.functions.Function2<? super java.lang.Float,? super R,? extends R> operation);
+ method public final inline <R> R foldRightIndexed(R initial, kotlin.jvm.functions.Function3<? super java.lang.Integer,? super java.lang.Float,? super R,? extends R> operation);
+ method public final inline void forEach(kotlin.jvm.functions.Function1<? super java.lang.Float,kotlin.Unit> block);
+ method public final inline void forEachIndexed(kotlin.jvm.functions.Function2<? super java.lang.Integer,? super java.lang.Float,kotlin.Unit> block);
+ method public final inline void forEachReversed(kotlin.jvm.functions.Function1<? super java.lang.Float,kotlin.Unit> block);
+ method public final inline void forEachReversedIndexed(kotlin.jvm.functions.Function2<? super java.lang.Integer,? super java.lang.Float,kotlin.Unit> block);
+ method public final operator float get(@IntRange(from=0L) int index);
+ method public final inline kotlin.ranges.IntRange getIndices();
+ method @IntRange(from=-1L) public final inline int getLastIndex();
+ method @IntRange(from=0L) public final inline int getSize();
+ method public final int indexOf(float element);
+ method public final inline int indexOfFirst(kotlin.jvm.functions.Function1<? super java.lang.Float,java.lang.Boolean> predicate);
+ method public final inline int indexOfLast(kotlin.jvm.functions.Function1<? super java.lang.Float,java.lang.Boolean> predicate);
+ method public final inline boolean isEmpty();
+ method public final inline boolean isNotEmpty();
+ method public final String joinToString();
+ method public final String joinToString(optional CharSequence separator);
+ method public final String joinToString(optional CharSequence separator, optional CharSequence prefix);
+ method public final String joinToString(optional CharSequence separator, optional CharSequence prefix, optional CharSequence postfix);
+ method public final String joinToString(optional CharSequence separator, optional CharSequence prefix, optional CharSequence postfix, optional int limit);
+ method public final String joinToString(optional CharSequence separator, optional CharSequence prefix, optional CharSequence postfix, optional int limit, optional CharSequence truncated);
+ method public final inline String joinToString(optional CharSequence separator, optional CharSequence prefix, optional CharSequence postfix, optional int limit, optional CharSequence truncated, kotlin.jvm.functions.Function1<? super java.lang.Float,? extends java.lang.CharSequence> transform);
+ method public final inline String joinToString(optional CharSequence separator, optional CharSequence prefix, optional CharSequence postfix, optional int limit, kotlin.jvm.functions.Function1<? super java.lang.Float,? extends java.lang.CharSequence> transform);
+ method public final inline String joinToString(optional CharSequence separator, optional CharSequence prefix, optional CharSequence postfix, kotlin.jvm.functions.Function1<? super java.lang.Float,? extends java.lang.CharSequence> transform);
+ method public final inline String joinToString(optional CharSequence separator, optional CharSequence prefix, kotlin.jvm.functions.Function1<? super java.lang.Float,? extends java.lang.CharSequence> transform);
+ method public final inline String joinToString(optional CharSequence separator, kotlin.jvm.functions.Function1<? super java.lang.Float,? extends java.lang.CharSequence> transform);
+ method public final inline String joinToString(kotlin.jvm.functions.Function1<? super java.lang.Float,? extends java.lang.CharSequence> transform);
+ method public final float last();
+ method public final inline float last(kotlin.jvm.functions.Function1<? super java.lang.Float,java.lang.Boolean> predicate);
+ method public final int lastIndexOf(float element);
+ method public final inline boolean none();
+ method public final inline boolean reversedAny(kotlin.jvm.functions.Function1<? super java.lang.Float,java.lang.Boolean> predicate);
+ property @kotlin.PublishedApi internal final int _size;
+ property @kotlin.PublishedApi internal final float[] content;
+ property public final inline kotlin.ranges.IntRange indices;
+ property @IntRange(from=-1L) public final inline int lastIndex;
+ property @IntRange(from=0L) public final inline int size;
+ field @kotlin.PublishedApi internal int _size;
+ field @kotlin.PublishedApi internal float[] content;
+ }
+
+ public final class FloatListKt {
+ method public static inline androidx.collection.FloatList buildFloatList(int initialCapacity, kotlin.jvm.functions.Function1<? super androidx.collection.MutableFloatList,kotlin.Unit> builderAction);
+ method public static inline androidx.collection.FloatList buildFloatList(kotlin.jvm.functions.Function1<? super androidx.collection.MutableFloatList,kotlin.Unit> builderAction);
+ method public static androidx.collection.FloatList emptyFloatList();
+ method public static androidx.collection.FloatList floatListOf();
+ method public static androidx.collection.FloatList floatListOf(float element1);
+ method public static androidx.collection.FloatList floatListOf(float element1, float element2);
+ method public static androidx.collection.FloatList floatListOf(float element1, float element2, float element3);
+ method public static androidx.collection.FloatList floatListOf(float... elements);
+ method public static inline androidx.collection.MutableFloatList mutableFloatListOf();
+ method public static androidx.collection.MutableFloatList mutableFloatListOf(float element1);
+ method public static androidx.collection.MutableFloatList mutableFloatListOf(float element1, float element2);
+ method public static androidx.collection.MutableFloatList mutableFloatListOf(float element1, float element2, float element3);
+ method public static inline androidx.collection.MutableFloatList mutableFloatListOf(float... elements);
+ }
+
+ public abstract sealed class FloatLongMap {
+ method public final inline boolean all(kotlin.jvm.functions.Function2<? super java.lang.Float,? super java.lang.Long,java.lang.Boolean> predicate);
+ method public final boolean any();
+ method public final inline boolean any(kotlin.jvm.functions.Function2<? super java.lang.Float,? super java.lang.Long,java.lang.Boolean> predicate);
+ method public final inline operator boolean contains(float key);
+ method public final boolean containsKey(float key);
+ method public final boolean containsValue(long value);
+ method public final int count();
+ method public final inline int count(kotlin.jvm.functions.Function2<? super java.lang.Float,? super java.lang.Long,java.lang.Boolean> predicate);
+ method @kotlin.PublishedApi internal final int findKeyIndex(float key);
+ method public final inline void forEach(kotlin.jvm.functions.Function2<? super java.lang.Float,? super java.lang.Long,kotlin.Unit> block);
+ method @kotlin.PublishedApi internal final inline void forEachIndexed(kotlin.jvm.functions.Function1<? super java.lang.Integer,kotlin.Unit> block);
+ method public final inline void forEachKey(kotlin.jvm.functions.Function1<? super java.lang.Float,kotlin.Unit> block);
+ method public final inline void forEachValue(kotlin.jvm.functions.Function1<? super java.lang.Long,kotlin.Unit> block);
+ method public final operator long get(float key);
+ method public final int getCapacity();
+ method public final long getOrDefault(float key, long defaultValue);
+ method public final inline long getOrElse(float key, kotlin.jvm.functions.Function0<java.lang.Long> defaultValue);
+ method public final int getSize();
+ method public final boolean isEmpty();
+ method public final boolean isNotEmpty();
+ method public final String joinToString();
+ method public final String joinToString(optional CharSequence separator);
+ method public final String joinToString(optional CharSequence separator, optional CharSequence prefix);
+ method public final String joinToString(optional CharSequence separator, optional CharSequence prefix, optional CharSequence postfix);
+ method public final String joinToString(optional CharSequence separator, optional CharSequence prefix, optional CharSequence postfix, optional int limit);
+ method public final String joinToString(optional CharSequence separator, optional CharSequence prefix, optional CharSequence postfix, optional int limit, optional CharSequence truncated);
+ method public final inline String joinToString(optional CharSequence separator, optional CharSequence prefix, optional CharSequence postfix, optional int limit, optional CharSequence truncated, kotlin.jvm.functions.Function2<? super java.lang.Float,? super java.lang.Long,? extends java.lang.CharSequence> transform);
+ method public final inline String joinToString(optional CharSequence separator, optional CharSequence prefix, optional CharSequence postfix, optional int limit, kotlin.jvm.functions.Function2<? super java.lang.Float,? super java.lang.Long,? extends java.lang.CharSequence> transform);
+ method public final inline String joinToString(optional CharSequence separator, optional CharSequence prefix, optional CharSequence postfix, kotlin.jvm.functions.Function2<? super java.lang.Float,? super java.lang.Long,? extends java.lang.CharSequence> transform);
+ method public final inline String joinToString(optional CharSequence separator, optional CharSequence prefix, kotlin.jvm.functions.Function2<? super java.lang.Float,? super java.lang.Long,? extends java.lang.CharSequence> transform);
+ method public final inline String joinToString(optional CharSequence separator, kotlin.jvm.functions.Function2<? super java.lang.Float,? super java.lang.Long,? extends java.lang.CharSequence> transform);
+ method public final inline String joinToString(kotlin.jvm.functions.Function2<? super java.lang.Float,? super java.lang.Long,? extends java.lang.CharSequence> transform);
+ method public final boolean none();
+ property public final int capacity;
+ property @kotlin.PublishedApi internal final float[] keys;
+ property @kotlin.PublishedApi internal final long[] metadata;
+ property public final int size;
+ property @kotlin.PublishedApi internal final long[] values;
+ field @kotlin.PublishedApi internal float[] keys;
+ field @kotlin.PublishedApi internal long[] metadata;
+ field @kotlin.PublishedApi internal long[] values;
+ }
+
+ public final class FloatLongMapKt {
+ method public static inline androidx.collection.FloatLongMap buildFloatLongMap(int initialCapacity, kotlin.jvm.functions.Function1<? super androidx.collection.MutableFloatLongMap,kotlin.Unit> builderAction);
+ method public static inline androidx.collection.FloatLongMap buildFloatLongMap(kotlin.jvm.functions.Function1<? super androidx.collection.MutableFloatLongMap,kotlin.Unit> builderAction);
+ method public static androidx.collection.FloatLongMap emptyFloatLongMap();
+ method public static androidx.collection.FloatLongMap floatLongMapOf();
+ method public static androidx.collection.FloatLongMap floatLongMapOf(float key1, long value1);
+ method public static androidx.collection.FloatLongMap floatLongMapOf(float key1, long value1, float key2, long value2);
+ method public static androidx.collection.FloatLongMap floatLongMapOf(float key1, long value1, float key2, long value2, float key3, long value3);
+ method public static androidx.collection.FloatLongMap floatLongMapOf(float key1, long value1, float key2, long value2, float key3, long value3, float key4, long value4);
+ method public static androidx.collection.FloatLongMap floatLongMapOf(float key1, long value1, float key2, long value2, float key3, long value3, float key4, long value4, float key5, long value5);
+ method public static androidx.collection.MutableFloatLongMap mutableFloatLongMapOf();
+ method public static androidx.collection.MutableFloatLongMap mutableFloatLongMapOf(float key1, long value1);
+ method public static androidx.collection.MutableFloatLongMap mutableFloatLongMapOf(float key1, long value1, float key2, long value2);
+ method public static androidx.collection.MutableFloatLongMap mutableFloatLongMapOf(float key1, long value1, float key2, long value2, float key3, long value3);
+ method public static androidx.collection.MutableFloatLongMap mutableFloatLongMapOf(float key1, long value1, float key2, long value2, float key3, long value3, float key4, long value4);
+ method public static androidx.collection.MutableFloatLongMap mutableFloatLongMapOf(float key1, long value1, float key2, long value2, float key3, long value3, float key4, long value4, float key5, long value5);
+ }
+
+ public abstract sealed class FloatObjectMap<V> {
+ method public final inline boolean all(kotlin.jvm.functions.Function2<? super java.lang.Float,? super V,java.lang.Boolean> predicate);
+ method public final boolean any();
+ method public final inline boolean any(kotlin.jvm.functions.Function2<? super java.lang.Float,? super V,java.lang.Boolean> predicate);
+ method public final inline operator boolean contains(float key);
+ method public final boolean containsKey(float key);
+ method public final boolean containsValue(V value);
+ method public final int count();
+ method public final inline int count(kotlin.jvm.functions.Function2<? super java.lang.Float,? super V,java.lang.Boolean> predicate);
+ method public final inline void forEach(kotlin.jvm.functions.Function2<? super java.lang.Float,? super V,kotlin.Unit> block);
+ method @kotlin.PublishedApi internal final inline void forEachIndexed(kotlin.jvm.functions.Function1<? super java.lang.Integer,kotlin.Unit> block);
+ method public final inline void forEachKey(kotlin.jvm.functions.Function1<? super java.lang.Float,kotlin.Unit> block);
+ method public final inline void forEachValue(kotlin.jvm.functions.Function1<? super V,kotlin.Unit> block);
+ method public final operator V? get(float key);
+ method public final int getCapacity();
+ method public final V getOrDefault(float key, V defaultValue);
+ method public final inline V getOrElse(float key, kotlin.jvm.functions.Function0<? extends V> defaultValue);
+ method public final int getSize();
+ method public final boolean isEmpty();
+ method public final boolean isNotEmpty();
+ method public final String joinToString();
+ method public final String joinToString(optional CharSequence separator);
+ method public final String joinToString(optional CharSequence separator, optional CharSequence prefix);
+ method public final String joinToString(optional CharSequence separator, optional CharSequence prefix, optional CharSequence postfix);
+ method public final String joinToString(optional CharSequence separator, optional CharSequence prefix, optional CharSequence postfix, optional int limit);
+ method public final String joinToString(optional CharSequence separator, optional CharSequence prefix, optional CharSequence postfix, optional int limit, optional CharSequence truncated);
+ method public final inline String joinToString(optional CharSequence separator, optional CharSequence prefix, optional CharSequence postfix, optional int limit, optional CharSequence truncated, kotlin.jvm.functions.Function2<? super java.lang.Float,? super V,? extends java.lang.CharSequence> transform);
+ method public final inline String joinToString(optional CharSequence separator, optional CharSequence prefix, optional CharSequence postfix, optional int limit, kotlin.jvm.functions.Function2<? super java.lang.Float,? super V,? extends java.lang.CharSequence> transform);
+ method public final inline String joinToString(optional CharSequence separator, optional CharSequence prefix, optional CharSequence postfix, kotlin.jvm.functions.Function2<? super java.lang.Float,? super V,? extends java.lang.CharSequence> transform);
+ method public final inline String joinToString(optional CharSequence separator, optional CharSequence prefix, kotlin.jvm.functions.Function2<? super java.lang.Float,? super V,? extends java.lang.CharSequence> transform);
+ method public final inline String joinToString(optional CharSequence separator, kotlin.jvm.functions.Function2<? super java.lang.Float,? super V,? extends java.lang.CharSequence> transform);
+ method public final inline String joinToString(kotlin.jvm.functions.Function2<? super java.lang.Float,? super V,? extends java.lang.CharSequence> transform);
+ method public final boolean none();
+ property public final int capacity;
+ property @kotlin.PublishedApi internal final float[] keys;
+ property @kotlin.PublishedApi internal final long[] metadata;
+ property public final int size;
+ property @kotlin.PublishedApi internal final Object?[] values;
+ field @kotlin.PublishedApi internal float[] keys;
+ field @kotlin.PublishedApi internal long[] metadata;
+ field @kotlin.PublishedApi internal Object?[] values;
+ }
+
+ public final class FloatObjectMapKt {
+ method public static inline <V> androidx.collection.FloatObjectMap<V> buildFloatObjectMap(int initialCapacity, kotlin.jvm.functions.Function1<? super androidx.collection.MutableFloatObjectMap<V>,kotlin.Unit> builderAction);
+ method public static inline <V> androidx.collection.FloatObjectMap<V> buildFloatObjectMap(kotlin.jvm.functions.Function1<? super androidx.collection.MutableFloatObjectMap<V>,kotlin.Unit> builderAction);
+ method public static <V> androidx.collection.FloatObjectMap<V> emptyFloatObjectMap();
+ method public static <V> androidx.collection.FloatObjectMap<V> floatObjectMapOf();
+ method public static <V> androidx.collection.FloatObjectMap<V> floatObjectMapOf(float key1, V value1);
+ method public static <V> androidx.collection.FloatObjectMap<V> floatObjectMapOf(float key1, V value1, float key2, V value2);
+ method public static <V> androidx.collection.FloatObjectMap<V> floatObjectMapOf(float key1, V value1, float key2, V value2, float key3, V value3);
+ method public static <V> androidx.collection.FloatObjectMap<V> floatObjectMapOf(float key1, V value1, float key2, V value2, float key3, V value3, float key4, V value4);
+ method public static <V> androidx.collection.FloatObjectMap<V> floatObjectMapOf(float key1, V value1, float key2, V value2, float key3, V value3, float key4, V value4, float key5, V value5);
+ method public static <V> androidx.collection.MutableFloatObjectMap<V> mutableFloatObjectMapOf();
+ method public static <V> androidx.collection.MutableFloatObjectMap<V> mutableFloatObjectMapOf(float key1, V value1);
+ method public static <V> androidx.collection.MutableFloatObjectMap<V> mutableFloatObjectMapOf(float key1, V value1, float key2, V value2);
+ method public static <V> androidx.collection.MutableFloatObjectMap<V> mutableFloatObjectMapOf(float key1, V value1, float key2, V value2, float key3, V value3);
+ method public static <V> androidx.collection.MutableFloatObjectMap<V> mutableFloatObjectMapOf(float key1, V value1, float key2, V value2, float key3, V value3, float key4, V value4);
+ method public static <V> androidx.collection.MutableFloatObjectMap<V> mutableFloatObjectMapOf(float key1, V value1, float key2, V value2, float key3, V value3, float key4, V value4, float key5, V value5);
+ }
+
+ public abstract sealed class FloatSet {
+ method public final inline boolean all(kotlin.jvm.functions.Function1<? super java.lang.Float,java.lang.Boolean> predicate);
+ method public final boolean any();
+ method public final inline boolean any(kotlin.jvm.functions.Function1<? super java.lang.Float,java.lang.Boolean> predicate);
+ method public final operator boolean contains(float element);
+ method @IntRange(from=0L) public final int count();
+ method @IntRange(from=0L) public final inline int count(kotlin.jvm.functions.Function1<? super java.lang.Float,java.lang.Boolean> predicate);
+ method public final inline float first();
+ method public final inline float first(kotlin.jvm.functions.Function1<? super java.lang.Float,java.lang.Boolean> predicate);
+ method public final inline void forEach(kotlin.jvm.functions.Function1<? super java.lang.Float,kotlin.Unit> block);
+ method @kotlin.PublishedApi internal final inline void forEachIndex(kotlin.jvm.functions.Function1<? super java.lang.Integer,kotlin.Unit> block);
+ method @IntRange(from=0L) public final int getCapacity();
+ method @IntRange(from=0L) public final int getSize();
+ method public final boolean isEmpty();
+ method public final boolean isNotEmpty();
+ method public final String joinToString();
+ method public final String joinToString(optional CharSequence separator);
+ method public final String joinToString(optional CharSequence separator, optional CharSequence prefix);
+ method public final String joinToString(optional CharSequence separator, optional CharSequence prefix, optional CharSequence postfix);
+ method public final String joinToString(optional CharSequence separator, optional CharSequence prefix, optional CharSequence postfix, optional int limit);
+ method public final String joinToString(optional CharSequence separator, optional CharSequence prefix, optional CharSequence postfix, optional int limit, optional CharSequence truncated);
+ method public final inline String joinToString(optional CharSequence separator, optional CharSequence prefix, optional CharSequence postfix, optional int limit, optional CharSequence truncated, kotlin.jvm.functions.Function1<? super java.lang.Float,? extends java.lang.CharSequence> transform);
+ method public final inline String joinToString(optional CharSequence separator, optional CharSequence prefix, optional CharSequence postfix, optional int limit, kotlin.jvm.functions.Function1<? super java.lang.Float,? extends java.lang.CharSequence> transform);
+ method public final inline String joinToString(optional CharSequence separator, optional CharSequence prefix, optional CharSequence postfix, kotlin.jvm.functions.Function1<? super java.lang.Float,? extends java.lang.CharSequence> transform);
+ method public final inline String joinToString(optional CharSequence separator, optional CharSequence prefix, kotlin.jvm.functions.Function1<? super java.lang.Float,? extends java.lang.CharSequence> transform);
+ method public final inline String joinToString(optional CharSequence separator, kotlin.jvm.functions.Function1<? super java.lang.Float,? extends java.lang.CharSequence> transform);
+ method public final inline String joinToString(kotlin.jvm.functions.Function1<? super java.lang.Float,? extends java.lang.CharSequence> transform);
+ method public final boolean none();
+ property @IntRange(from=0L) public final int capacity;
+ property @kotlin.PublishedApi internal final float[] elements;
+ property @kotlin.PublishedApi internal final long[] metadata;
+ property @IntRange(from=0L) public final int size;
+ field @kotlin.PublishedApi internal float[] elements;
+ field @kotlin.PublishedApi internal long[] metadata;
+ }
+
+ public final class FloatSetKt {
+ method public static inline androidx.collection.FloatSet buildFloatSet(int initialCapacity, kotlin.jvm.functions.Function1<? super androidx.collection.MutableFloatSet,kotlin.Unit> builderAction);
+ method public static inline androidx.collection.FloatSet buildFloatSet(kotlin.jvm.functions.Function1<? super androidx.collection.MutableFloatSet,kotlin.Unit> builderAction);
+ method public static androidx.collection.FloatSet emptyFloatSet();
+ method public static androidx.collection.FloatSet floatSetOf();
+ method public static androidx.collection.FloatSet floatSetOf(float element1);
+ method public static androidx.collection.FloatSet floatSetOf(float element1, float element2);
+ method public static androidx.collection.FloatSet floatSetOf(float element1, float element2, float element3);
+ method public static androidx.collection.FloatSet floatSetOf(float... elements);
+ method public static androidx.collection.MutableFloatSet mutableFloatSetOf();
+ method public static androidx.collection.MutableFloatSet mutableFloatSetOf(float element1);
+ method public static androidx.collection.MutableFloatSet mutableFloatSetOf(float element1, float element2);
+ method public static androidx.collection.MutableFloatSet mutableFloatSetOf(float element1, float element2, float element3);
+ method public static androidx.collection.MutableFloatSet mutableFloatSetOf(float... elements);
+ }
+
+ public abstract sealed class IntFloatMap {
+ method public final inline boolean all(kotlin.jvm.functions.Function2<? super java.lang.Integer,? super java.lang.Float,java.lang.Boolean> predicate);
+ method public final boolean any();
+ method public final inline boolean any(kotlin.jvm.functions.Function2<? super java.lang.Integer,? super java.lang.Float,java.lang.Boolean> predicate);
+ method public final inline operator boolean contains(int key);
+ method public final boolean containsKey(int key);
+ method public final boolean containsValue(float value);
+ method public final int count();
+ method public final inline int count(kotlin.jvm.functions.Function2<? super java.lang.Integer,? super java.lang.Float,java.lang.Boolean> predicate);
+ method @kotlin.PublishedApi internal final int findKeyIndex(int key);
+ method public final inline void forEach(kotlin.jvm.functions.Function2<? super java.lang.Integer,? super java.lang.Float,kotlin.Unit> block);
+ method @kotlin.PublishedApi internal final inline void forEachIndexed(kotlin.jvm.functions.Function1<? super java.lang.Integer,kotlin.Unit> block);
+ method public final inline void forEachKey(kotlin.jvm.functions.Function1<? super java.lang.Integer,kotlin.Unit> block);
+ method public final inline void forEachValue(kotlin.jvm.functions.Function1<? super java.lang.Float,kotlin.Unit> block);
+ method public final operator float get(int key);
+ method public final int getCapacity();
+ method public final float getOrDefault(int key, float defaultValue);
+ method public final inline float getOrElse(int key, kotlin.jvm.functions.Function0<java.lang.Float> defaultValue);
+ method public final int getSize();
+ method public final boolean isEmpty();
+ method public final boolean isNotEmpty();
+ method public final String joinToString();
+ method public final String joinToString(optional CharSequence separator);
+ method public final String joinToString(optional CharSequence separator, optional CharSequence prefix);
+ method public final String joinToString(optional CharSequence separator, optional CharSequence prefix, optional CharSequence postfix);
+ method public final String joinToString(optional CharSequence separator, optional CharSequence prefix, optional CharSequence postfix, optional int limit);
+ method public final String joinToString(optional CharSequence separator, optional CharSequence prefix, optional CharSequence postfix, optional int limit, optional CharSequence truncated);
+ method public final inline String joinToString(optional CharSequence separator, optional CharSequence prefix, optional CharSequence postfix, optional int limit, optional CharSequence truncated, kotlin.jvm.functions.Function2<? super java.lang.Integer,? super java.lang.Float,? extends java.lang.CharSequence> transform);
+ method public final inline String joinToString(optional CharSequence separator, optional CharSequence prefix, optional CharSequence postfix, optional int limit, kotlin.jvm.functions.Function2<? super java.lang.Integer,? super java.lang.Float,? extends java.lang.CharSequence> transform);
+ method public final inline String joinToString(optional CharSequence separator, optional CharSequence prefix, optional CharSequence postfix, kotlin.jvm.functions.Function2<? super java.lang.Integer,? super java.lang.Float,? extends java.lang.CharSequence> transform);
+ method public final inline String joinToString(optional CharSequence separator, optional CharSequence prefix, kotlin.jvm.functions.Function2<? super java.lang.Integer,? super java.lang.Float,? extends java.lang.CharSequence> transform);
+ method public final inline String joinToString(optional CharSequence separator, kotlin.jvm.functions.Function2<? super java.lang.Integer,? super java.lang.Float,? extends java.lang.CharSequence> transform);
+ method public final inline String joinToString(kotlin.jvm.functions.Function2<? super java.lang.Integer,? super java.lang.Float,? extends java.lang.CharSequence> transform);
+ method public final boolean none();
+ property public final int capacity;
+ property @kotlin.PublishedApi internal final int[] keys;
+ property @kotlin.PublishedApi internal final long[] metadata;
+ property public final int size;
+ property @kotlin.PublishedApi internal final float[] values;
+ field @kotlin.PublishedApi internal int[] keys;
+ field @kotlin.PublishedApi internal long[] metadata;
+ field @kotlin.PublishedApi internal float[] values;
+ }
+
+ public final class IntFloatMapKt {
+ method public static inline androidx.collection.IntFloatMap buildIntFloatMap(int initialCapacity, kotlin.jvm.functions.Function1<? super androidx.collection.MutableIntFloatMap,kotlin.Unit> builderAction);
+ method public static inline androidx.collection.IntFloatMap buildIntFloatMap(kotlin.jvm.functions.Function1<? super androidx.collection.MutableIntFloatMap,kotlin.Unit> builderAction);
+ method public static androidx.collection.IntFloatMap emptyIntFloatMap();
+ method public static androidx.collection.IntFloatMap intFloatMapOf();
+ method public static androidx.collection.IntFloatMap intFloatMapOf(int key1, float value1);
+ method public static androidx.collection.IntFloatMap intFloatMapOf(int key1, float value1, int key2, float value2);
+ method public static androidx.collection.IntFloatMap intFloatMapOf(int key1, float value1, int key2, float value2, int key3, float value3);
+ method public static androidx.collection.IntFloatMap intFloatMapOf(int key1, float value1, int key2, float value2, int key3, float value3, int key4, float value4);
+ method public static androidx.collection.IntFloatMap intFloatMapOf(int key1, float value1, int key2, float value2, int key3, float value3, int key4, float value4, int key5, float value5);
+ method public static androidx.collection.MutableIntFloatMap mutableIntFloatMapOf();
+ method public static androidx.collection.MutableIntFloatMap mutableIntFloatMapOf(int key1, float value1);
+ method public static androidx.collection.MutableIntFloatMap mutableIntFloatMapOf(int key1, float value1, int key2, float value2);
+ method public static androidx.collection.MutableIntFloatMap mutableIntFloatMapOf(int key1, float value1, int key2, float value2, int key3, float value3);
+ method public static androidx.collection.MutableIntFloatMap mutableIntFloatMapOf(int key1, float value1, int key2, float value2, int key3, float value3, int key4, float value4);
+ method public static androidx.collection.MutableIntFloatMap mutableIntFloatMapOf(int key1, float value1, int key2, float value2, int key3, float value3, int key4, float value4, int key5, float value5);
+ }
+
+ public abstract sealed class IntIntMap {
+ method public final inline boolean all(kotlin.jvm.functions.Function2<? super java.lang.Integer,? super java.lang.Integer,java.lang.Boolean> predicate);
+ method public final boolean any();
+ method public final inline boolean any(kotlin.jvm.functions.Function2<? super java.lang.Integer,? super java.lang.Integer,java.lang.Boolean> predicate);
+ method public final inline operator boolean contains(int key);
+ method public final boolean containsKey(int key);
+ method public final boolean containsValue(int value);
+ method public final int count();
+ method public final inline int count(kotlin.jvm.functions.Function2<? super java.lang.Integer,? super java.lang.Integer,java.lang.Boolean> predicate);
+ method @kotlin.PublishedApi internal final int findKeyIndex(int key);
+ method public final inline void forEach(kotlin.jvm.functions.Function2<? super java.lang.Integer,? super java.lang.Integer,kotlin.Unit> block);
+ method @kotlin.PublishedApi internal final inline void forEachIndexed(kotlin.jvm.functions.Function1<? super java.lang.Integer,kotlin.Unit> block);
+ method public final inline void forEachKey(kotlin.jvm.functions.Function1<? super java.lang.Integer,kotlin.Unit> block);
+ method public final inline void forEachValue(kotlin.jvm.functions.Function1<? super java.lang.Integer,kotlin.Unit> block);
+ method public final operator int get(int key);
+ method public final int getCapacity();
+ method public final int getOrDefault(int key, int defaultValue);
+ method public final inline int getOrElse(int key, kotlin.jvm.functions.Function0<java.lang.Integer> defaultValue);
+ method public final int getSize();
+ method public final boolean isEmpty();
+ method public final boolean isNotEmpty();
+ method public final String joinToString();
+ method public final String joinToString(optional CharSequence separator);
+ method public final String joinToString(optional CharSequence separator, optional CharSequence prefix);
+ method public final String joinToString(optional CharSequence separator, optional CharSequence prefix, optional CharSequence postfix);
+ method public final String joinToString(optional CharSequence separator, optional CharSequence prefix, optional CharSequence postfix, optional int limit);
+ method public final String joinToString(optional CharSequence separator, optional CharSequence prefix, optional CharSequence postfix, optional int limit, optional CharSequence truncated);
+ method public final inline String joinToString(optional CharSequence separator, optional CharSequence prefix, optional CharSequence postfix, optional int limit, optional CharSequence truncated, kotlin.jvm.functions.Function2<? super java.lang.Integer,? super java.lang.Integer,? extends java.lang.CharSequence> transform);
+ method public final inline String joinToString(optional CharSequence separator, optional CharSequence prefix, optional CharSequence postfix, optional int limit, kotlin.jvm.functions.Function2<? super java.lang.Integer,? super java.lang.Integer,? extends java.lang.CharSequence> transform);
+ method public final inline String joinToString(optional CharSequence separator, optional CharSequence prefix, optional CharSequence postfix, kotlin.jvm.functions.Function2<? super java.lang.Integer,? super java.lang.Integer,? extends java.lang.CharSequence> transform);
+ method public final inline String joinToString(optional CharSequence separator, optional CharSequence prefix, kotlin.jvm.functions.Function2<? super java.lang.Integer,? super java.lang.Integer,? extends java.lang.CharSequence> transform);
+ method public final inline String joinToString(optional CharSequence separator, kotlin.jvm.functions.Function2<? super java.lang.Integer,? super java.lang.Integer,? extends java.lang.CharSequence> transform);
+ method public final inline String joinToString(kotlin.jvm.functions.Function2<? super java.lang.Integer,? super java.lang.Integer,? extends java.lang.CharSequence> transform);
+ method public final boolean none();
+ property public final int capacity;
+ property @kotlin.PublishedApi internal final int[] keys;
+ property @kotlin.PublishedApi internal final long[] metadata;
+ property public final int size;
+ property @kotlin.PublishedApi internal final int[] values;
+ field @kotlin.PublishedApi internal int[] keys;
+ field @kotlin.PublishedApi internal long[] metadata;
+ field @kotlin.PublishedApi internal int[] values;
+ }
+
+ public final class IntIntMapKt {
+ method public static inline androidx.collection.IntIntMap buildIntIntMap(int initialCapacity, kotlin.jvm.functions.Function1<? super androidx.collection.MutableIntIntMap,kotlin.Unit> builderAction);
+ method public static inline androidx.collection.IntIntMap buildIntIntMap(kotlin.jvm.functions.Function1<? super androidx.collection.MutableIntIntMap,kotlin.Unit> builderAction);
+ method public static androidx.collection.IntIntMap emptyIntIntMap();
+ method public static androidx.collection.IntIntMap intIntMapOf();
+ method public static androidx.collection.IntIntMap intIntMapOf(int key1, int value1);
+ method public static androidx.collection.IntIntMap intIntMapOf(int key1, int value1, int key2, int value2);
+ method public static androidx.collection.IntIntMap intIntMapOf(int key1, int value1, int key2, int value2, int key3, int value3);
+ method public static androidx.collection.IntIntMap intIntMapOf(int key1, int value1, int key2, int value2, int key3, int value3, int key4, int value4);
+ method public static androidx.collection.IntIntMap intIntMapOf(int key1, int value1, int key2, int value2, int key3, int value3, int key4, int value4, int key5, int value5);
+ method public static androidx.collection.MutableIntIntMap mutableIntIntMapOf();
+ method public static androidx.collection.MutableIntIntMap mutableIntIntMapOf(int key1, int value1);
+ method public static androidx.collection.MutableIntIntMap mutableIntIntMapOf(int key1, int value1, int key2, int value2);
+ method public static androidx.collection.MutableIntIntMap mutableIntIntMapOf(int key1, int value1, int key2, int value2, int key3, int value3);
+ method public static androidx.collection.MutableIntIntMap mutableIntIntMapOf(int key1, int value1, int key2, int value2, int key3, int value3, int key4, int value4);
+ method public static androidx.collection.MutableIntIntMap mutableIntIntMapOf(int key1, int value1, int key2, int value2, int key3, int value3, int key4, int value4, int key5, int value5);
+ }
+
+ @kotlin.jvm.JvmInline public final value class IntIntPair {
+ ctor public IntIntPair(int first, int second);
+ method public inline operator int component1();
+ method public inline operator int component2();
+ property public final int first;
+ property public final long packedValue;
+ property public final int second;
+ field public final long packedValue;
+ }
+
+ public abstract sealed class IntList {
+ method public final inline boolean any();
+ method public final inline boolean any(kotlin.jvm.functions.Function1<? super java.lang.Integer,java.lang.Boolean> predicate);
+ method public final int binarySearch(int element);
+ method public final int binarySearch(int element, optional int fromIndex);
+ method public final int binarySearch(int element, optional int fromIndex, optional int toIndex);
+ method public final operator boolean contains(int element);
+ method public final boolean containsAll(androidx.collection.IntList elements);
+ method public final inline int count();
+ method public final inline int count(kotlin.jvm.functions.Function1<? super java.lang.Integer,java.lang.Boolean> predicate);
+ method public final int elementAt(@IntRange(from=0L) int index);
+ method public final inline int elementAtOrElse(@IntRange(from=0L) int index, kotlin.jvm.functions.Function1<? super java.lang.Integer,java.lang.Integer> defaultValue);
+ method public final int first();
+ method public final inline int first(kotlin.jvm.functions.Function1<? super java.lang.Integer,java.lang.Boolean> predicate);
+ method public final inline <R> R fold(R initial, kotlin.jvm.functions.Function2<? super R,? super java.lang.Integer,? extends R> operation);
+ method public final inline <R> R foldIndexed(R initial, kotlin.jvm.functions.Function3<? super java.lang.Integer,? super R,? super java.lang.Integer,? extends R> operation);
+ method public final inline <R> R foldRight(R initial, kotlin.jvm.functions.Function2<? super java.lang.Integer,? super R,? extends R> operation);
+ method public final inline <R> R foldRightIndexed(R initial, kotlin.jvm.functions.Function3<? super java.lang.Integer,? super java.lang.Integer,? super R,? extends R> operation);
+ method public final inline void forEach(kotlin.jvm.functions.Function1<? super java.lang.Integer,kotlin.Unit> block);
+ method public final inline void forEachIndexed(kotlin.jvm.functions.Function2<? super java.lang.Integer,? super java.lang.Integer,kotlin.Unit> block);
+ method public final inline void forEachReversed(kotlin.jvm.functions.Function1<? super java.lang.Integer,kotlin.Unit> block);
+ method public final inline void forEachReversedIndexed(kotlin.jvm.functions.Function2<? super java.lang.Integer,? super java.lang.Integer,kotlin.Unit> block);
+ method public final operator int get(@IntRange(from=0L) int index);
+ method public final inline kotlin.ranges.IntRange getIndices();
+ method @IntRange(from=-1L) public final inline int getLastIndex();
+ method @IntRange(from=0L) public final inline int getSize();
+ method public final int indexOf(int element);
+ method public final inline int indexOfFirst(kotlin.jvm.functions.Function1<? super java.lang.Integer,java.lang.Boolean> predicate);
+ method public final inline int indexOfLast(kotlin.jvm.functions.Function1<? super java.lang.Integer,java.lang.Boolean> predicate);
+ method public final inline boolean isEmpty();
+ method public final inline boolean isNotEmpty();
+ method public final String joinToString();
+ method public final String joinToString(optional CharSequence separator);
+ method public final String joinToString(optional CharSequence separator, optional CharSequence prefix);
+ method public final String joinToString(optional CharSequence separator, optional CharSequence prefix, optional CharSequence postfix);
+ method public final String joinToString(optional CharSequence separator, optional CharSequence prefix, optional CharSequence postfix, optional int limit);
+ method public final String joinToString(optional CharSequence separator, optional CharSequence prefix, optional CharSequence postfix, optional int limit, optional CharSequence truncated);
+ method public final inline String joinToString(optional CharSequence separator, optional CharSequence prefix, optional CharSequence postfix, optional int limit, optional CharSequence truncated, kotlin.jvm.functions.Function1<? super java.lang.Integer,? extends java.lang.CharSequence> transform);
+ method public final inline String joinToString(optional CharSequence separator, optional CharSequence prefix, optional CharSequence postfix, optional int limit, kotlin.jvm.functions.Function1<? super java.lang.Integer,? extends java.lang.CharSequence> transform);
+ method public final inline String joinToString(optional CharSequence separator, optional CharSequence prefix, optional CharSequence postfix, kotlin.jvm.functions.Function1<? super java.lang.Integer,? extends java.lang.CharSequence> transform);
+ method public final inline String joinToString(optional CharSequence separator, optional CharSequence prefix, kotlin.jvm.functions.Function1<? super java.lang.Integer,? extends java.lang.CharSequence> transform);
+ method public final inline String joinToString(optional CharSequence separator, kotlin.jvm.functions.Function1<? super java.lang.Integer,? extends java.lang.CharSequence> transform);
+ method public final inline String joinToString(kotlin.jvm.functions.Function1<? super java.lang.Integer,? extends java.lang.CharSequence> transform);
+ method public final int last();
+ method public final inline int last(kotlin.jvm.functions.Function1<? super java.lang.Integer,java.lang.Boolean> predicate);
+ method public final int lastIndexOf(int element);
+ method public final inline boolean none();
+ method public final inline boolean reversedAny(kotlin.jvm.functions.Function1<? super java.lang.Integer,java.lang.Boolean> predicate);
+ property @kotlin.PublishedApi internal final int _size;
+ property @kotlin.PublishedApi internal final int[] content;
+ property public final inline kotlin.ranges.IntRange indices;
+ property @IntRange(from=-1L) public final inline int lastIndex;
+ property @IntRange(from=0L) public final inline int size;
+ field @kotlin.PublishedApi internal int _size;
+ field @kotlin.PublishedApi internal int[] content;
+ }
+
+ public final class IntListKt {
+ method public static inline androidx.collection.IntList buildIntList(int initialCapacity, kotlin.jvm.functions.Function1<? super androidx.collection.MutableIntList,kotlin.Unit> builderAction);
+ method public static inline androidx.collection.IntList buildIntList(kotlin.jvm.functions.Function1<? super androidx.collection.MutableIntList,kotlin.Unit> builderAction);
+ method public static androidx.collection.IntList emptyIntList();
+ method public static androidx.collection.IntList intListOf();
+ method public static androidx.collection.IntList intListOf(int element1);
+ method public static androidx.collection.IntList intListOf(int element1, int element2);
+ method public static androidx.collection.IntList intListOf(int element1, int element2, int element3);
+ method public static androidx.collection.IntList intListOf(int... elements);
+ method public static inline androidx.collection.MutableIntList mutableIntListOf();
+ method public static androidx.collection.MutableIntList mutableIntListOf(int element1);
+ method public static androidx.collection.MutableIntList mutableIntListOf(int element1, int element2);
+ method public static androidx.collection.MutableIntList mutableIntListOf(int element1, int element2, int element3);
+ method public static inline androidx.collection.MutableIntList mutableIntListOf(int... elements);
+ }
+
+ public abstract sealed class IntLongMap {
+ method public final inline boolean all(kotlin.jvm.functions.Function2<? super java.lang.Integer,? super java.lang.Long,java.lang.Boolean> predicate);
+ method public final boolean any();
+ method public final inline boolean any(kotlin.jvm.functions.Function2<? super java.lang.Integer,? super java.lang.Long,java.lang.Boolean> predicate);
+ method public final inline operator boolean contains(int key);
+ method public final boolean containsKey(int key);
+ method public final boolean containsValue(long value);
+ method public final int count();
+ method public final inline int count(kotlin.jvm.functions.Function2<? super java.lang.Integer,? super java.lang.Long,java.lang.Boolean> predicate);
+ method @kotlin.PublishedApi internal final int findKeyIndex(int key);
+ method public final inline void forEach(kotlin.jvm.functions.Function2<? super java.lang.Integer,? super java.lang.Long,kotlin.Unit> block);
+ method @kotlin.PublishedApi internal final inline void forEachIndexed(kotlin.jvm.functions.Function1<? super java.lang.Integer,kotlin.Unit> block);
+ method public final inline void forEachKey(kotlin.jvm.functions.Function1<? super java.lang.Integer,kotlin.Unit> block);
+ method public final inline void forEachValue(kotlin.jvm.functions.Function1<? super java.lang.Long,kotlin.Unit> block);
+ method public final operator long get(int key);
+ method public final int getCapacity();
+ method public final long getOrDefault(int key, long defaultValue);
+ method public final inline long getOrElse(int key, kotlin.jvm.functions.Function0<java.lang.Long> defaultValue);
+ method public final int getSize();
+ method public final boolean isEmpty();
+ method public final boolean isNotEmpty();
+ method public final String joinToString();
+ method public final String joinToString(optional CharSequence separator);
+ method public final String joinToString(optional CharSequence separator, optional CharSequence prefix);
+ method public final String joinToString(optional CharSequence separator, optional CharSequence prefix, optional CharSequence postfix);
+ method public final String joinToString(optional CharSequence separator, optional CharSequence prefix, optional CharSequence postfix, optional int limit);
+ method public final String joinToString(optional CharSequence separator, optional CharSequence prefix, optional CharSequence postfix, optional int limit, optional CharSequence truncated);
+ method public final inline String joinToString(optional CharSequence separator, optional CharSequence prefix, optional CharSequence postfix, optional int limit, optional CharSequence truncated, kotlin.jvm.functions.Function2<? super java.lang.Integer,? super java.lang.Long,? extends java.lang.CharSequence> transform);
+ method public final inline String joinToString(optional CharSequence separator, optional CharSequence prefix, optional CharSequence postfix, optional int limit, kotlin.jvm.functions.Function2<? super java.lang.Integer,? super java.lang.Long,? extends java.lang.CharSequence> transform);
+ method public final inline String joinToString(optional CharSequence separator, optional CharSequence prefix, optional CharSequence postfix, kotlin.jvm.functions.Function2<? super java.lang.Integer,? super java.lang.Long,? extends java.lang.CharSequence> transform);
+ method public final inline String joinToString(optional CharSequence separator, optional CharSequence prefix, kotlin.jvm.functions.Function2<? super java.lang.Integer,? super java.lang.Long,? extends java.lang.CharSequence> transform);
+ method public final inline String joinToString(optional CharSequence separator, kotlin.jvm.functions.Function2<? super java.lang.Integer,? super java.lang.Long,? extends java.lang.CharSequence> transform);
+ method public final inline String joinToString(kotlin.jvm.functions.Function2<? super java.lang.Integer,? super java.lang.Long,? extends java.lang.CharSequence> transform);
+ method public final boolean none();
+ property public final int capacity;
+ property @kotlin.PublishedApi internal final int[] keys;
+ property @kotlin.PublishedApi internal final long[] metadata;
+ property public final int size;
+ property @kotlin.PublishedApi internal final long[] values;
+ field @kotlin.PublishedApi internal int[] keys;
+ field @kotlin.PublishedApi internal long[] metadata;
+ field @kotlin.PublishedApi internal long[] values;
+ }
+
+ public final class IntLongMapKt {
+ method public static inline androidx.collection.IntLongMap buildIntLongMap(int initialCapacity, kotlin.jvm.functions.Function1<? super androidx.collection.MutableIntLongMap,kotlin.Unit> builderAction);
+ method public static inline androidx.collection.IntLongMap buildIntLongMap(kotlin.jvm.functions.Function1<? super androidx.collection.MutableIntLongMap,kotlin.Unit> builderAction);
+ method public static androidx.collection.IntLongMap emptyIntLongMap();
+ method public static androidx.collection.IntLongMap intLongMapOf();
+ method public static androidx.collection.IntLongMap intLongMapOf(int key1, long value1);
+ method public static androidx.collection.IntLongMap intLongMapOf(int key1, long value1, int key2, long value2);
+ method public static androidx.collection.IntLongMap intLongMapOf(int key1, long value1, int key2, long value2, int key3, long value3);
+ method public static androidx.collection.IntLongMap intLongMapOf(int key1, long value1, int key2, long value2, int key3, long value3, int key4, long value4);
+ method public static androidx.collection.IntLongMap intLongMapOf(int key1, long value1, int key2, long value2, int key3, long value3, int key4, long value4, int key5, long value5);
+ method public static androidx.collection.MutableIntLongMap mutableIntLongMapOf();
+ method public static androidx.collection.MutableIntLongMap mutableIntLongMapOf(int key1, long value1);
+ method public static androidx.collection.MutableIntLongMap mutableIntLongMapOf(int key1, long value1, int key2, long value2);
+ method public static androidx.collection.MutableIntLongMap mutableIntLongMapOf(int key1, long value1, int key2, long value2, int key3, long value3);
+ method public static androidx.collection.MutableIntLongMap mutableIntLongMapOf(int key1, long value1, int key2, long value2, int key3, long value3, int key4, long value4);
+ method public static androidx.collection.MutableIntLongMap mutableIntLongMapOf(int key1, long value1, int key2, long value2, int key3, long value3, int key4, long value4, int key5, long value5);
+ }
+
+ public abstract sealed class IntObjectMap<V> {
+ method public final inline boolean all(kotlin.jvm.functions.Function2<? super java.lang.Integer,? super V,java.lang.Boolean> predicate);
+ method public final boolean any();
+ method public final inline boolean any(kotlin.jvm.functions.Function2<? super java.lang.Integer,? super V,java.lang.Boolean> predicate);
+ method public final inline operator boolean contains(int key);
+ method public final boolean containsKey(int key);
+ method public final boolean containsValue(V value);
+ method public final int count();
+ method public final inline int count(kotlin.jvm.functions.Function2<? super java.lang.Integer,? super V,java.lang.Boolean> predicate);
+ method public final inline void forEach(kotlin.jvm.functions.Function2<? super java.lang.Integer,? super V,kotlin.Unit> block);
+ method @kotlin.PublishedApi internal final inline void forEachIndexed(kotlin.jvm.functions.Function1<? super java.lang.Integer,kotlin.Unit> block);
+ method public final inline void forEachKey(kotlin.jvm.functions.Function1<? super java.lang.Integer,kotlin.Unit> block);
+ method public final inline void forEachValue(kotlin.jvm.functions.Function1<? super V,kotlin.Unit> block);
+ method public final operator V? get(int key);
+ method public final int getCapacity();
+ method public final V getOrDefault(int key, V defaultValue);
+ method public final inline V getOrElse(int key, kotlin.jvm.functions.Function0<? extends V> defaultValue);
+ method public final int getSize();
+ method public final boolean isEmpty();
+ method public final boolean isNotEmpty();
+ method public final String joinToString();
+ method public final String joinToString(optional CharSequence separator);
+ method public final String joinToString(optional CharSequence separator, optional CharSequence prefix);
+ method public final String joinToString(optional CharSequence separator, optional CharSequence prefix, optional CharSequence postfix);
+ method public final String joinToString(optional CharSequence separator, optional CharSequence prefix, optional CharSequence postfix, optional int limit);
+ method public final String joinToString(optional CharSequence separator, optional CharSequence prefix, optional CharSequence postfix, optional int limit, optional CharSequence truncated);
+ method public final inline String joinToString(optional CharSequence separator, optional CharSequence prefix, optional CharSequence postfix, optional int limit, optional CharSequence truncated, kotlin.jvm.functions.Function2<? super java.lang.Integer,? super V,? extends java.lang.CharSequence> transform);
+ method public final inline String joinToString(optional CharSequence separator, optional CharSequence prefix, optional CharSequence postfix, optional int limit, kotlin.jvm.functions.Function2<? super java.lang.Integer,? super V,? extends java.lang.CharSequence> transform);
+ method public final inline String joinToString(optional CharSequence separator, optional CharSequence prefix, optional CharSequence postfix, kotlin.jvm.functions.Function2<? super java.lang.Integer,? super V,? extends java.lang.CharSequence> transform);
+ method public final inline String joinToString(optional CharSequence separator, optional CharSequence prefix, kotlin.jvm.functions.Function2<? super java.lang.Integer,? super V,? extends java.lang.CharSequence> transform);
+ method public final inline String joinToString(optional CharSequence separator, kotlin.jvm.functions.Function2<? super java.lang.Integer,? super V,? extends java.lang.CharSequence> transform);
+ method public final inline String joinToString(kotlin.jvm.functions.Function2<? super java.lang.Integer,? super V,? extends java.lang.CharSequence> transform);
+ method public final boolean none();
+ property public final int capacity;
+ property @kotlin.PublishedApi internal final int[] keys;
+ property @kotlin.PublishedApi internal final long[] metadata;
+ property public final int size;
+ property @kotlin.PublishedApi internal final Object?[] values;
+ field @kotlin.PublishedApi internal int[] keys;
+ field @kotlin.PublishedApi internal long[] metadata;
+ field @kotlin.PublishedApi internal Object?[] values;
+ }
+
+ public final class IntObjectMapKt {
+ method public static inline <V> androidx.collection.IntObjectMap<V> buildIntObjectMap(int initialCapacity, kotlin.jvm.functions.Function1<? super androidx.collection.MutableIntObjectMap<V>,kotlin.Unit> builderAction);
+ method public static inline <V> androidx.collection.IntObjectMap<V> buildIntObjectMap(kotlin.jvm.functions.Function1<? super androidx.collection.MutableIntObjectMap<V>,kotlin.Unit> builderAction);
+ method public static <V> androidx.collection.IntObjectMap<V> emptyIntObjectMap();
+ method public static <V> androidx.collection.IntObjectMap<V> intObjectMapOf();
+ method public static <V> androidx.collection.IntObjectMap<V> intObjectMapOf(int key1, V value1);
+ method public static <V> androidx.collection.IntObjectMap<V> intObjectMapOf(int key1, V value1, int key2, V value2);
+ method public static <V> androidx.collection.IntObjectMap<V> intObjectMapOf(int key1, V value1, int key2, V value2, int key3, V value3);
+ method public static <V> androidx.collection.IntObjectMap<V> intObjectMapOf(int key1, V value1, int key2, V value2, int key3, V value3, int key4, V value4);
+ method public static <V> androidx.collection.IntObjectMap<V> intObjectMapOf(int key1, V value1, int key2, V value2, int key3, V value3, int key4, V value4, int key5, V value5);
+ method public static <V> androidx.collection.MutableIntObjectMap<V> mutableIntObjectMapOf();
+ method public static <V> androidx.collection.MutableIntObjectMap<V> mutableIntObjectMapOf(int key1, V value1);
+ method public static <V> androidx.collection.MutableIntObjectMap<V> mutableIntObjectMapOf(int key1, V value1, int key2, V value2);
+ method public static <V> androidx.collection.MutableIntObjectMap<V> mutableIntObjectMapOf(int key1, V value1, int key2, V value2, int key3, V value3);
+ method public static <V> androidx.collection.MutableIntObjectMap<V> mutableIntObjectMapOf(int key1, V value1, int key2, V value2, int key3, V value3, int key4, V value4);
+ method public static <V> androidx.collection.MutableIntObjectMap<V> mutableIntObjectMapOf(int key1, V value1, int key2, V value2, int key3, V value3, int key4, V value4, int key5, V value5);
+ }
+
+ public abstract sealed class IntSet {
+ method public final inline boolean all(kotlin.jvm.functions.Function1<? super java.lang.Integer,java.lang.Boolean> predicate);
+ method public final boolean any();
+ method public final inline boolean any(kotlin.jvm.functions.Function1<? super java.lang.Integer,java.lang.Boolean> predicate);
+ method public final operator boolean contains(int element);
+ method @IntRange(from=0L) public final int count();
+ method @IntRange(from=0L) public final inline int count(kotlin.jvm.functions.Function1<? super java.lang.Integer,java.lang.Boolean> predicate);
+ method public final inline int first();
+ method public final inline int first(kotlin.jvm.functions.Function1<? super java.lang.Integer,java.lang.Boolean> predicate);
+ method public final inline void forEach(kotlin.jvm.functions.Function1<? super java.lang.Integer,kotlin.Unit> block);
+ method @kotlin.PublishedApi internal final inline void forEachIndex(kotlin.jvm.functions.Function1<? super java.lang.Integer,kotlin.Unit> block);
+ method @IntRange(from=0L) public final int getCapacity();
+ method @IntRange(from=0L) public final int getSize();
+ method public final boolean isEmpty();
+ method public final boolean isNotEmpty();
+ method public final String joinToString();
+ method public final String joinToString(optional CharSequence separator);
+ method public final String joinToString(optional CharSequence separator, optional CharSequence prefix);
+ method public final String joinToString(optional CharSequence separator, optional CharSequence prefix, optional CharSequence postfix);
+ method public final String joinToString(optional CharSequence separator, optional CharSequence prefix, optional CharSequence postfix, optional int limit);
+ method public final String joinToString(optional CharSequence separator, optional CharSequence prefix, optional CharSequence postfix, optional int limit, optional CharSequence truncated);
+ method public final inline String joinToString(optional CharSequence separator, optional CharSequence prefix, optional CharSequence postfix, optional int limit, optional CharSequence truncated, kotlin.jvm.functions.Function1<? super java.lang.Integer,? extends java.lang.CharSequence> transform);
+ method public final inline String joinToString(optional CharSequence separator, optional CharSequence prefix, optional CharSequence postfix, optional int limit, kotlin.jvm.functions.Function1<? super java.lang.Integer,? extends java.lang.CharSequence> transform);
+ method public final inline String joinToString(optional CharSequence separator, optional CharSequence prefix, optional CharSequence postfix, kotlin.jvm.functions.Function1<? super java.lang.Integer,? extends java.lang.CharSequence> transform);
+ method public final inline String joinToString(optional CharSequence separator, optional CharSequence prefix, kotlin.jvm.functions.Function1<? super java.lang.Integer,? extends java.lang.CharSequence> transform);
+ method public final inline String joinToString(optional CharSequence separator, kotlin.jvm.functions.Function1<? super java.lang.Integer,? extends java.lang.CharSequence> transform);
+ method public final inline String joinToString(kotlin.jvm.functions.Function1<? super java.lang.Integer,? extends java.lang.CharSequence> transform);
+ method public final boolean none();
+ property @IntRange(from=0L) public final int capacity;
+ property @kotlin.PublishedApi internal final int[] elements;
+ property @kotlin.PublishedApi internal final long[] metadata;
+ property @IntRange(from=0L) public final int size;
+ field @kotlin.PublishedApi internal int[] elements;
+ field @kotlin.PublishedApi internal long[] metadata;
+ }
+
+ public final class IntSetKt {
+ method public static inline androidx.collection.IntSet buildIntSet(int initialCapacity, kotlin.jvm.functions.Function1<? super androidx.collection.MutableIntSet,kotlin.Unit> builderAction);
+ method public static inline androidx.collection.IntSet buildIntSet(kotlin.jvm.functions.Function1<? super androidx.collection.MutableIntSet,kotlin.Unit> builderAction);
+ method public static androidx.collection.IntSet emptyIntSet();
+ method public static androidx.collection.IntSet intSetOf();
+ method public static androidx.collection.IntSet intSetOf(int element1);
+ method public static androidx.collection.IntSet intSetOf(int element1, int element2);
+ method public static androidx.collection.IntSet intSetOf(int element1, int element2, int element3);
+ method public static androidx.collection.IntSet intSetOf(int... elements);
+ method public static androidx.collection.MutableIntSet mutableIntSetOf();
+ method public static androidx.collection.MutableIntSet mutableIntSetOf(int element1);
+ method public static androidx.collection.MutableIntSet mutableIntSetOf(int element1, int element2);
+ method public static androidx.collection.MutableIntSet mutableIntSetOf(int element1, int element2, int element3);
+ method public static androidx.collection.MutableIntSet mutableIntSetOf(int... elements);
+ }
+
+ public abstract sealed class LongFloatMap {
+ method public final inline boolean all(kotlin.jvm.functions.Function2<? super java.lang.Long,? super java.lang.Float,java.lang.Boolean> predicate);
+ method public final boolean any();
+ method public final inline boolean any(kotlin.jvm.functions.Function2<? super java.lang.Long,? super java.lang.Float,java.lang.Boolean> predicate);
+ method public final inline operator boolean contains(long key);
+ method public final boolean containsKey(long key);
+ method public final boolean containsValue(float value);
+ method public final int count();
+ method public final inline int count(kotlin.jvm.functions.Function2<? super java.lang.Long,? super java.lang.Float,java.lang.Boolean> predicate);
+ method @kotlin.PublishedApi internal final int findKeyIndex(long key);
+ method public final inline void forEach(kotlin.jvm.functions.Function2<? super java.lang.Long,? super java.lang.Float,kotlin.Unit> block);
+ method @kotlin.PublishedApi internal final inline void forEachIndexed(kotlin.jvm.functions.Function1<? super java.lang.Integer,kotlin.Unit> block);
+ method public final inline void forEachKey(kotlin.jvm.functions.Function1<? super java.lang.Long,kotlin.Unit> block);
+ method public final inline void forEachValue(kotlin.jvm.functions.Function1<? super java.lang.Float,kotlin.Unit> block);
+ method public final operator float get(long key);
+ method public final int getCapacity();
+ method public final float getOrDefault(long key, float defaultValue);
+ method public final inline float getOrElse(long key, kotlin.jvm.functions.Function0<java.lang.Float> defaultValue);
+ method public final int getSize();
+ method public final boolean isEmpty();
+ method public final boolean isNotEmpty();
+ method public final String joinToString();
+ method public final String joinToString(optional CharSequence separator);
+ method public final String joinToString(optional CharSequence separator, optional CharSequence prefix);
+ method public final String joinToString(optional CharSequence separator, optional CharSequence prefix, optional CharSequence postfix);
+ method public final String joinToString(optional CharSequence separator, optional CharSequence prefix, optional CharSequence postfix, optional int limit);
+ method public final String joinToString(optional CharSequence separator, optional CharSequence prefix, optional CharSequence postfix, optional int limit, optional CharSequence truncated);
+ method public final inline String joinToString(optional CharSequence separator, optional CharSequence prefix, optional CharSequence postfix, optional int limit, optional CharSequence truncated, kotlin.jvm.functions.Function2<? super java.lang.Long,? super java.lang.Float,? extends java.lang.CharSequence> transform);
+ method public final inline String joinToString(optional CharSequence separator, optional CharSequence prefix, optional CharSequence postfix, optional int limit, kotlin.jvm.functions.Function2<? super java.lang.Long,? super java.lang.Float,? extends java.lang.CharSequence> transform);
+ method public final inline String joinToString(optional CharSequence separator, optional CharSequence prefix, optional CharSequence postfix, kotlin.jvm.functions.Function2<? super java.lang.Long,? super java.lang.Float,? extends java.lang.CharSequence> transform);
+ method public final inline String joinToString(optional CharSequence separator, optional CharSequence prefix, kotlin.jvm.functions.Function2<? super java.lang.Long,? super java.lang.Float,? extends java.lang.CharSequence> transform);
+ method public final inline String joinToString(optional CharSequence separator, kotlin.jvm.functions.Function2<? super java.lang.Long,? super java.lang.Float,? extends java.lang.CharSequence> transform);
+ method public final inline String joinToString(kotlin.jvm.functions.Function2<? super java.lang.Long,? super java.lang.Float,? extends java.lang.CharSequence> transform);
+ method public final boolean none();
+ property public final int capacity;
+ property @kotlin.PublishedApi internal final long[] keys;
+ property @kotlin.PublishedApi internal final long[] metadata;
+ property public final int size;
+ property @kotlin.PublishedApi internal final float[] values;
+ field @kotlin.PublishedApi internal long[] keys;
+ field @kotlin.PublishedApi internal long[] metadata;
+ field @kotlin.PublishedApi internal float[] values;
+ }
+
+ public final class LongFloatMapKt {
+ method public static inline androidx.collection.LongFloatMap buildLongFloatMap(int initialCapacity, kotlin.jvm.functions.Function1<? super androidx.collection.MutableLongFloatMap,kotlin.Unit> builderAction);
+ method public static inline androidx.collection.LongFloatMap buildLongFloatMap(kotlin.jvm.functions.Function1<? super androidx.collection.MutableLongFloatMap,kotlin.Unit> builderAction);
+ method public static androidx.collection.LongFloatMap emptyLongFloatMap();
+ method public static androidx.collection.LongFloatMap longFloatMapOf();
+ method public static androidx.collection.LongFloatMap longFloatMapOf(long key1, float value1);
+ method public static androidx.collection.LongFloatMap longFloatMapOf(long key1, float value1, long key2, float value2);
+ method public static androidx.collection.LongFloatMap longFloatMapOf(long key1, float value1, long key2, float value2, long key3, float value3);
+ method public static androidx.collection.LongFloatMap longFloatMapOf(long key1, float value1, long key2, float value2, long key3, float value3, long key4, float value4);
+ method public static androidx.collection.LongFloatMap longFloatMapOf(long key1, float value1, long key2, float value2, long key3, float value3, long key4, float value4, long key5, float value5);
+ method public static androidx.collection.MutableLongFloatMap mutableLongFloatMapOf();
+ method public static androidx.collection.MutableLongFloatMap mutableLongFloatMapOf(long key1, float value1);
+ method public static androidx.collection.MutableLongFloatMap mutableLongFloatMapOf(long key1, float value1, long key2, float value2);
+ method public static androidx.collection.MutableLongFloatMap mutableLongFloatMapOf(long key1, float value1, long key2, float value2, long key3, float value3);
+ method public static androidx.collection.MutableLongFloatMap mutableLongFloatMapOf(long key1, float value1, long key2, float value2, long key3, float value3, long key4, float value4);
+ method public static androidx.collection.MutableLongFloatMap mutableLongFloatMapOf(long key1, float value1, long key2, float value2, long key3, float value3, long key4, float value4, long key5, float value5);
+ }
+
+ public abstract sealed class LongIntMap {
+ method public final inline boolean all(kotlin.jvm.functions.Function2<? super java.lang.Long,? super java.lang.Integer,java.lang.Boolean> predicate);
+ method public final boolean any();
+ method public final inline boolean any(kotlin.jvm.functions.Function2<? super java.lang.Long,? super java.lang.Integer,java.lang.Boolean> predicate);
+ method public final inline operator boolean contains(long key);
+ method public final boolean containsKey(long key);
+ method public final boolean containsValue(int value);
+ method public final int count();
+ method public final inline int count(kotlin.jvm.functions.Function2<? super java.lang.Long,? super java.lang.Integer,java.lang.Boolean> predicate);
+ method @kotlin.PublishedApi internal final int findKeyIndex(long key);
+ method public final inline void forEach(kotlin.jvm.functions.Function2<? super java.lang.Long,? super java.lang.Integer,kotlin.Unit> block);
+ method @kotlin.PublishedApi internal final inline void forEachIndexed(kotlin.jvm.functions.Function1<? super java.lang.Integer,kotlin.Unit> block);
+ method public final inline void forEachKey(kotlin.jvm.functions.Function1<? super java.lang.Long,kotlin.Unit> block);
+ method public final inline void forEachValue(kotlin.jvm.functions.Function1<? super java.lang.Integer,kotlin.Unit> block);
+ method public final operator int get(long key);
+ method public final int getCapacity();
+ method public final int getOrDefault(long key, int defaultValue);
+ method public final inline int getOrElse(long key, kotlin.jvm.functions.Function0<java.lang.Integer> defaultValue);
+ method public final int getSize();
+ method public final boolean isEmpty();
+ method public final boolean isNotEmpty();
+ method public final String joinToString();
+ method public final String joinToString(optional CharSequence separator);
+ method public final String joinToString(optional CharSequence separator, optional CharSequence prefix);
+ method public final String joinToString(optional CharSequence separator, optional CharSequence prefix, optional CharSequence postfix);
+ method public final String joinToString(optional CharSequence separator, optional CharSequence prefix, optional CharSequence postfix, optional int limit);
+ method public final String joinToString(optional CharSequence separator, optional CharSequence prefix, optional CharSequence postfix, optional int limit, optional CharSequence truncated);
+ method public final inline String joinToString(optional CharSequence separator, optional CharSequence prefix, optional CharSequence postfix, optional int limit, optional CharSequence truncated, kotlin.jvm.functions.Function2<? super java.lang.Long,? super java.lang.Integer,? extends java.lang.CharSequence> transform);
+ method public final inline String joinToString(optional CharSequence separator, optional CharSequence prefix, optional CharSequence postfix, optional int limit, kotlin.jvm.functions.Function2<? super java.lang.Long,? super java.lang.Integer,? extends java.lang.CharSequence> transform);
+ method public final inline String joinToString(optional CharSequence separator, optional CharSequence prefix, optional CharSequence postfix, kotlin.jvm.functions.Function2<? super java.lang.Long,? super java.lang.Integer,? extends java.lang.CharSequence> transform);
+ method public final inline String joinToString(optional CharSequence separator, optional CharSequence prefix, kotlin.jvm.functions.Function2<? super java.lang.Long,? super java.lang.Integer,? extends java.lang.CharSequence> transform);
+ method public final inline String joinToString(optional CharSequence separator, kotlin.jvm.functions.Function2<? super java.lang.Long,? super java.lang.Integer,? extends java.lang.CharSequence> transform);
+ method public final inline String joinToString(kotlin.jvm.functions.Function2<? super java.lang.Long,? super java.lang.Integer,? extends java.lang.CharSequence> transform);
+ method public final boolean none();
+ property public final int capacity;
+ property @kotlin.PublishedApi internal final long[] keys;
+ property @kotlin.PublishedApi internal final long[] metadata;
+ property public final int size;
+ property @kotlin.PublishedApi internal final int[] values;
+ field @kotlin.PublishedApi internal long[] keys;
+ field @kotlin.PublishedApi internal long[] metadata;
+ field @kotlin.PublishedApi internal int[] values;
+ }
+
+ public final class LongIntMapKt {
+ method public static inline androidx.collection.LongIntMap buildLongIntMap(int initialCapacity, kotlin.jvm.functions.Function1<? super androidx.collection.MutableLongIntMap,kotlin.Unit> builderAction);
+ method public static inline androidx.collection.LongIntMap buildLongIntMap(kotlin.jvm.functions.Function1<? super androidx.collection.MutableLongIntMap,kotlin.Unit> builderAction);
+ method public static androidx.collection.LongIntMap emptyLongIntMap();
+ method public static androidx.collection.LongIntMap longIntMapOf();
+ method public static androidx.collection.LongIntMap longIntMapOf(long key1, int value1);
+ method public static androidx.collection.LongIntMap longIntMapOf(long key1, int value1, long key2, int value2);
+ method public static androidx.collection.LongIntMap longIntMapOf(long key1, int value1, long key2, int value2, long key3, int value3);
+ method public static androidx.collection.LongIntMap longIntMapOf(long key1, int value1, long key2, int value2, long key3, int value3, long key4, int value4);
+ method public static androidx.collection.LongIntMap longIntMapOf(long key1, int value1, long key2, int value2, long key3, int value3, long key4, int value4, long key5, int value5);
+ method public static androidx.collection.MutableLongIntMap mutableLongIntMapOf();
+ method public static androidx.collection.MutableLongIntMap mutableLongIntMapOf(long key1, int value1);
+ method public static androidx.collection.MutableLongIntMap mutableLongIntMapOf(long key1, int value1, long key2, int value2);
+ method public static androidx.collection.MutableLongIntMap mutableLongIntMapOf(long key1, int value1, long key2, int value2, long key3, int value3);
+ method public static androidx.collection.MutableLongIntMap mutableLongIntMapOf(long key1, int value1, long key2, int value2, long key3, int value3, long key4, int value4);
+ method public static androidx.collection.MutableLongIntMap mutableLongIntMapOf(long key1, int value1, long key2, int value2, long key3, int value3, long key4, int value4, long key5, int value5);
+ }
+
+ public abstract sealed class LongList {
+ method public final inline boolean any();
+ method public final inline boolean any(kotlin.jvm.functions.Function1<? super java.lang.Long,java.lang.Boolean> predicate);
+ method public final int binarySearch(int element);
+ method public final int binarySearch(int element, optional int fromIndex);
+ method public final int binarySearch(int element, optional int fromIndex, optional int toIndex);
+ method public final operator boolean contains(long element);
+ method public final boolean containsAll(androidx.collection.LongList elements);
+ method public final inline int count();
+ method public final inline int count(kotlin.jvm.functions.Function1<? super java.lang.Long,java.lang.Boolean> predicate);
+ method public final long elementAt(@IntRange(from=0L) int index);
+ method public final inline long elementAtOrElse(@IntRange(from=0L) int index, kotlin.jvm.functions.Function1<? super java.lang.Integer,java.lang.Long> defaultValue);
+ method public final long first();
+ method public final inline long first(kotlin.jvm.functions.Function1<? super java.lang.Long,java.lang.Boolean> predicate);
+ method public final inline <R> R fold(R initial, kotlin.jvm.functions.Function2<? super R,? super java.lang.Long,? extends R> operation);
+ method public final inline <R> R foldIndexed(R initial, kotlin.jvm.functions.Function3<? super java.lang.Integer,? super R,? super java.lang.Long,? extends R> operation);
+ method public final inline <R> R foldRight(R initial, kotlin.jvm.functions.Function2<? super java.lang.Long,? super R,? extends R> operation);
+ method public final inline <R> R foldRightIndexed(R initial, kotlin.jvm.functions.Function3<? super java.lang.Integer,? super java.lang.Long,? super R,? extends R> operation);
+ method public final inline void forEach(kotlin.jvm.functions.Function1<? super java.lang.Long,kotlin.Unit> block);
+ method public final inline void forEachIndexed(kotlin.jvm.functions.Function2<? super java.lang.Integer,? super java.lang.Long,kotlin.Unit> block);
+ method public final inline void forEachReversed(kotlin.jvm.functions.Function1<? super java.lang.Long,kotlin.Unit> block);
+ method public final inline void forEachReversedIndexed(kotlin.jvm.functions.Function2<? super java.lang.Integer,? super java.lang.Long,kotlin.Unit> block);
+ method public final operator long get(@IntRange(from=0L) int index);
+ method public final inline kotlin.ranges.IntRange getIndices();
+ method @IntRange(from=-1L) public final inline int getLastIndex();
+ method @IntRange(from=0L) public final inline int getSize();
+ method public final int indexOf(long element);
+ method public final inline int indexOfFirst(kotlin.jvm.functions.Function1<? super java.lang.Long,java.lang.Boolean> predicate);
+ method public final inline int indexOfLast(kotlin.jvm.functions.Function1<? super java.lang.Long,java.lang.Boolean> predicate);
+ method public final inline boolean isEmpty();
+ method public final inline boolean isNotEmpty();
+ method public final String joinToString();
+ method public final String joinToString(optional CharSequence separator);
+ method public final String joinToString(optional CharSequence separator, optional CharSequence prefix);
+ method public final String joinToString(optional CharSequence separator, optional CharSequence prefix, optional CharSequence postfix);
+ method public final String joinToString(optional CharSequence separator, optional CharSequence prefix, optional CharSequence postfix, optional int limit);
+ method public final String joinToString(optional CharSequence separator, optional CharSequence prefix, optional CharSequence postfix, optional int limit, optional CharSequence truncated);
+ method public final inline String joinToString(optional CharSequence separator, optional CharSequence prefix, optional CharSequence postfix, optional int limit, optional CharSequence truncated, kotlin.jvm.functions.Function1<? super java.lang.Long,? extends java.lang.CharSequence> transform);
+ method public final inline String joinToString(optional CharSequence separator, optional CharSequence prefix, optional CharSequence postfix, optional int limit, kotlin.jvm.functions.Function1<? super java.lang.Long,? extends java.lang.CharSequence> transform);
+ method public final inline String joinToString(optional CharSequence separator, optional CharSequence prefix, optional CharSequence postfix, kotlin.jvm.functions.Function1<? super java.lang.Long,? extends java.lang.CharSequence> transform);
+ method public final inline String joinToString(optional CharSequence separator, optional CharSequence prefix, kotlin.jvm.functions.Function1<? super java.lang.Long,? extends java.lang.CharSequence> transform);
+ method public final inline String joinToString(optional CharSequence separator, kotlin.jvm.functions.Function1<? super java.lang.Long,? extends java.lang.CharSequence> transform);
+ method public final inline String joinToString(kotlin.jvm.functions.Function1<? super java.lang.Long,? extends java.lang.CharSequence> transform);
+ method public final long last();
+ method public final inline long last(kotlin.jvm.functions.Function1<? super java.lang.Long,java.lang.Boolean> predicate);
+ method public final int lastIndexOf(long element);
+ method public final inline boolean none();
+ method public final inline boolean reversedAny(kotlin.jvm.functions.Function1<? super java.lang.Long,java.lang.Boolean> predicate);
+ property @kotlin.PublishedApi internal final int _size;
+ property @kotlin.PublishedApi internal final long[] content;
+ property public final inline kotlin.ranges.IntRange indices;
+ property @IntRange(from=-1L) public final inline int lastIndex;
+ property @IntRange(from=0L) public final inline int size;
+ field @kotlin.PublishedApi internal int _size;
+ field @kotlin.PublishedApi internal long[] content;
+ }
+
+ public final class LongListKt {
+ method public static inline androidx.collection.LongList buildLongList(int initialCapacity, kotlin.jvm.functions.Function1<? super androidx.collection.MutableLongList,kotlin.Unit> builderAction);
+ method public static inline androidx.collection.LongList buildLongList(kotlin.jvm.functions.Function1<? super androidx.collection.MutableLongList,kotlin.Unit> builderAction);
+ method public static androidx.collection.LongList emptyLongList();
+ method public static androidx.collection.LongList longListOf();
+ method public static androidx.collection.LongList longListOf(long element1);
+ method public static androidx.collection.LongList longListOf(long element1, long element2);
+ method public static androidx.collection.LongList longListOf(long element1, long element2, long element3);
+ method public static androidx.collection.LongList longListOf(long... elements);
+ method public static inline androidx.collection.MutableLongList mutableLongListOf();
+ method public static androidx.collection.MutableLongList mutableLongListOf(long element1);
+ method public static androidx.collection.MutableLongList mutableLongListOf(long element1, long element2);
+ method public static androidx.collection.MutableLongList mutableLongListOf(long element1, long element2, long element3);
+ method public static inline androidx.collection.MutableLongList mutableLongListOf(long... elements);
+ }
+
+ public abstract sealed class LongLongMap {
+ method public final inline boolean all(kotlin.jvm.functions.Function2<? super java.lang.Long,? super java.lang.Long,java.lang.Boolean> predicate);
+ method public final boolean any();
+ method public final inline boolean any(kotlin.jvm.functions.Function2<? super java.lang.Long,? super java.lang.Long,java.lang.Boolean> predicate);
+ method public final inline operator boolean contains(long key);
+ method public final boolean containsKey(long key);
+ method public final boolean containsValue(long value);
+ method public final int count();
+ method public final inline int count(kotlin.jvm.functions.Function2<? super java.lang.Long,? super java.lang.Long,java.lang.Boolean> predicate);
+ method @kotlin.PublishedApi internal final int findKeyIndex(long key);
+ method public final inline void forEach(kotlin.jvm.functions.Function2<? super java.lang.Long,? super java.lang.Long,kotlin.Unit> block);
+ method @kotlin.PublishedApi internal final inline void forEachIndexed(kotlin.jvm.functions.Function1<? super java.lang.Integer,kotlin.Unit> block);
+ method public final inline void forEachKey(kotlin.jvm.functions.Function1<? super java.lang.Long,kotlin.Unit> block);
+ method public final inline void forEachValue(kotlin.jvm.functions.Function1<? super java.lang.Long,kotlin.Unit> block);
+ method public final operator long get(long key);
+ method public final int getCapacity();
+ method public final long getOrDefault(long key, long defaultValue);
+ method public final inline long getOrElse(long key, kotlin.jvm.functions.Function0<java.lang.Long> defaultValue);
+ method public final int getSize();
+ method public final boolean isEmpty();
+ method public final boolean isNotEmpty();
+ method public final String joinToString();
+ method public final String joinToString(optional CharSequence separator);
+ method public final String joinToString(optional CharSequence separator, optional CharSequence prefix);
+ method public final String joinToString(optional CharSequence separator, optional CharSequence prefix, optional CharSequence postfix);
+ method public final String joinToString(optional CharSequence separator, optional CharSequence prefix, optional CharSequence postfix, optional int limit);
+ method public final String joinToString(optional CharSequence separator, optional CharSequence prefix, optional CharSequence postfix, optional int limit, optional CharSequence truncated);
+ method public final inline String joinToString(optional CharSequence separator, optional CharSequence prefix, optional CharSequence postfix, optional int limit, optional CharSequence truncated, kotlin.jvm.functions.Function2<? super java.lang.Long,? super java.lang.Long,? extends java.lang.CharSequence> transform);
+ method public final inline String joinToString(optional CharSequence separator, optional CharSequence prefix, optional CharSequence postfix, optional int limit, kotlin.jvm.functions.Function2<? super java.lang.Long,? super java.lang.Long,? extends java.lang.CharSequence> transform);
+ method public final inline String joinToString(optional CharSequence separator, optional CharSequence prefix, optional CharSequence postfix, kotlin.jvm.functions.Function2<? super java.lang.Long,? super java.lang.Long,? extends java.lang.CharSequence> transform);
+ method public final inline String joinToString(optional CharSequence separator, optional CharSequence prefix, kotlin.jvm.functions.Function2<? super java.lang.Long,? super java.lang.Long,? extends java.lang.CharSequence> transform);
+ method public final inline String joinToString(optional CharSequence separator, kotlin.jvm.functions.Function2<? super java.lang.Long,? super java.lang.Long,? extends java.lang.CharSequence> transform);
+ method public final inline String joinToString(kotlin.jvm.functions.Function2<? super java.lang.Long,? super java.lang.Long,? extends java.lang.CharSequence> transform);
+ method public final boolean none();
+ property public final int capacity;
+ property @kotlin.PublishedApi internal final long[] keys;
+ property @kotlin.PublishedApi internal final long[] metadata;
+ property public final int size;
+ property @kotlin.PublishedApi internal final long[] values;
+ field @kotlin.PublishedApi internal long[] keys;
+ field @kotlin.PublishedApi internal long[] metadata;
+ field @kotlin.PublishedApi internal long[] values;
+ }
+
+ public final class LongLongMapKt {
+ method public static inline androidx.collection.LongLongMap buildLongLongMap(int initialCapacity, kotlin.jvm.functions.Function1<? super androidx.collection.MutableLongLongMap,kotlin.Unit> builderAction);
+ method public static inline androidx.collection.LongLongMap buildLongLongMap(kotlin.jvm.functions.Function1<? super androidx.collection.MutableLongLongMap,kotlin.Unit> builderAction);
+ method public static androidx.collection.LongLongMap emptyLongLongMap();
+ method public static androidx.collection.LongLongMap longLongMapOf();
+ method public static androidx.collection.LongLongMap longLongMapOf(long key1, long value1);
+ method public static androidx.collection.LongLongMap longLongMapOf(long key1, long value1, long key2, long value2);
+ method public static androidx.collection.LongLongMap longLongMapOf(long key1, long value1, long key2, long value2, long key3, long value3);
+ method public static androidx.collection.LongLongMap longLongMapOf(long key1, long value1, long key2, long value2, long key3, long value3, long key4, long value4);
+ method public static androidx.collection.LongLongMap longLongMapOf(long key1, long value1, long key2, long value2, long key3, long value3, long key4, long value4, long key5, long value5);
+ method public static androidx.collection.MutableLongLongMap mutableLongLongMapOf();
+ method public static androidx.collection.MutableLongLongMap mutableLongLongMapOf(long key1, long value1);
+ method public static androidx.collection.MutableLongLongMap mutableLongLongMapOf(long key1, long value1, long key2, long value2);
+ method public static androidx.collection.MutableLongLongMap mutableLongLongMapOf(long key1, long value1, long key2, long value2, long key3, long value3);
+ method public static androidx.collection.MutableLongLongMap mutableLongLongMapOf(long key1, long value1, long key2, long value2, long key3, long value3, long key4, long value4);
+ method public static androidx.collection.MutableLongLongMap mutableLongLongMapOf(long key1, long value1, long key2, long value2, long key3, long value3, long key4, long value4, long key5, long value5);
+ }
+
+ public final class LongLongPair {
+ ctor public LongLongPair(long first, long second);
+ method public inline operator long component1();
+ method public inline operator long component2();
+ method public long getFirst();
+ method public long getSecond();
+ property public final long first;
+ property public final long second;
+ }
+
+ public abstract sealed class LongObjectMap<V> {
+ method public final inline boolean all(kotlin.jvm.functions.Function2<? super java.lang.Long,? super V,java.lang.Boolean> predicate);
+ method public final boolean any();
+ method public final inline boolean any(kotlin.jvm.functions.Function2<? super java.lang.Long,? super V,java.lang.Boolean> predicate);
+ method public final inline operator boolean contains(long key);
+ method public final boolean containsKey(long key);
+ method public final boolean containsValue(V value);
+ method public final int count();
+ method public final inline int count(kotlin.jvm.functions.Function2<? super java.lang.Long,? super V,java.lang.Boolean> predicate);
+ method public final inline void forEach(kotlin.jvm.functions.Function2<? super java.lang.Long,? super V,kotlin.Unit> block);
+ method @kotlin.PublishedApi internal final inline void forEachIndexed(kotlin.jvm.functions.Function1<? super java.lang.Integer,kotlin.Unit> block);
+ method public final inline void forEachKey(kotlin.jvm.functions.Function1<? super java.lang.Long,kotlin.Unit> block);
+ method public final inline void forEachValue(kotlin.jvm.functions.Function1<? super V,kotlin.Unit> block);
+ method public final operator V? get(long key);
+ method public final int getCapacity();
+ method public final V getOrDefault(long key, V defaultValue);
+ method public final inline V getOrElse(long key, kotlin.jvm.functions.Function0<? extends V> defaultValue);
+ method public final int getSize();
+ method public final boolean isEmpty();
+ method public final boolean isNotEmpty();
+ method public final String joinToString();
+ method public final String joinToString(optional CharSequence separator);
+ method public final String joinToString(optional CharSequence separator, optional CharSequence prefix);
+ method public final String joinToString(optional CharSequence separator, optional CharSequence prefix, optional CharSequence postfix);
+ method public final String joinToString(optional CharSequence separator, optional CharSequence prefix, optional CharSequence postfix, optional int limit);
+ method public final String joinToString(optional CharSequence separator, optional CharSequence prefix, optional CharSequence postfix, optional int limit, optional CharSequence truncated);
+ method public final inline String joinToString(optional CharSequence separator, optional CharSequence prefix, optional CharSequence postfix, optional int limit, optional CharSequence truncated, kotlin.jvm.functions.Function2<? super java.lang.Long,? super V,? extends java.lang.CharSequence> transform);
+ method public final inline String joinToString(optional CharSequence separator, optional CharSequence prefix, optional CharSequence postfix, optional int limit, kotlin.jvm.functions.Function2<? super java.lang.Long,? super V,? extends java.lang.CharSequence> transform);
+ method public final inline String joinToString(optional CharSequence separator, optional CharSequence prefix, optional CharSequence postfix, kotlin.jvm.functions.Function2<? super java.lang.Long,? super V,? extends java.lang.CharSequence> transform);
+ method public final inline String joinToString(optional CharSequence separator, optional CharSequence prefix, kotlin.jvm.functions.Function2<? super java.lang.Long,? super V,? extends java.lang.CharSequence> transform);
+ method public final inline String joinToString(optional CharSequence separator, kotlin.jvm.functions.Function2<? super java.lang.Long,? super V,? extends java.lang.CharSequence> transform);
+ method public final inline String joinToString(kotlin.jvm.functions.Function2<? super java.lang.Long,? super V,? extends java.lang.CharSequence> transform);
+ method public final boolean none();
+ property public final int capacity;
+ property @kotlin.PublishedApi internal final long[] keys;
+ property @kotlin.PublishedApi internal final long[] metadata;
+ property public final int size;
+ property @kotlin.PublishedApi internal final Object?[] values;
+ field @kotlin.PublishedApi internal long[] keys;
+ field @kotlin.PublishedApi internal long[] metadata;
+ field @kotlin.PublishedApi internal Object?[] values;
+ }
+
+ public final class LongObjectMapKt {
+ method public static inline <V> androidx.collection.LongObjectMap<V> buildLongObjectMap(int initialCapacity, kotlin.jvm.functions.Function1<? super androidx.collection.MutableLongObjectMap<V>,kotlin.Unit> builderAction);
+ method public static inline <V> androidx.collection.LongObjectMap<V> buildLongObjectMap(kotlin.jvm.functions.Function1<? super androidx.collection.MutableLongObjectMap<V>,kotlin.Unit> builderAction);
+ method public static <V> androidx.collection.LongObjectMap<V> emptyLongObjectMap();
+ method public static <V> androidx.collection.LongObjectMap<V> longObjectMapOf();
+ method public static <V> androidx.collection.LongObjectMap<V> longObjectMapOf(long key1, V value1);
+ method public static <V> androidx.collection.LongObjectMap<V> longObjectMapOf(long key1, V value1, long key2, V value2);
+ method public static <V> androidx.collection.LongObjectMap<V> longObjectMapOf(long key1, V value1, long key2, V value2, long key3, V value3);
+ method public static <V> androidx.collection.LongObjectMap<V> longObjectMapOf(long key1, V value1, long key2, V value2, long key3, V value3, long key4, V value4);
+ method public static <V> androidx.collection.LongObjectMap<V> longObjectMapOf(long key1, V value1, long key2, V value2, long key3, V value3, long key4, V value4, long key5, V value5);
+ method public static <V> androidx.collection.MutableLongObjectMap<V> mutableLongObjectMapOf();
+ method public static <V> androidx.collection.MutableLongObjectMap<V> mutableLongObjectMapOf(long key1, V value1);
+ method public static <V> androidx.collection.MutableLongObjectMap<V> mutableLongObjectMapOf(long key1, V value1, long key2, V value2);
+ method public static <V> androidx.collection.MutableLongObjectMap<V> mutableLongObjectMapOf(long key1, V value1, long key2, V value2, long key3, V value3);
+ method public static <V> androidx.collection.MutableLongObjectMap<V> mutableLongObjectMapOf(long key1, V value1, long key2, V value2, long key3, V value3, long key4, V value4);
+ method public static <V> androidx.collection.MutableLongObjectMap<V> mutableLongObjectMapOf(long key1, V value1, long key2, V value2, long key3, V value3, long key4, V value4, long key5, V value5);
+ }
+
+ public abstract sealed class LongSet {
+ method public final inline boolean all(kotlin.jvm.functions.Function1<? super java.lang.Long,java.lang.Boolean> predicate);
+ method public final boolean any();
+ method public final inline boolean any(kotlin.jvm.functions.Function1<? super java.lang.Long,java.lang.Boolean> predicate);
+ method public final operator boolean contains(long element);
+ method @IntRange(from=0L) public final int count();
+ method @IntRange(from=0L) public final inline int count(kotlin.jvm.functions.Function1<? super java.lang.Long,java.lang.Boolean> predicate);
+ method public final inline long first();
+ method public final inline long first(kotlin.jvm.functions.Function1<? super java.lang.Long,java.lang.Boolean> predicate);
+ method public final inline void forEach(kotlin.jvm.functions.Function1<? super java.lang.Long,kotlin.Unit> block);
+ method @kotlin.PublishedApi internal final inline void forEachIndex(kotlin.jvm.functions.Function1<? super java.lang.Integer,kotlin.Unit> block);
+ method @IntRange(from=0L) public final int getCapacity();
+ method @IntRange(from=0L) public final int getSize();
+ method public final boolean isEmpty();
+ method public final boolean isNotEmpty();
+ method public final String joinToString();
+ method public final String joinToString(optional CharSequence separator);
+ method public final String joinToString(optional CharSequence separator, optional CharSequence prefix);
+ method public final String joinToString(optional CharSequence separator, optional CharSequence prefix, optional CharSequence postfix);
+ method public final String joinToString(optional CharSequence separator, optional CharSequence prefix, optional CharSequence postfix, optional int limit);
+ method public final String joinToString(optional CharSequence separator, optional CharSequence prefix, optional CharSequence postfix, optional int limit, optional CharSequence truncated);
+ method public final inline String joinToString(optional CharSequence separator, optional CharSequence prefix, optional CharSequence postfix, optional int limit, optional CharSequence truncated, kotlin.jvm.functions.Function1<? super java.lang.Long,? extends java.lang.CharSequence> transform);
+ method public final inline String joinToString(optional CharSequence separator, optional CharSequence prefix, optional CharSequence postfix, optional int limit, kotlin.jvm.functions.Function1<? super java.lang.Long,? extends java.lang.CharSequence> transform);
+ method public final inline String joinToString(optional CharSequence separator, optional CharSequence prefix, optional CharSequence postfix, kotlin.jvm.functions.Function1<? super java.lang.Long,? extends java.lang.CharSequence> transform);
+ method public final inline String joinToString(optional CharSequence separator, optional CharSequence prefix, kotlin.jvm.functions.Function1<? super java.lang.Long,? extends java.lang.CharSequence> transform);
+ method public final inline String joinToString(optional CharSequence separator, kotlin.jvm.functions.Function1<? super java.lang.Long,? extends java.lang.CharSequence> transform);
+ method public final inline String joinToString(kotlin.jvm.functions.Function1<? super java.lang.Long,? extends java.lang.CharSequence> transform);
+ method public final boolean none();
+ property @IntRange(from=0L) public final int capacity;
+ property @kotlin.PublishedApi internal final long[] elements;
+ property @kotlin.PublishedApi internal final long[] metadata;
+ property @IntRange(from=0L) public final int size;
+ field @kotlin.PublishedApi internal long[] elements;
+ field @kotlin.PublishedApi internal long[] metadata;
+ }
+
+ public final class LongSetKt {
+ method public static inline androidx.collection.LongSet buildLongSet(int initialCapacity, kotlin.jvm.functions.Function1<? super androidx.collection.MutableLongSet,kotlin.Unit> builderAction);
+ method public static inline androidx.collection.LongSet buildLongSet(kotlin.jvm.functions.Function1<? super androidx.collection.MutableLongSet,kotlin.Unit> builderAction);
+ method public static androidx.collection.LongSet emptyLongSet();
+ method public static androidx.collection.LongSet longSetOf();
+ method public static androidx.collection.LongSet longSetOf(long element1);
+ method public static androidx.collection.LongSet longSetOf(long element1, long element2);
+ method public static androidx.collection.LongSet longSetOf(long element1, long element2, long element3);
+ method public static androidx.collection.LongSet longSetOf(long... elements);
+ method public static androidx.collection.MutableLongSet mutableLongSetOf();
+ method public static androidx.collection.MutableLongSet mutableLongSetOf(long element1);
+ method public static androidx.collection.MutableLongSet mutableLongSetOf(long element1, long element2);
+ method public static androidx.collection.MutableLongSet mutableLongSetOf(long element1, long element2, long element3);
+ method public static androidx.collection.MutableLongSet mutableLongSetOf(long... elements);
+ }
+
+ public class LongSparseArray<E> implements java.lang.Cloneable {
+ ctor public LongSparseArray();
+ ctor public LongSparseArray(optional int initialCapacity);
+ method public void append(long key, E value);
+ method public void clear();
+ method public androidx.collection.LongSparseArray<E> clone();
+ method public boolean containsKey(long key);
+ method public boolean containsValue(E value);
+ method @Deprecated public void delete(long key);
+ method public operator E? get(long key);
+ method public E get(long key, E defaultValue);
+ method public int indexOfKey(long key);
+ method public int indexOfValue(E value);
+ method public boolean isEmpty();
+ method public long keyAt(int index);
+ method public void put(long key, E value);
+ method public void putAll(androidx.collection.LongSparseArray<? extends E> other);
+ method public E? putIfAbsent(long key, E value);
+ method public void remove(long key);
+ method public boolean remove(long key, E value);
+ method public void removeAt(int index);
+ method public E? replace(long key, E value);
+ method public boolean replace(long key, E oldValue, E newValue);
+ method public void setValueAt(int index, E value);
+ method public int size();
+ method public E valueAt(int index);
+ }
+
+ public final class LongSparseArrayKt {
+ method public static inline operator <T> boolean contains(androidx.collection.LongSparseArray<T>, long key);
+ method public static inline <T> void forEach(androidx.collection.LongSparseArray<T>, kotlin.jvm.functions.Function2<? super java.lang.Long,? super T,kotlin.Unit> action);
+ method public static inline <T> T getOrDefault(androidx.collection.LongSparseArray<T>, long key, T defaultValue);
+ method public static inline <T> T getOrElse(androidx.collection.LongSparseArray<T>, long key, kotlin.jvm.functions.Function0<? extends T> defaultValue);
+ method public static inline <T> int getSize(androidx.collection.LongSparseArray<T>);
+ method public static inline <T> boolean isNotEmpty(androidx.collection.LongSparseArray<T>);
+ method public static <T> kotlin.collections.LongIterator keyIterator(androidx.collection.LongSparseArray<T>);
+ method public static operator <T> androidx.collection.LongSparseArray<T> plus(androidx.collection.LongSparseArray<T>, androidx.collection.LongSparseArray<T> other);
+ method @Deprecated public static <T> boolean remove(androidx.collection.LongSparseArray<T>, long key, T value);
+ method public static inline operator <T> void set(androidx.collection.LongSparseArray<T>, long key, T value);
+ method public static <T> java.util.Iterator<T> valueIterator(androidx.collection.LongSparseArray<T>);
+ }
+
+ public class LruCache<K, V> {
+ ctor public LruCache(@IntRange(from=1L, to=androidx.collection.LruCacheKt.MAX_SIZE) int maxSize);
+ method protected V? create(K key);
+ method public final int createCount();
+ method protected void entryRemoved(boolean evicted, K key, V oldValue, V? newValue);
+ method public final void evictAll();
+ method public final int evictionCount();
+ method public final operator V? get(K key);
+ method public final int hitCount();
+ method public final int maxSize();
+ method public final int missCount();
+ method public final V? put(K key, V value);
+ method public final int putCount();
+ method public final V? remove(K key);
+ method public void resize(@IntRange(from=1L, to=androidx.collection.LruCacheKt.MAX_SIZE) int maxSize);
+ method public final int size();
+ method protected int sizeOf(K key, V value);
+ method public final java.util.Map<K,V> snapshot();
+ method public void trimToSize(int maxSize);
+ }
+
+ public final class LruCacheKt {
+ method public static inline <K, V> androidx.collection.LruCache<K,V> lruCache(int maxSize, optional kotlin.jvm.functions.Function2<? super K,? super V,java.lang.Integer> sizeOf, optional kotlin.jvm.functions.Function1<? super K,? extends V?> create, optional kotlin.jvm.functions.Function4<? super java.lang.Boolean,? super K,? super V,? super V?,kotlin.Unit> onEntryRemoved);
+ }
+
+ public final class MutableDoubleList extends androidx.collection.DoubleList {
+ ctor public MutableDoubleList();
+ ctor public MutableDoubleList(optional int initialCapacity);
+ method public boolean add(double element);
+ method public void add(@IntRange(from=0L) int index, double element);
+ method public inline boolean addAll(androidx.collection.DoubleList elements);
+ method public inline boolean addAll(double[] elements);
+ method public boolean addAll(@IntRange(from=0L) int index, androidx.collection.DoubleList elements);
+ method public boolean addAll(@IntRange(from=0L) int index, double[] elements);
+ method public void clear();
+ method public void ensureCapacity(int capacity);
+ method public inline int getCapacity();
+ method public operator void minusAssign(androidx.collection.DoubleList elements);
+ method public inline operator void minusAssign(double element);
+ method public operator void minusAssign(double[] elements);
+ method public inline operator void plusAssign(androidx.collection.DoubleList elements);
+ method public inline operator void plusAssign(double element);
+ method public inline operator void plusAssign(double[] elements);
+ method public boolean remove(double element);
+ method public boolean removeAll(androidx.collection.DoubleList elements);
+ method public boolean removeAll(double[] elements);
+ method public double removeAt(@IntRange(from=0L) int index);
+ method public void removeRange(@IntRange(from=0L) int start, @IntRange(from=0L) int end);
+ method public boolean retainAll(androidx.collection.DoubleList elements);
+ method public boolean retainAll(double[] elements);
+ method public operator double set(@IntRange(from=0L) int index, double element);
+ method public void sort();
+ method public void sortDescending();
+ method public void trim(optional int minCapacity);
+ property public final inline int capacity;
+ }
+
+ public final class MutableFloatFloatMap extends androidx.collection.FloatFloatMap {
+ ctor public MutableFloatFloatMap();
+ ctor public MutableFloatFloatMap(optional int initialCapacity);
+ method public void clear();
+ method public inline float getOrPut(float key, kotlin.jvm.functions.Function0<java.lang.Float> defaultValue);
+ method public inline operator void minusAssign(androidx.collection.FloatList keys);
+ method public inline operator void minusAssign(androidx.collection.FloatSet keys);
+ method public inline operator void minusAssign(float key);
+ method public inline operator void minusAssign(float[] keys);
+ method public inline operator void plusAssign(androidx.collection.FloatFloatMap from);
+ method public void put(float key, float value);
+ method public float put(float key, float value, float default);
+ method public void putAll(androidx.collection.FloatFloatMap from);
+ method public void remove(float key);
+ method public boolean remove(float key, float value);
+ method public inline void removeIf(kotlin.jvm.functions.Function2<? super java.lang.Float,? super java.lang.Float,java.lang.Boolean> predicate);
+ method @kotlin.PublishedApi internal void removeValueAt(int index);
+ method public operator void set(float key, float value);
+ method public int trim();
+ }
+
+ public final class MutableFloatIntMap extends androidx.collection.FloatIntMap {
+ ctor public MutableFloatIntMap();
+ ctor public MutableFloatIntMap(optional int initialCapacity);
+ method public void clear();
+ method public inline int getOrPut(float key, kotlin.jvm.functions.Function0<java.lang.Integer> defaultValue);
+ method public inline operator void minusAssign(androidx.collection.FloatList keys);
+ method public inline operator void minusAssign(androidx.collection.FloatSet keys);
+ method public inline operator void minusAssign(float key);
+ method public inline operator void minusAssign(float[] keys);
+ method public inline operator void plusAssign(androidx.collection.FloatIntMap from);
+ method public void put(float key, int value);
+ method public int put(float key, int value, int default);
+ method public void putAll(androidx.collection.FloatIntMap from);
+ method public void remove(float key);
+ method public boolean remove(float key, int value);
+ method public inline void removeIf(kotlin.jvm.functions.Function2<? super java.lang.Float,? super java.lang.Integer,java.lang.Boolean> predicate);
+ method @kotlin.PublishedApi internal void removeValueAt(int index);
+ method public operator void set(float key, int value);
+ method public int trim();
+ }
+
+ public final class MutableFloatList extends androidx.collection.FloatList {
+ ctor public MutableFloatList();
+ ctor public MutableFloatList(optional int initialCapacity);
+ method public boolean add(float element);
+ method public void add(@IntRange(from=0L) int index, float element);
+ method public inline boolean addAll(androidx.collection.FloatList elements);
+ method public inline boolean addAll(float[] elements);
+ method public boolean addAll(@IntRange(from=0L) int index, androidx.collection.FloatList elements);
+ method public boolean addAll(@IntRange(from=0L) int index, float[] elements);
+ method public void clear();
+ method public void ensureCapacity(int capacity);
+ method public inline int getCapacity();
+ method public operator void minusAssign(androidx.collection.FloatList elements);
+ method public inline operator void minusAssign(float element);
+ method public operator void minusAssign(float[] elements);
+ method public inline operator void plusAssign(androidx.collection.FloatList elements);
+ method public inline operator void plusAssign(float element);
+ method public inline operator void plusAssign(float[] elements);
+ method public boolean remove(float element);
+ method public boolean removeAll(androidx.collection.FloatList elements);
+ method public boolean removeAll(float[] elements);
+ method public float removeAt(@IntRange(from=0L) int index);
+ method public void removeRange(@IntRange(from=0L) int start, @IntRange(from=0L) int end);
+ method public boolean retainAll(androidx.collection.FloatList elements);
+ method public boolean retainAll(float[] elements);
+ method public operator float set(@IntRange(from=0L) int index, float element);
+ method public void sort();
+ method public void sortDescending();
+ method public void trim(optional int minCapacity);
+ property public final inline int capacity;
+ }
+
+ public final class MutableFloatLongMap extends androidx.collection.FloatLongMap {
+ ctor public MutableFloatLongMap();
+ ctor public MutableFloatLongMap(optional int initialCapacity);
+ method public void clear();
+ method public inline long getOrPut(float key, kotlin.jvm.functions.Function0<java.lang.Long> defaultValue);
+ method public inline operator void minusAssign(androidx.collection.FloatList keys);
+ method public inline operator void minusAssign(androidx.collection.FloatSet keys);
+ method public inline operator void minusAssign(float key);
+ method public inline operator void minusAssign(float[] keys);
+ method public inline operator void plusAssign(androidx.collection.FloatLongMap from);
+ method public void put(float key, long value);
+ method public long put(float key, long value, long default);
+ method public void putAll(androidx.collection.FloatLongMap from);
+ method public void remove(float key);
+ method public boolean remove(float key, long value);
+ method public inline void removeIf(kotlin.jvm.functions.Function2<? super java.lang.Float,? super java.lang.Long,java.lang.Boolean> predicate);
+ method @kotlin.PublishedApi internal void removeValueAt(int index);
+ method public operator void set(float key, long value);
+ method public int trim();
+ }
+
+ public final class MutableFloatObjectMap<V> extends androidx.collection.FloatObjectMap<V> {
+ ctor public MutableFloatObjectMap();
+ ctor public MutableFloatObjectMap(optional int initialCapacity);
+ method public void clear();
+ method public inline V getOrPut(float key, kotlin.jvm.functions.Function0<? extends V> defaultValue);
+ method public inline operator void minusAssign(androidx.collection.FloatList keys);
+ method public inline operator void minusAssign(androidx.collection.FloatSet keys);
+ method public inline operator void minusAssign(float key);
+ method public inline operator void minusAssign(float[] keys);
+ method public inline operator void plusAssign(androidx.collection.FloatObjectMap<V> from);
+ method public V? put(float key, V value);
+ method public void putAll(androidx.collection.FloatObjectMap<V> from);
+ method public V? remove(float key);
+ method public boolean remove(float key, V value);
+ method public inline void removeIf(kotlin.jvm.functions.Function2<? super java.lang.Float,? super V,java.lang.Boolean> predicate);
+ method @kotlin.PublishedApi internal V? removeValueAt(int index);
+ method public operator void set(float key, V value);
+ method public int trim();
+ }
+
+ public final class MutableFloatSet extends androidx.collection.FloatSet {
+ ctor public MutableFloatSet();
+ ctor public MutableFloatSet(optional int initialCapacity);
+ method public boolean add(float element);
+ method public boolean addAll(androidx.collection.FloatSet elements);
+ method public boolean addAll(float[] elements);
+ method public void clear();
+ method public operator void minusAssign(androidx.collection.FloatSet elements);
+ method public operator void minusAssign(float element);
+ method public operator void minusAssign(float[] elements);
+ method public operator void plusAssign(androidx.collection.FloatSet elements);
+ method public operator void plusAssign(float element);
+ method public operator void plusAssign(float[] elements);
+ method public boolean remove(float element);
+ method public boolean removeAll(androidx.collection.FloatSet elements);
+ method public boolean removeAll(float[] elements);
+ method @IntRange(from=0L) public int trim();
+ }
+
+ public final class MutableIntFloatMap extends androidx.collection.IntFloatMap {
+ ctor public MutableIntFloatMap();
+ ctor public MutableIntFloatMap(optional int initialCapacity);
+ method public void clear();
+ method public inline float getOrPut(int key, kotlin.jvm.functions.Function0<java.lang.Float> defaultValue);
+ method public inline operator void minusAssign(androidx.collection.IntList keys);
+ method public inline operator void minusAssign(androidx.collection.IntSet keys);
+ method public inline operator void minusAssign(int key);
+ method public inline operator void minusAssign(int[] keys);
+ method public inline operator void plusAssign(androidx.collection.IntFloatMap from);
+ method public void put(int key, float value);
+ method public float put(int key, float value, float default);
+ method public void putAll(androidx.collection.IntFloatMap from);
+ method public void remove(int key);
+ method public boolean remove(int key, float value);
+ method public inline void removeIf(kotlin.jvm.functions.Function2<? super java.lang.Integer,? super java.lang.Float,java.lang.Boolean> predicate);
+ method @kotlin.PublishedApi internal void removeValueAt(int index);
+ method public operator void set(int key, float value);
+ method public int trim();
+ }
+
+ public final class MutableIntIntMap extends androidx.collection.IntIntMap {
+ ctor public MutableIntIntMap();
+ ctor public MutableIntIntMap(optional int initialCapacity);
+ method public void clear();
+ method public inline int getOrPut(int key, kotlin.jvm.functions.Function0<java.lang.Integer> defaultValue);
+ method public inline operator void minusAssign(androidx.collection.IntList keys);
+ method public inline operator void minusAssign(androidx.collection.IntSet keys);
+ method public inline operator void minusAssign(int key);
+ method public inline operator void minusAssign(int[] keys);
+ method public inline operator void plusAssign(androidx.collection.IntIntMap from);
+ method public void put(int key, int value);
+ method public int put(int key, int value, int default);
+ method public void putAll(androidx.collection.IntIntMap from);
+ method public void remove(int key);
+ method public boolean remove(int key, int value);
+ method public inline void removeIf(kotlin.jvm.functions.Function2<? super java.lang.Integer,? super java.lang.Integer,java.lang.Boolean> predicate);
+ method @kotlin.PublishedApi internal void removeValueAt(int index);
+ method public operator void set(int key, int value);
+ method public int trim();
+ }
+
+ public final class MutableIntList extends androidx.collection.IntList {
+ ctor public MutableIntList();
+ ctor public MutableIntList(optional int initialCapacity);
+ method public boolean add(int element);
+ method public void add(@IntRange(from=0L) int index, int element);
+ method public inline boolean addAll(androidx.collection.IntList elements);
+ method public boolean addAll(@IntRange(from=0L) int index, androidx.collection.IntList elements);
+ method public boolean addAll(@IntRange(from=0L) int index, int[] elements);
+ method public inline boolean addAll(int[] elements);
+ method public void clear();
+ method public void ensureCapacity(int capacity);
+ method public inline int getCapacity();
+ method public operator void minusAssign(androidx.collection.IntList elements);
+ method public inline operator void minusAssign(int element);
+ method public operator void minusAssign(int[] elements);
+ method public inline operator void plusAssign(androidx.collection.IntList elements);
+ method public inline operator void plusAssign(int element);
+ method public inline operator void plusAssign(int[] elements);
+ method public boolean remove(int element);
+ method public boolean removeAll(androidx.collection.IntList elements);
+ method public boolean removeAll(int[] elements);
+ method public int removeAt(@IntRange(from=0L) int index);
+ method public void removeRange(@IntRange(from=0L) int start, @IntRange(from=0L) int end);
+ method public boolean retainAll(androidx.collection.IntList elements);
+ method public boolean retainAll(int[] elements);
+ method public operator int set(@IntRange(from=0L) int index, int element);
+ method public void sort();
+ method public void sortDescending();
+ method public void trim(optional int minCapacity);
+ property public final inline int capacity;
+ }
+
+ public final class MutableIntLongMap extends androidx.collection.IntLongMap {
+ ctor public MutableIntLongMap();
+ ctor public MutableIntLongMap(optional int initialCapacity);
+ method public void clear();
+ method public inline long getOrPut(int key, kotlin.jvm.functions.Function0<java.lang.Long> defaultValue);
+ method public inline operator void minusAssign(androidx.collection.IntList keys);
+ method public inline operator void minusAssign(androidx.collection.IntSet keys);
+ method public inline operator void minusAssign(int key);
+ method public inline operator void minusAssign(int[] keys);
+ method public inline operator void plusAssign(androidx.collection.IntLongMap from);
+ method public void put(int key, long value);
+ method public long put(int key, long value, long default);
+ method public void putAll(androidx.collection.IntLongMap from);
+ method public void remove(int key);
+ method public boolean remove(int key, long value);
+ method public inline void removeIf(kotlin.jvm.functions.Function2<? super java.lang.Integer,? super java.lang.Long,java.lang.Boolean> predicate);
+ method @kotlin.PublishedApi internal void removeValueAt(int index);
+ method public operator void set(int key, long value);
+ method public int trim();
+ }
+
+ public final class MutableIntObjectMap<V> extends androidx.collection.IntObjectMap<V> {
+ ctor public MutableIntObjectMap();
+ ctor public MutableIntObjectMap(optional int initialCapacity);
+ method public void clear();
+ method public inline V getOrPut(int key, kotlin.jvm.functions.Function0<? extends V> defaultValue);
+ method public inline operator void minusAssign(androidx.collection.IntList keys);
+ method public inline operator void minusAssign(androidx.collection.IntSet keys);
+ method public inline operator void minusAssign(int key);
+ method public inline operator void minusAssign(int[] keys);
+ method public inline operator void plusAssign(androidx.collection.IntObjectMap<V> from);
+ method public V? put(int key, V value);
+ method public void putAll(androidx.collection.IntObjectMap<V> from);
+ method public V? remove(int key);
+ method public boolean remove(int key, V value);
+ method public inline void removeIf(kotlin.jvm.functions.Function2<? super java.lang.Integer,? super V,java.lang.Boolean> predicate);
+ method @kotlin.PublishedApi internal V? removeValueAt(int index);
+ method public operator void set(int key, V value);
+ method public int trim();
+ }
+
+ public final class MutableIntSet extends androidx.collection.IntSet {
+ ctor public MutableIntSet();
+ ctor public MutableIntSet(optional int initialCapacity);
+ method public boolean add(int element);
+ method public boolean addAll(androidx.collection.IntSet elements);
+ method public boolean addAll(int[] elements);
+ method public void clear();
+ method public operator void minusAssign(androidx.collection.IntSet elements);
+ method public operator void minusAssign(int element);
+ method public operator void minusAssign(int[] elements);
+ method public operator void plusAssign(androidx.collection.IntSet elements);
+ method public operator void plusAssign(int element);
+ method public operator void plusAssign(int[] elements);
+ method public boolean remove(int element);
+ method public boolean removeAll(androidx.collection.IntSet elements);
+ method public boolean removeAll(int[] elements);
+ method @IntRange(from=0L) public int trim();
+ }
+
+ public final class MutableLongFloatMap extends androidx.collection.LongFloatMap {
+ ctor public MutableLongFloatMap();
+ ctor public MutableLongFloatMap(optional int initialCapacity);
+ method public void clear();
+ method public inline float getOrPut(long key, kotlin.jvm.functions.Function0<java.lang.Float> defaultValue);
+ method public inline operator void minusAssign(androidx.collection.LongList keys);
+ method public inline operator void minusAssign(androidx.collection.LongSet keys);
+ method public inline operator void minusAssign(long key);
+ method public inline operator void minusAssign(long[] keys);
+ method public inline operator void plusAssign(androidx.collection.LongFloatMap from);
+ method public void put(long key, float value);
+ method public float put(long key, float value, float default);
+ method public void putAll(androidx.collection.LongFloatMap from);
+ method public void remove(long key);
+ method public boolean remove(long key, float value);
+ method public inline void removeIf(kotlin.jvm.functions.Function2<? super java.lang.Long,? super java.lang.Float,java.lang.Boolean> predicate);
+ method @kotlin.PublishedApi internal void removeValueAt(int index);
+ method public operator void set(long key, float value);
+ method public int trim();
+ }
+
+ public final class MutableLongIntMap extends androidx.collection.LongIntMap {
+ ctor public MutableLongIntMap();
+ ctor public MutableLongIntMap(optional int initialCapacity);
+ method public void clear();
+ method public inline int getOrPut(long key, kotlin.jvm.functions.Function0<java.lang.Integer> defaultValue);
+ method public inline operator void minusAssign(androidx.collection.LongList keys);
+ method public inline operator void minusAssign(androidx.collection.LongSet keys);
+ method public inline operator void minusAssign(long key);
+ method public inline operator void minusAssign(long[] keys);
+ method public inline operator void plusAssign(androidx.collection.LongIntMap from);
+ method public void put(long key, int value);
+ method public int put(long key, int value, int default);
+ method public void putAll(androidx.collection.LongIntMap from);
+ method public void remove(long key);
+ method public boolean remove(long key, int value);
+ method public inline void removeIf(kotlin.jvm.functions.Function2<? super java.lang.Long,? super java.lang.Integer,java.lang.Boolean> predicate);
+ method @kotlin.PublishedApi internal void removeValueAt(int index);
+ method public operator void set(long key, int value);
+ method public int trim();
+ }
+
+ public final class MutableLongList extends androidx.collection.LongList {
+ ctor public MutableLongList();
+ ctor public MutableLongList(optional int initialCapacity);
+ method public void add(@IntRange(from=0L) int index, long element);
+ method public boolean add(long element);
+ method public inline boolean addAll(androidx.collection.LongList elements);
+ method public boolean addAll(@IntRange(from=0L) int index, androidx.collection.LongList elements);
+ method public boolean addAll(@IntRange(from=0L) int index, long[] elements);
+ method public inline boolean addAll(long[] elements);
+ method public void clear();
+ method public void ensureCapacity(int capacity);
+ method public inline int getCapacity();
+ method public operator void minusAssign(androidx.collection.LongList elements);
+ method public inline operator void minusAssign(long element);
+ method public operator void minusAssign(long[] elements);
+ method public inline operator void plusAssign(androidx.collection.LongList elements);
+ method public inline operator void plusAssign(long element);
+ method public inline operator void plusAssign(long[] elements);
+ method public boolean remove(long element);
+ method public boolean removeAll(androidx.collection.LongList elements);
+ method public boolean removeAll(long[] elements);
+ method public long removeAt(@IntRange(from=0L) int index);
+ method public void removeRange(@IntRange(from=0L) int start, @IntRange(from=0L) int end);
+ method public boolean retainAll(androidx.collection.LongList elements);
+ method public boolean retainAll(long[] elements);
+ method public operator long set(@IntRange(from=0L) int index, long element);
+ method public void sort();
+ method public void sortDescending();
+ method public void trim(optional int minCapacity);
+ property public final inline int capacity;
+ }
+
+ public final class MutableLongLongMap extends androidx.collection.LongLongMap {
+ ctor public MutableLongLongMap();
+ ctor public MutableLongLongMap(optional int initialCapacity);
+ method public void clear();
+ method public inline long getOrPut(long key, kotlin.jvm.functions.Function0<java.lang.Long> defaultValue);
+ method public inline operator void minusAssign(androidx.collection.LongList keys);
+ method public inline operator void minusAssign(androidx.collection.LongSet keys);
+ method public inline operator void minusAssign(long key);
+ method public inline operator void minusAssign(long[] keys);
+ method public inline operator void plusAssign(androidx.collection.LongLongMap from);
+ method public void put(long key, long value);
+ method public long put(long key, long value, long default);
+ method public void putAll(androidx.collection.LongLongMap from);
+ method public void remove(long key);
+ method public boolean remove(long key, long value);
+ method public inline void removeIf(kotlin.jvm.functions.Function2<? super java.lang.Long,? super java.lang.Long,java.lang.Boolean> predicate);
+ method @kotlin.PublishedApi internal void removeValueAt(int index);
+ method public operator void set(long key, long value);
+ method public int trim();
+ }
+
+ public final class MutableLongObjectMap<V> extends androidx.collection.LongObjectMap<V> {
+ ctor public MutableLongObjectMap();
+ ctor public MutableLongObjectMap(optional int initialCapacity);
+ method public void clear();
+ method public inline V getOrPut(long key, kotlin.jvm.functions.Function0<? extends V> defaultValue);
+ method public inline operator void minusAssign(androidx.collection.LongList keys);
+ method public inline operator void minusAssign(androidx.collection.LongSet keys);
+ method public inline operator void minusAssign(long key);
+ method public inline operator void minusAssign(long[] keys);
+ method public inline operator void plusAssign(androidx.collection.LongObjectMap<V> from);
+ method public V? put(long key, V value);
+ method public void putAll(androidx.collection.LongObjectMap<V> from);
+ method public V? remove(long key);
+ method public boolean remove(long key, V value);
+ method public inline void removeIf(kotlin.jvm.functions.Function2<? super java.lang.Long,? super V,java.lang.Boolean> predicate);
+ method @kotlin.PublishedApi internal V? removeValueAt(int index);
+ method public operator void set(long key, V value);
+ method public int trim();
+ }
+
+ public final class MutableLongSet extends androidx.collection.LongSet {
+ ctor public MutableLongSet();
+ ctor public MutableLongSet(optional int initialCapacity);
+ method public boolean add(long element);
+ method public boolean addAll(androidx.collection.LongSet elements);
+ method public boolean addAll(long[] elements);
+ method public void clear();
+ method public operator void minusAssign(androidx.collection.LongSet elements);
+ method public operator void minusAssign(long element);
+ method public operator void minusAssign(long[] elements);
+ method public operator void plusAssign(androidx.collection.LongSet elements);
+ method public operator void plusAssign(long element);
+ method public operator void plusAssign(long[] elements);
+ method public boolean remove(long element);
+ method public boolean removeAll(androidx.collection.LongSet elements);
+ method public boolean removeAll(long[] elements);
+ method @IntRange(from=0L) public int trim();
+ }
+
+ public final class MutableObjectFloatMap<K> extends androidx.collection.ObjectFloatMap<K> {
+ ctor public MutableObjectFloatMap();
+ ctor public MutableObjectFloatMap(optional int initialCapacity);
+ method public void clear();
+ method public inline float getOrPut(K key, kotlin.jvm.functions.Function0<java.lang.Float> defaultValue);
+ method public inline operator void minusAssign(androidx.collection.ScatterSet<K> keys);
+ method public inline operator void minusAssign(Iterable<? extends K> keys);
+ method public inline operator void minusAssign(K key);
+ method public inline operator void minusAssign(K[] keys);
+ method public inline operator void minusAssign(kotlin.sequences.Sequence<? extends K> keys);
+ method public inline operator void plusAssign(androidx.collection.ObjectFloatMap<K> from);
+ method public void put(K key, float value);
+ method public float put(K key, float value, float default);
+ method public void putAll(androidx.collection.ObjectFloatMap<K> from);
+ method public void remove(K key);
+ method public boolean remove(K key, float value);
+ method public inline void removeIf(kotlin.jvm.functions.Function2<? super K,? super java.lang.Float,java.lang.Boolean> predicate);
+ method @kotlin.PublishedApi internal void removeValueAt(int index);
+ method public operator void set(K key, float value);
+ method public int trim();
+ }
+
+ public final class MutableObjectIntMap<K> extends androidx.collection.ObjectIntMap<K> {
+ ctor public MutableObjectIntMap();
+ ctor public MutableObjectIntMap(optional int initialCapacity);
+ method public void clear();
+ method public inline int getOrPut(K key, kotlin.jvm.functions.Function0<java.lang.Integer> defaultValue);
+ method public inline operator void minusAssign(androidx.collection.ScatterSet<K> keys);
+ method public inline operator void minusAssign(Iterable<? extends K> keys);
+ method public inline operator void minusAssign(K key);
+ method public inline operator void minusAssign(K[] keys);
+ method public inline operator void minusAssign(kotlin.sequences.Sequence<? extends K> keys);
+ method public inline operator void plusAssign(androidx.collection.ObjectIntMap<K> from);
+ method public void put(K key, int value);
+ method public int put(K key, int value, int default);
+ method public void putAll(androidx.collection.ObjectIntMap<K> from);
+ method public void remove(K key);
+ method public boolean remove(K key, int value);
+ method public inline void removeIf(kotlin.jvm.functions.Function2<? super K,? super java.lang.Integer,java.lang.Boolean> predicate);
+ method @kotlin.PublishedApi internal void removeValueAt(int index);
+ method public operator void set(K key, int value);
+ method public int trim();
+ }
+
+ public final class MutableObjectList<E> extends androidx.collection.ObjectList<E> {
+ ctor public MutableObjectList();
+ ctor public MutableObjectList(optional int initialCapacity);
+ method public boolean add(E element);
+ method public void add(@IntRange(from=0L) int index, E element);
+ method public boolean addAll(androidx.collection.ObjectList<E> elements);
+ method public boolean addAll(androidx.collection.ScatterSet<E> elements);
+ method public boolean addAll(E[] elements);
+ method public boolean addAll(@IntRange(from=0L) int index, androidx.collection.ObjectList<E> elements);
+ method public boolean addAll(@IntRange(from=0L) int index, E[] elements);
+ method public boolean addAll(@IntRange(from=0L) int index, java.util.Collection<? extends E> elements);
+ method public boolean addAll(Iterable<? extends E> elements);
+ method public boolean addAll(java.util.List<? extends E> elements);
+ method public boolean addAll(kotlin.sequences.Sequence<? extends E> elements);
+ method public java.util.List<E> asList();
+ method public java.util.List<E> asMutableList();
+ method public void clear();
+ method public inline void ensureCapacity(int capacity);
+ method public inline int getCapacity();
+ method public operator void minusAssign(androidx.collection.ObjectList<E> elements);
+ method public operator void minusAssign(androidx.collection.ScatterSet<E> elements);
+ method public inline operator void minusAssign(E element);
+ method public operator void minusAssign(E[] elements);
+ method public operator void minusAssign(Iterable<? extends E> elements);
+ method public operator void minusAssign(java.util.List<? extends E> elements);
+ method public operator void minusAssign(kotlin.sequences.Sequence<? extends E> elements);
+ method public operator void plusAssign(androidx.collection.ObjectList<E> elements);
+ method public operator void plusAssign(androidx.collection.ScatterSet<E> elements);
+ method public inline operator void plusAssign(E element);
+ method public operator void plusAssign(E[] elements);
+ method public operator void plusAssign(Iterable<? extends E> elements);
+ method public operator void plusAssign(java.util.List<? extends E> elements);
+ method public operator void plusAssign(kotlin.sequences.Sequence<? extends E> elements);
+ method public boolean remove(E element);
+ method public boolean removeAll(androidx.collection.ObjectList<E> elements);
+ method public boolean removeAll(androidx.collection.ScatterSet<E> elements);
+ method public boolean removeAll(E[] elements);
+ method public boolean removeAll(Iterable<? extends E> elements);
+ method public boolean removeAll(java.util.List<? extends E> elements);
+ method public boolean removeAll(kotlin.sequences.Sequence<? extends E> elements);
+ method public E removeAt(@IntRange(from=0L) int index);
+ method public inline void removeIf(kotlin.jvm.functions.Function1<? super E,java.lang.Boolean> predicate);
+ method public void removeRange(@IntRange(from=0L) int start, @IntRange(from=0L) int end);
+ method @kotlin.PublishedApi internal void resizeStorage(int capacity, Object?[] oldContent);
+ method public boolean retainAll(androidx.collection.ObjectList<E> elements);
+ method public boolean retainAll(E[] elements);
+ method public boolean retainAll(Iterable<? extends E> elements);
+ method public boolean retainAll(java.util.Collection<? extends E> elements);
+ method public boolean retainAll(kotlin.sequences.Sequence<? extends E> elements);
+ method public operator E set(@IntRange(from=0L) int index, E element);
+ method public void trim(optional int minCapacity);
+ property public final inline int capacity;
+ }
+
+ public final class MutableObjectLongMap<K> extends androidx.collection.ObjectLongMap<K> {
+ ctor public MutableObjectLongMap();
+ ctor public MutableObjectLongMap(optional int initialCapacity);
+ method public void clear();
+ method public inline long getOrPut(K key, kotlin.jvm.functions.Function0<java.lang.Long> defaultValue);
+ method public inline operator void minusAssign(androidx.collection.ScatterSet<K> keys);
+ method public inline operator void minusAssign(Iterable<? extends K> keys);
+ method public inline operator void minusAssign(K key);
+ method public inline operator void minusAssign(K[] keys);
+ method public inline operator void minusAssign(kotlin.sequences.Sequence<? extends K> keys);
+ method public inline operator void plusAssign(androidx.collection.ObjectLongMap<K> from);
+ method public void put(K key, long value);
+ method public long put(K key, long value, long default);
+ method public void putAll(androidx.collection.ObjectLongMap<K> from);
+ method public void remove(K key);
+ method public boolean remove(K key, long value);
+ method public inline void removeIf(kotlin.jvm.functions.Function2<? super K,? super java.lang.Long,java.lang.Boolean> predicate);
+ method @kotlin.PublishedApi internal void removeValueAt(int index);
+ method public operator void set(K key, long value);
+ method public int trim();
+ }
+
+ public final class MutableOrderedScatterSet<E> extends androidx.collection.OrderedScatterSet<E> {
+ ctor public MutableOrderedScatterSet();
+ ctor public MutableOrderedScatterSet(optional int initialCapacity);
+ method public boolean add(E element);
+ method public boolean addAll(androidx.collection.ObjectList<E> elements);
+ method public boolean addAll(androidx.collection.OrderedScatterSet<E> elements);
+ method public boolean addAll(androidx.collection.ScatterSet<E> elements);
+ method public boolean addAll(E[] elements);
+ method public boolean addAll(Iterable<? extends E> elements);
+ method public boolean addAll(kotlin.sequences.Sequence<? extends E> elements);
+ method public java.util.Set<E> asMutableSet();
+ method public void clear();
+ method public operator void minusAssign(androidx.collection.ObjectList<E> elements);
+ method public operator void minusAssign(androidx.collection.OrderedScatterSet<E> elements);
+ method public operator void minusAssign(androidx.collection.ScatterSet<E> elements);
+ method public operator void minusAssign(E element);
+ method public operator void minusAssign(E[] elements);
+ method public operator void minusAssign(Iterable<? extends E> elements);
+ method public operator void minusAssign(kotlin.sequences.Sequence<? extends E> elements);
+ method public operator void plusAssign(androidx.collection.ObjectList<E> elements);
+ method public operator void plusAssign(androidx.collection.OrderedScatterSet<E> elements);
+ method public operator void plusAssign(androidx.collection.ScatterSet<E> elements);
+ method public operator void plusAssign(E element);
+ method public operator void plusAssign(E[] elements);
+ method public operator void plusAssign(Iterable<? extends E> elements);
+ method public operator void plusAssign(kotlin.sequences.Sequence<? extends E> elements);
+ method public boolean remove(E element);
+ method public boolean removeAll(androidx.collection.ObjectList<E> elements);
+ method public boolean removeAll(androidx.collection.OrderedScatterSet<E> elements);
+ method public boolean removeAll(androidx.collection.ScatterSet<E> elements);
+ method public boolean removeAll(E[] elements);
+ method public boolean removeAll(Iterable<? extends E> elements);
+ method public boolean removeAll(kotlin.sequences.Sequence<? extends E> elements);
+ method @kotlin.PublishedApi internal void removeElementAt(int index);
+ method public inline void removeIf(kotlin.jvm.functions.Function1<? super E,java.lang.Boolean> predicate);
+ method public boolean retainAll(androidx.collection.OrderedScatterSet<E> elements);
+ method public boolean retainAll(androidx.collection.ScatterSet<E> elements);
+ method public boolean retainAll(java.util.Collection<? extends E> elements);
+ method public inline boolean retainAll(kotlin.jvm.functions.Function1<? super E,java.lang.Boolean> predicate);
+ method @IntRange(from=0L) public int trim();
+ method public void trimToSize(int maxSize);
+ }
+
+ public final class MutableScatterMap<K, V> extends androidx.collection.ScatterMap<K,V> {
+ ctor public MutableScatterMap();
+ ctor public MutableScatterMap(optional int initialCapacity);
+ method public java.util.Map<K,V> asMutableMap();
+ method public void clear();
+ method public inline V compute(K key, kotlin.jvm.functions.Function2<? super K,? super V?,? extends V> computeBlock);
+ method @kotlin.PublishedApi internal int findInsertIndex(K key);
+ method public inline V getOrPut(K key, kotlin.jvm.functions.Function0<? extends V> defaultValue);
+ method public inline operator void minusAssign(androidx.collection.ObjectList<K> keys);
+ method public inline operator void minusAssign(androidx.collection.ScatterSet<K> keys);
+ method public inline operator void minusAssign(Iterable<? extends K> keys);
+ method public inline operator void minusAssign(K key);
+ method public inline operator void minusAssign(K[] keys);
+ method public inline operator void minusAssign(kotlin.sequences.Sequence<? extends K> keys);
+ method public inline operator void plusAssign(androidx.collection.ScatterMap<K,V> from);
+ method public inline operator void plusAssign(Iterable<? extends kotlin.Pair<? extends K,? extends V>> pairs);
+ method public inline operator void plusAssign(java.util.Map<K,? extends V> from);
+ method public inline operator void plusAssign(kotlin.Pair<? extends K,? extends V> pair);
+ method public inline operator void plusAssign(kotlin.Pair<? extends K,? extends V>[] pairs);
+ method public inline operator void plusAssign(kotlin.sequences.Sequence<? extends kotlin.Pair<? extends K,? extends V>> pairs);
+ method public V? put(K key, V value);
+ method public void putAll(androidx.collection.ScatterMap<K,V> from);
+ method public void putAll(Iterable<? extends kotlin.Pair<? extends K,? extends V>> pairs);
+ method public void putAll(java.util.Map<K,? extends V> from);
+ method public void putAll(kotlin.Pair<? extends K,? extends V>[] pairs);
+ method public void putAll(kotlin.sequences.Sequence<? extends kotlin.Pair<? extends K,? extends V>> pairs);
+ method public V? remove(K key);
+ method public boolean remove(K key, V value);
+ method public inline void removeIf(kotlin.jvm.functions.Function2<? super K,? super V,java.lang.Boolean> predicate);
+ method @kotlin.PublishedApi internal V? removeValueAt(int index);
+ method public operator void set(K key, V value);
+ method public int trim();
+ }
+
+ public final class MutableScatterSet<E> extends androidx.collection.ScatterSet<E> {
+ ctor public MutableScatterSet();
+ ctor public MutableScatterSet(optional int initialCapacity);
+ method public boolean add(E element);
+ method public boolean addAll(androidx.collection.ObjectList<E> elements);
+ method public boolean addAll(androidx.collection.OrderedScatterSet<E> elements);
+ method public boolean addAll(androidx.collection.ScatterSet<E> elements);
+ method public boolean addAll(E[] elements);
+ method public boolean addAll(Iterable<? extends E> elements);
+ method public boolean addAll(kotlin.sequences.Sequence<? extends E> elements);
+ method public java.util.Set<E> asMutableSet();
+ method public void clear();
+ method public operator void minusAssign(androidx.collection.ObjectList<E> elements);
+ method public operator void minusAssign(androidx.collection.OrderedScatterSet<E> elements);
+ method public operator void minusAssign(androidx.collection.ScatterSet<E> elements);
+ method public operator void minusAssign(E element);
+ method public operator void minusAssign(E[] elements);
+ method public operator void minusAssign(Iterable<? extends E> elements);
+ method public operator void minusAssign(kotlin.sequences.Sequence<? extends E> elements);
+ method public operator void plusAssign(androidx.collection.ObjectList<E> elements);
+ method public operator void plusAssign(androidx.collection.OrderedScatterSet<E> elements);
+ method public operator void plusAssign(androidx.collection.ScatterSet<E> elements);
+ method public operator void plusAssign(E element);
+ method public operator void plusAssign(E[] elements);
+ method public operator void plusAssign(Iterable<? extends E> elements);
+ method public operator void plusAssign(kotlin.sequences.Sequence<? extends E> elements);
+ method public boolean remove(E element);
+ method public boolean removeAll(androidx.collection.ObjectList<E> elements);
+ method public boolean removeAll(androidx.collection.OrderedScatterSet<E> elements);
+ method public boolean removeAll(androidx.collection.ScatterSet<E> elements);
+ method public boolean removeAll(E[] elements);
+ method public boolean removeAll(Iterable<? extends E> elements);
+ method public boolean removeAll(kotlin.sequences.Sequence<? extends E> elements);
+ method @kotlin.PublishedApi internal void removeElementAt(int index);
+ method public inline void removeIf(kotlin.jvm.functions.Function1<? super E,java.lang.Boolean> predicate);
+ method public boolean retainAll(androidx.collection.OrderedScatterSet<E> elements);
+ method public boolean retainAll(androidx.collection.ScatterSet<E> elements);
+ method public boolean retainAll(java.util.Collection<? extends E> elements);
+ method public boolean retainAll(kotlin.jvm.functions.Function1<? super E,java.lang.Boolean> predicate);
+ method @IntRange(from=0L) public int trim();
+ }
+
+ public abstract sealed class ObjectFloatMap<K> {
+ method public final inline boolean all(kotlin.jvm.functions.Function2<? super K,? super java.lang.Float,java.lang.Boolean> predicate);
+ method public final boolean any();
+ method public final inline boolean any(kotlin.jvm.functions.Function2<? super K,? super java.lang.Float,java.lang.Boolean> predicate);
+ method public final inline operator boolean contains(K key);
+ method public final boolean containsKey(K key);
+ method public final boolean containsValue(float value);
+ method public final int count();
+ method public final inline int count(kotlin.jvm.functions.Function2<? super K,? super java.lang.Float,java.lang.Boolean> predicate);
+ method @kotlin.PublishedApi internal final int findKeyIndex(K key);
+ method public final inline void forEach(kotlin.jvm.functions.Function2<? super K,? super java.lang.Float,kotlin.Unit> block);
+ method @kotlin.PublishedApi internal final inline void forEachIndexed(kotlin.jvm.functions.Function1<? super java.lang.Integer,kotlin.Unit> block);
+ method public final inline void forEachKey(kotlin.jvm.functions.Function1<? super K,kotlin.Unit> block);
+ method public final inline void forEachValue(kotlin.jvm.functions.Function1<? super java.lang.Float,kotlin.Unit> block);
+ method public final operator float get(K key);
+ method public final int getCapacity();
+ method public final float getOrDefault(K key, float defaultValue);
+ method public final inline float getOrElse(K key, kotlin.jvm.functions.Function0<java.lang.Float> defaultValue);
+ method public final int getSize();
+ method public final boolean isEmpty();
+ method public final boolean isNotEmpty();
+ method public final String joinToString();
+ method public final String joinToString(optional CharSequence separator);
+ method public final String joinToString(optional CharSequence separator, optional CharSequence prefix);
+ method public final String joinToString(optional CharSequence separator, optional CharSequence prefix, optional CharSequence postfix);
+ method public final String joinToString(optional CharSequence separator, optional CharSequence prefix, optional CharSequence postfix, optional int limit);
+ method public final String joinToString(optional CharSequence separator, optional CharSequence prefix, optional CharSequence postfix, optional int limit, optional CharSequence truncated);
+ method public final inline String joinToString(optional CharSequence separator, optional CharSequence prefix, optional CharSequence postfix, optional int limit, optional CharSequence truncated, kotlin.jvm.functions.Function2<? super K,? super java.lang.Float,? extends java.lang.CharSequence> transform);
+ method public final inline String joinToString(optional CharSequence separator, optional CharSequence prefix, optional CharSequence postfix, optional int limit, kotlin.jvm.functions.Function2<? super K,? super java.lang.Float,? extends java.lang.CharSequence> transform);
+ method public final inline String joinToString(optional CharSequence separator, optional CharSequence prefix, optional CharSequence postfix, kotlin.jvm.functions.Function2<? super K,? super java.lang.Float,? extends java.lang.CharSequence> transform);
+ method public final inline String joinToString(optional CharSequence separator, optional CharSequence prefix, kotlin.jvm.functions.Function2<? super K,? super java.lang.Float,? extends java.lang.CharSequence> transform);
+ method public final inline String joinToString(optional CharSequence separator, kotlin.jvm.functions.Function2<? super K,? super java.lang.Float,? extends java.lang.CharSequence> transform);
+ method public final inline String joinToString(kotlin.jvm.functions.Function2<? super K,? super java.lang.Float,? extends java.lang.CharSequence> transform);
+ method public final boolean none();
+ property public final int capacity;
+ property @kotlin.PublishedApi internal final Object?[] keys;
+ property @kotlin.PublishedApi internal final long[] metadata;
+ property public final int size;
+ property @kotlin.PublishedApi internal final float[] values;
+ field @kotlin.PublishedApi internal Object?[] keys;
+ field @kotlin.PublishedApi internal long[] metadata;
+ field @kotlin.PublishedApi internal float[] values;
+ }
+
+ public final class ObjectFloatMapKt {
+ method public static inline <K> androidx.collection.ObjectFloatMap<K> buildObjectFloatMap(int initialCapacity, kotlin.jvm.functions.Function1<? super androidx.collection.MutableObjectFloatMap<K>,kotlin.Unit> builderAction);
+ method public static inline <K> androidx.collection.ObjectFloatMap<K> buildObjectFloatMap(kotlin.jvm.functions.Function1<? super androidx.collection.MutableObjectFloatMap<K>,kotlin.Unit> builderAction);
+ method public static <K> androidx.collection.ObjectFloatMap<K> emptyObjectFloatMap();
+ method public static <K> androidx.collection.MutableObjectFloatMap<K> mutableObjectFloatMapOf();
+ method public static <K> androidx.collection.MutableObjectFloatMap<K> mutableObjectFloatMapOf(K key1, float value1);
+ method public static <K> androidx.collection.MutableObjectFloatMap<K> mutableObjectFloatMapOf(K key1, float value1, K key2, float value2);
+ method public static <K> androidx.collection.MutableObjectFloatMap<K> mutableObjectFloatMapOf(K key1, float value1, K key2, float value2, K key3, float value3);
+ method public static <K> androidx.collection.MutableObjectFloatMap<K> mutableObjectFloatMapOf(K key1, float value1, K key2, float value2, K key3, float value3, K key4, float value4);
+ method public static <K> androidx.collection.MutableObjectFloatMap<K> mutableObjectFloatMapOf(K key1, float value1, K key2, float value2, K key3, float value3, K key4, float value4, K key5, float value5);
+ method public static <K> androidx.collection.ObjectFloatMap<K> objectFloatMap();
+ method public static <K> androidx.collection.ObjectFloatMap<K> objectFloatMapOf(K key1, float value1);
+ method public static <K> androidx.collection.ObjectFloatMap<K> objectFloatMapOf(K key1, float value1, K key2, float value2);
+ method public static <K> androidx.collection.ObjectFloatMap<K> objectFloatMapOf(K key1, float value1, K key2, float value2, K key3, float value3);
+ method public static <K> androidx.collection.ObjectFloatMap<K> objectFloatMapOf(K key1, float value1, K key2, float value2, K key3, float value3, K key4, float value4);
+ method public static <K> androidx.collection.ObjectFloatMap<K> objectFloatMapOf(K key1, float value1, K key2, float value2, K key3, float value3, K key4, float value4, K key5, float value5);
+ }
+
+ public abstract sealed class ObjectIntMap<K> {
+ method public final inline boolean all(kotlin.jvm.functions.Function2<? super K,? super java.lang.Integer,java.lang.Boolean> predicate);
+ method public final boolean any();
+ method public final inline boolean any(kotlin.jvm.functions.Function2<? super K,? super java.lang.Integer,java.lang.Boolean> predicate);
+ method public final inline operator boolean contains(K key);
+ method public final boolean containsKey(K key);
+ method public final boolean containsValue(int value);
+ method public final int count();
+ method public final inline int count(kotlin.jvm.functions.Function2<? super K,? super java.lang.Integer,java.lang.Boolean> predicate);
+ method @kotlin.PublishedApi internal final int findKeyIndex(K key);
+ method public final inline void forEach(kotlin.jvm.functions.Function2<? super K,? super java.lang.Integer,kotlin.Unit> block);
+ method @kotlin.PublishedApi internal final inline void forEachIndexed(kotlin.jvm.functions.Function1<? super java.lang.Integer,kotlin.Unit> block);
+ method public final inline void forEachKey(kotlin.jvm.functions.Function1<? super K,kotlin.Unit> block);
+ method public final inline void forEachValue(kotlin.jvm.functions.Function1<? super java.lang.Integer,kotlin.Unit> block);
+ method public final operator int get(K key);
+ method public final int getCapacity();
+ method public final int getOrDefault(K key, int defaultValue);
+ method public final inline int getOrElse(K key, kotlin.jvm.functions.Function0<java.lang.Integer> defaultValue);
+ method public final int getSize();
+ method public final boolean isEmpty();
+ method public final boolean isNotEmpty();
+ method public final String joinToString();
+ method public final String joinToString(optional CharSequence separator);
+ method public final String joinToString(optional CharSequence separator, optional CharSequence prefix);
+ method public final String joinToString(optional CharSequence separator, optional CharSequence prefix, optional CharSequence postfix);
+ method public final String joinToString(optional CharSequence separator, optional CharSequence prefix, optional CharSequence postfix, optional int limit);
+ method public final String joinToString(optional CharSequence separator, optional CharSequence prefix, optional CharSequence postfix, optional int limit, optional CharSequence truncated);
+ method public final inline String joinToString(optional CharSequence separator, optional CharSequence prefix, optional CharSequence postfix, optional int limit, optional CharSequence truncated, kotlin.jvm.functions.Function2<? super K,? super java.lang.Integer,? extends java.lang.CharSequence> transform);
+ method public final inline String joinToString(optional CharSequence separator, optional CharSequence prefix, optional CharSequence postfix, optional int limit, kotlin.jvm.functions.Function2<? super K,? super java.lang.Integer,? extends java.lang.CharSequence> transform);
+ method public final inline String joinToString(optional CharSequence separator, optional CharSequence prefix, optional CharSequence postfix, kotlin.jvm.functions.Function2<? super K,? super java.lang.Integer,? extends java.lang.CharSequence> transform);
+ method public final inline String joinToString(optional CharSequence separator, optional CharSequence prefix, kotlin.jvm.functions.Function2<? super K,? super java.lang.Integer,? extends java.lang.CharSequence> transform);
+ method public final inline String joinToString(optional CharSequence separator, kotlin.jvm.functions.Function2<? super K,? super java.lang.Integer,? extends java.lang.CharSequence> transform);
+ method public final inline String joinToString(kotlin.jvm.functions.Function2<? super K,? super java.lang.Integer,? extends java.lang.CharSequence> transform);
+ method public final boolean none();
+ property public final int capacity;
+ property @kotlin.PublishedApi internal final Object?[] keys;
+ property @kotlin.PublishedApi internal final long[] metadata;
+ property public final int size;
+ property @kotlin.PublishedApi internal final int[] values;
+ field @kotlin.PublishedApi internal Object?[] keys;
+ field @kotlin.PublishedApi internal long[] metadata;
+ field @kotlin.PublishedApi internal int[] values;
+ }
+
+ public final class ObjectIntMapKt {
+ method public static inline <K> androidx.collection.ObjectIntMap<K> buildObjectIntMap(int initialCapacity, kotlin.jvm.functions.Function1<? super androidx.collection.MutableObjectIntMap<K>,kotlin.Unit> builderAction);
+ method public static inline <K> androidx.collection.ObjectIntMap<K> buildObjectIntMap(kotlin.jvm.functions.Function1<? super androidx.collection.MutableObjectIntMap<K>,kotlin.Unit> builderAction);
+ method public static <K> androidx.collection.ObjectIntMap<K> emptyObjectIntMap();
+ method public static <K> androidx.collection.MutableObjectIntMap<K> mutableObjectIntMapOf();
+ method public static <K> androidx.collection.MutableObjectIntMap<K> mutableObjectIntMapOf(K key1, int value1);
+ method public static <K> androidx.collection.MutableObjectIntMap<K> mutableObjectIntMapOf(K key1, int value1, K key2, int value2);
+ method public static <K> androidx.collection.MutableObjectIntMap<K> mutableObjectIntMapOf(K key1, int value1, K key2, int value2, K key3, int value3);
+ method public static <K> androidx.collection.MutableObjectIntMap<K> mutableObjectIntMapOf(K key1, int value1, K key2, int value2, K key3, int value3, K key4, int value4);
+ method public static <K> androidx.collection.MutableObjectIntMap<K> mutableObjectIntMapOf(K key1, int value1, K key2, int value2, K key3, int value3, K key4, int value4, K key5, int value5);
+ method public static <K> androidx.collection.ObjectIntMap<K> objectIntMap();
+ method public static <K> androidx.collection.ObjectIntMap<K> objectIntMapOf(K key1, int value1);
+ method public static <K> androidx.collection.ObjectIntMap<K> objectIntMapOf(K key1, int value1, K key2, int value2);
+ method public static <K> androidx.collection.ObjectIntMap<K> objectIntMapOf(K key1, int value1, K key2, int value2, K key3, int value3);
+ method public static <K> androidx.collection.ObjectIntMap<K> objectIntMapOf(K key1, int value1, K key2, int value2, K key3, int value3, K key4, int value4);
+ method public static <K> androidx.collection.ObjectIntMap<K> objectIntMapOf(K key1, int value1, K key2, int value2, K key3, int value3, K key4, int value4, K key5, int value5);
+ }
+
+ public abstract sealed class ObjectList<E> {
+ method public final boolean any();
+ method public final inline boolean any(kotlin.jvm.functions.Function1<? super E,java.lang.Boolean> predicate);
+ method public abstract java.util.List<E> asList();
+ method public final operator boolean contains(E element);
+ method public final boolean containsAll(androidx.collection.ObjectList<E> elements);
+ method public final boolean containsAll(E[] elements);
+ method public final boolean containsAll(Iterable<? extends E> elements);
+ method public final boolean containsAll(java.util.List<? extends E> elements);
+ method public final int count();
+ method public final inline int count(kotlin.jvm.functions.Function1<? super E,java.lang.Boolean> predicate);
+ method public final E elementAt(@IntRange(from=0L) int index);
+ method public final inline E elementAtOrElse(@IntRange(from=0L) int index, kotlin.jvm.functions.Function1<? super java.lang.Integer,? extends E> defaultValue);
+ method public final E first();
+ method public final inline E first(kotlin.jvm.functions.Function1<? super E,java.lang.Boolean> predicate);
+ method public final inline E? firstOrNull();
+ method public final inline E? firstOrNull(kotlin.jvm.functions.Function1<? super E,java.lang.Boolean> predicate);
+ method public final inline <R> R fold(R initial, kotlin.jvm.functions.Function2<? super R,? super E,? extends R> operation);
+ method public final inline <R> R foldIndexed(R initial, kotlin.jvm.functions.Function3<? super java.lang.Integer,? super R,? super E,? extends R> operation);
+ method public final inline <R> R foldRight(R initial, kotlin.jvm.functions.Function2<? super E,? super R,? extends R> operation);
+ method public final inline <R> R foldRightIndexed(R initial, kotlin.jvm.functions.Function3<? super java.lang.Integer,? super E,? super R,? extends R> operation);
+ method public final inline void forEach(kotlin.jvm.functions.Function1<? super E,kotlin.Unit> block);
+ method public final inline void forEachIndexed(kotlin.jvm.functions.Function2<? super java.lang.Integer,? super E,kotlin.Unit> block);
+ method public final inline void forEachReversed(kotlin.jvm.functions.Function1<? super E,kotlin.Unit> block);
+ method public final inline void forEachReversedIndexed(kotlin.jvm.functions.Function2<? super java.lang.Integer,? super E,kotlin.Unit> block);
+ method public final operator E get(@IntRange(from=0L) int index);
+ method public final inline kotlin.ranges.IntRange getIndices();
+ method @IntRange(from=-1L) public final inline int getLastIndex();
+ method @IntRange(from=0L) public final int getSize();
+ method public final int indexOf(E element);
+ method public final inline int indexOfFirst(kotlin.jvm.functions.Function1<? super E,java.lang.Boolean> predicate);
+ method public final inline int indexOfLast(kotlin.jvm.functions.Function1<? super E,java.lang.Boolean> predicate);
+ method public final boolean isEmpty();
+ method public final boolean isNotEmpty();
+ method public final String joinToString();
+ method public final String joinToString(optional CharSequence separator);
+ method public final String joinToString(optional CharSequence separator, optional CharSequence prefix);
+ method public final String joinToString(optional CharSequence separator, optional CharSequence prefix, optional CharSequence postfix);
+ method public final String joinToString(optional CharSequence separator, optional CharSequence prefix, optional CharSequence postfix, optional int limit);
+ method public final String joinToString(optional CharSequence separator, optional CharSequence prefix, optional CharSequence postfix, optional int limit, optional CharSequence truncated);
+ method public final String joinToString(optional CharSequence separator, optional CharSequence prefix, optional CharSequence postfix, optional int limit, optional CharSequence truncated, optional kotlin.jvm.functions.Function1<? super E,? extends java.lang.CharSequence>? transform);
+ method public final E last();
+ method public final inline E last(kotlin.jvm.functions.Function1<? super E,java.lang.Boolean> predicate);
+ method public final int lastIndexOf(E element);
+ method public final inline E? lastOrNull();
+ method public final inline E? lastOrNull(kotlin.jvm.functions.Function1<? super E,java.lang.Boolean> predicate);
+ method public final boolean none();
+ method public final inline boolean reversedAny(kotlin.jvm.functions.Function1<? super E,java.lang.Boolean> predicate);
+ property @kotlin.PublishedApi internal final int _size;
+ property @kotlin.PublishedApi internal final Object?[] content;
+ property public final inline kotlin.ranges.IntRange indices;
+ property @IntRange(from=-1L) public final inline int lastIndex;
+ property @IntRange(from=0L) public final int size;
+ field @kotlin.PublishedApi internal int _size;
+ field @kotlin.PublishedApi internal Object?[] content;
+ }
+
+ public final class ObjectListKt {
+ method public static <E> androidx.collection.ObjectList<E> emptyObjectList();
+ method public static inline <E> androidx.collection.MutableObjectList<E> mutableObjectListOf();
+ method public static <E> androidx.collection.MutableObjectList<E> mutableObjectListOf(E element1);
+ method public static <E> androidx.collection.MutableObjectList<E> mutableObjectListOf(E element1, E element2);
+ method public static <E> androidx.collection.MutableObjectList<E> mutableObjectListOf(E element1, E element2, E element3);
+ method public static inline <E> androidx.collection.MutableObjectList<E> mutableObjectListOf(E... elements);
+ method public static <E> androidx.collection.ObjectList<E> objectListOf();
+ method public static <E> androidx.collection.ObjectList<E> objectListOf(E element1);
+ method public static <E> androidx.collection.ObjectList<E> objectListOf(E element1, E element2);
+ method public static <E> androidx.collection.ObjectList<E> objectListOf(E element1, E element2, E element3);
+ method public static <E> androidx.collection.ObjectList<E> objectListOf(E... elements);
+ }
+
+ public abstract sealed class ObjectLongMap<K> {
+ method public final inline boolean all(kotlin.jvm.functions.Function2<? super K,? super java.lang.Long,java.lang.Boolean> predicate);
+ method public final boolean any();
+ method public final inline boolean any(kotlin.jvm.functions.Function2<? super K,? super java.lang.Long,java.lang.Boolean> predicate);
+ method public final inline operator boolean contains(K key);
+ method public final boolean containsKey(K key);
+ method public final boolean containsValue(long value);
+ method public final int count();
+ method public final inline int count(kotlin.jvm.functions.Function2<? super K,? super java.lang.Long,java.lang.Boolean> predicate);
+ method @kotlin.PublishedApi internal final int findKeyIndex(K key);
+ method public final inline void forEach(kotlin.jvm.functions.Function2<? super K,? super java.lang.Long,kotlin.Unit> block);
+ method @kotlin.PublishedApi internal final inline void forEachIndexed(kotlin.jvm.functions.Function1<? super java.lang.Integer,kotlin.Unit> block);
+ method public final inline void forEachKey(kotlin.jvm.functions.Function1<? super K,kotlin.Unit> block);
+ method public final inline void forEachValue(kotlin.jvm.functions.Function1<? super java.lang.Long,kotlin.Unit> block);
+ method public final operator long get(K key);
+ method public final int getCapacity();
+ method public final long getOrDefault(K key, long defaultValue);
+ method public final inline long getOrElse(K key, kotlin.jvm.functions.Function0<java.lang.Long> defaultValue);
+ method public final int getSize();
+ method public final boolean isEmpty();
+ method public final boolean isNotEmpty();
+ method public final String joinToString();
+ method public final String joinToString(optional CharSequence separator);
+ method public final String joinToString(optional CharSequence separator, optional CharSequence prefix);
+ method public final String joinToString(optional CharSequence separator, optional CharSequence prefix, optional CharSequence postfix);
+ method public final String joinToString(optional CharSequence separator, optional CharSequence prefix, optional CharSequence postfix, optional int limit);
+ method public final String joinToString(optional CharSequence separator, optional CharSequence prefix, optional CharSequence postfix, optional int limit, optional CharSequence truncated);
+ method public final inline String joinToString(optional CharSequence separator, optional CharSequence prefix, optional CharSequence postfix, optional int limit, optional CharSequence truncated, kotlin.jvm.functions.Function2<? super K,? super java.lang.Long,? extends java.lang.CharSequence> transform);
+ method public final inline String joinToString(optional CharSequence separator, optional CharSequence prefix, optional CharSequence postfix, optional int limit, kotlin.jvm.functions.Function2<? super K,? super java.lang.Long,? extends java.lang.CharSequence> transform);
+ method public final inline String joinToString(optional CharSequence separator, optional CharSequence prefix, optional CharSequence postfix, kotlin.jvm.functions.Function2<? super K,? super java.lang.Long,? extends java.lang.CharSequence> transform);
+ method public final inline String joinToString(optional CharSequence separator, optional CharSequence prefix, kotlin.jvm.functions.Function2<? super K,? super java.lang.Long,? extends java.lang.CharSequence> transform);
+ method public final inline String joinToString(optional CharSequence separator, kotlin.jvm.functions.Function2<? super K,? super java.lang.Long,? extends java.lang.CharSequence> transform);
+ method public final inline String joinToString(kotlin.jvm.functions.Function2<? super K,? super java.lang.Long,? extends java.lang.CharSequence> transform);
+ method public final boolean none();
+ property public final int capacity;
+ property @kotlin.PublishedApi internal final Object?[] keys;
+ property @kotlin.PublishedApi internal final long[] metadata;
+ property public final int size;
+ property @kotlin.PublishedApi internal final long[] values;
+ field @kotlin.PublishedApi internal Object?[] keys;
+ field @kotlin.PublishedApi internal long[] metadata;
+ field @kotlin.PublishedApi internal long[] values;
+ }
+
+ public final class ObjectLongMapKt {
+ method public static inline <K> androidx.collection.ObjectLongMap<K> buildObjectLongMap(int initialCapacity, kotlin.jvm.functions.Function1<? super androidx.collection.MutableObjectLongMap<K>,kotlin.Unit> builderAction);
+ method public static inline <K> androidx.collection.ObjectLongMap<K> buildObjectLongMap(kotlin.jvm.functions.Function1<? super androidx.collection.MutableObjectLongMap<K>,kotlin.Unit> builderAction);
+ method public static <K> androidx.collection.ObjectLongMap<K> emptyObjectLongMap();
+ method public static <K> androidx.collection.MutableObjectLongMap<K> mutableObjectLongMapOf();
+ method public static <K> androidx.collection.MutableObjectLongMap<K> mutableObjectLongMapOf(K key1, long value1);
+ method public static <K> androidx.collection.MutableObjectLongMap<K> mutableObjectLongMapOf(K key1, long value1, K key2, long value2);
+ method public static <K> androidx.collection.MutableObjectLongMap<K> mutableObjectLongMapOf(K key1, long value1, K key2, long value2, K key3, long value3);
+ method public static <K> androidx.collection.MutableObjectLongMap<K> mutableObjectLongMapOf(K key1, long value1, K key2, long value2, K key3, long value3, K key4, long value4);
+ method public static <K> androidx.collection.MutableObjectLongMap<K> mutableObjectLongMapOf(K key1, long value1, K key2, long value2, K key3, long value3, K key4, long value4, K key5, long value5);
+ method public static <K> androidx.collection.ObjectLongMap<K> objectLongMap();
+ method public static <K> androidx.collection.ObjectLongMap<K> objectLongMapOf(K key1, long value1);
+ method public static <K> androidx.collection.ObjectLongMap<K> objectLongMapOf(K key1, long value1, K key2, long value2);
+ method public static <K> androidx.collection.ObjectLongMap<K> objectLongMapOf(K key1, long value1, K key2, long value2, K key3, long value3);
+ method public static <K> androidx.collection.ObjectLongMap<K> objectLongMapOf(K key1, long value1, K key2, long value2, K key3, long value3, K key4, long value4);
+ method public static <K> androidx.collection.ObjectLongMap<K> objectLongMapOf(K key1, long value1, K key2, long value2, K key3, long value3, K key4, long value4, K key5, long value5);
+ }
+
+ public abstract sealed class OrderedScatterSet<E> {
+ method public final inline boolean all(kotlin.jvm.functions.Function1<? super E,java.lang.Boolean> predicate);
+ method public final boolean any();
+ method public final inline boolean any(kotlin.jvm.functions.Function1<? super E,java.lang.Boolean> predicate);
+ method public final java.util.Set<E> asSet();
+ method public final operator boolean contains(E element);
+ method @IntRange(from=0L) public final int count();
+ method @IntRange(from=0L) public final inline int count(kotlin.jvm.functions.Function1<? super E,java.lang.Boolean> predicate);
+ method public final E first();
+ method public final inline E first(kotlin.jvm.functions.Function1<? super E,java.lang.Boolean> predicate);
+ method public final inline E? firstOrNull(kotlin.jvm.functions.Function1<? super E,java.lang.Boolean> predicate);
+ method public final inline void forEach(kotlin.jvm.functions.Function1<? super E,kotlin.Unit> block);
+ method public final inline void forEachReverse(kotlin.jvm.functions.Function1<? super E,kotlin.Unit> block);
+ method @IntRange(from=0L) public final int getCapacity();
+ method @IntRange(from=0L) public final int getSize();
+ method public final boolean isEmpty();
+ method public final boolean isNotEmpty();
+ method public final String joinToString();
+ method public final String joinToString(optional CharSequence separator);
+ method public final String joinToString(optional CharSequence separator, optional CharSequence prefix);
+ method public final String joinToString(optional CharSequence separator, optional CharSequence prefix, optional CharSequence postfix);
+ method public final String joinToString(optional CharSequence separator, optional CharSequence prefix, optional CharSequence postfix, optional int limit);
+ method public final String joinToString(optional CharSequence separator, optional CharSequence prefix, optional CharSequence postfix, optional int limit, optional CharSequence truncated);
+ method public final String joinToString(optional CharSequence separator, optional CharSequence prefix, optional CharSequence postfix, optional int limit, optional CharSequence truncated, optional kotlin.jvm.functions.Function1<? super E,? extends java.lang.CharSequence>? transform);
+ method public final E last();
+ method public final inline E last(kotlin.jvm.functions.Function1<? super E,java.lang.Boolean> predicate);
+ method public final inline E? lastOrNull(kotlin.jvm.functions.Function1<? super E,java.lang.Boolean> predicate);
+ method public final boolean none();
+ method public final inline java.util.List<E> toList();
+ method @kotlin.PublishedApi internal final inline void unorderedForEach(kotlin.jvm.functions.Function1<? super E,kotlin.Unit> block);
+ method @kotlin.PublishedApi internal final inline void unorderedForEachIndex(kotlin.jvm.functions.Function1<? super java.lang.Integer,kotlin.Unit> block);
+ property @IntRange(from=0L) public final int capacity;
+ property @kotlin.PublishedApi internal final Object?[] elements;
+ property @kotlin.PublishedApi internal final int head;
+ property @kotlin.PublishedApi internal final long[] metadata;
+ property @kotlin.PublishedApi internal final long[] nodes;
+ property @IntRange(from=0L) public final int size;
+ property @kotlin.PublishedApi internal final int tail;
+ field @kotlin.PublishedApi internal Object?[] elements;
+ field @kotlin.PublishedApi internal int head;
+ field @kotlin.PublishedApi internal long[] metadata;
+ field @kotlin.PublishedApi internal long[] nodes;
+ field @kotlin.PublishedApi internal int tail;
+ }
+
+ public final class OrderedScatterSetKt {
+ method public static <E> androidx.collection.OrderedScatterSet<E> emptyOrderedScatterSet();
+ method public static <E> androidx.collection.MutableOrderedScatterSet<E> mutableOrderedScatterSetOf();
+ method public static <E> androidx.collection.MutableOrderedScatterSet<E> mutableOrderedScatterSetOf(E element1);
+ method public static <E> androidx.collection.MutableOrderedScatterSet<E> mutableOrderedScatterSetOf(E element1, E element2);
+ method public static <E> androidx.collection.MutableOrderedScatterSet<E> mutableOrderedScatterSetOf(E element1, E element2, E element3);
+ method public static <E> androidx.collection.MutableOrderedScatterSet<E> mutableOrderedScatterSetOf(E... elements);
+ method public static <E> androidx.collection.OrderedScatterSet<E> orderedScatterSetOf();
+ method public static <E> androidx.collection.OrderedScatterSet<E> orderedScatterSetOf(E element1);
+ method public static <E> androidx.collection.OrderedScatterSet<E> orderedScatterSetOf(E element1, E element2);
+ method public static <E> androidx.collection.OrderedScatterSet<E> orderedScatterSetOf(E element1, E element2, E element3);
+ method public static <E> androidx.collection.OrderedScatterSet<E> orderedScatterSetOf(E... elements);
+ }
+
+ public abstract sealed class ScatterMap<K, V> {
+ method public final inline boolean all(kotlin.jvm.functions.Function2<? super K,? super V,java.lang.Boolean> predicate);
+ method public final boolean any();
+ method public final inline boolean any(kotlin.jvm.functions.Function2<? super K,? super V,java.lang.Boolean> predicate);
+ method public final java.util.Map<K,V> asMap();
+ method public final operator boolean contains(K key);
+ method public final boolean containsKey(K key);
+ method public final boolean containsValue(V value);
+ method public final int count();
+ method public final inline int count(kotlin.jvm.functions.Function2<? super K,? super V,java.lang.Boolean> predicate);
+ method public final inline void forEach(kotlin.jvm.functions.Function2<? super K,? super V,kotlin.Unit> block);
+ method @kotlin.PublishedApi internal final inline void forEachIndexed(kotlin.jvm.functions.Function1<? super java.lang.Integer,kotlin.Unit> block);
+ method public final inline void forEachKey(kotlin.jvm.functions.Function1<? super K,kotlin.Unit> block);
+ method public final inline void forEachValue(kotlin.jvm.functions.Function1<? super V,kotlin.Unit> block);
+ method public final operator V? get(K key);
+ method public final int getCapacity();
+ method public final V getOrDefault(K key, V defaultValue);
+ method public final inline V getOrElse(K key, kotlin.jvm.functions.Function0<? extends V> defaultValue);
+ method public final int getSize();
+ method public final boolean isEmpty();
+ method public final boolean isNotEmpty();
+ method public final String joinToString();
+ method public final String joinToString(optional CharSequence separator);
+ method public final String joinToString(optional CharSequence separator, optional CharSequence prefix);
+ method public final String joinToString(optional CharSequence separator, optional CharSequence prefix, optional CharSequence postfix);
+ method public final String joinToString(optional CharSequence separator, optional CharSequence prefix, optional CharSequence postfix, optional int limit);
+ method public final String joinToString(optional CharSequence separator, optional CharSequence prefix, optional CharSequence postfix, optional int limit, optional CharSequence truncated);
+ method public final String joinToString(optional CharSequence separator, optional CharSequence prefix, optional CharSequence postfix, optional int limit, optional CharSequence truncated, optional kotlin.jvm.functions.Function2<? super K,? super V,? extends java.lang.CharSequence>? transform);
+ method public final boolean none();
+ property public final int capacity;
+ property @kotlin.PublishedApi internal final Object?[] keys;
+ property @kotlin.PublishedApi internal final long[] metadata;
+ property public final int size;
+ property @kotlin.PublishedApi internal final Object?[] values;
+ field @kotlin.PublishedApi internal Object?[] keys;
+ field @kotlin.PublishedApi internal long[] metadata;
+ field @kotlin.PublishedApi internal Object?[] values;
+ }
+
+ public final class ScatterMapKt {
+ method public static <K, V> androidx.collection.ScatterMap<K,V> emptyScatterMap();
+ method @kotlin.PublishedApi internal static inline boolean isFull(long value);
+ method @kotlin.PublishedApi internal static inline int lowestBitSet(long);
+ method @kotlin.PublishedApi internal static inline long maskEmptyOrDeleted(long);
+ method @kotlin.PublishedApi internal static inline long match(long, int m);
+ method public static <K, V> androidx.collection.MutableScatterMap<K,V> mutableScatterMapOf();
+ method public static <K, V> androidx.collection.MutableScatterMap<K,V> mutableScatterMapOf(kotlin.Pair<? extends K,? extends V>... pairs);
+ method @kotlin.PublishedApi internal static inline long readRawMetadata(long[] data, int offset);
+ property @kotlin.PublishedApi internal static final long BitmaskLsb;
+ property @kotlin.PublishedApi internal static final long BitmaskMsb;
+ property @kotlin.PublishedApi internal static final long Sentinel;
+ field @kotlin.PublishedApi internal static final long BitmaskLsb = 72340172838076673L; // 0x101010101010101L
+ field @kotlin.PublishedApi internal static final long BitmaskMsb = -9187201950435737472L; // 0x8080808080808080L
+ field @kotlin.PublishedApi internal static final long Sentinel = 255L; // 0xffL
+ }
+
+ public abstract sealed class ScatterSet<E> {
+ method public final inline boolean all(kotlin.jvm.functions.Function1<? super E,java.lang.Boolean> predicate);
+ method public final boolean any();
+ method public final inline boolean any(kotlin.jvm.functions.Function1<? super E,java.lang.Boolean> predicate);
+ method public final java.util.Set<E> asSet();
+ method public final operator boolean contains(E element);
+ method @IntRange(from=0L) public final int count();
+ method @IntRange(from=0L) public final inline int count(kotlin.jvm.functions.Function1<? super E,java.lang.Boolean> predicate);
+ method public final E first();
+ method public final inline E first(kotlin.jvm.functions.Function1<? super E,java.lang.Boolean> predicate);
+ method public final inline E? firstOrNull(kotlin.jvm.functions.Function1<? super E,java.lang.Boolean> predicate);
+ method public final inline void forEach(kotlin.jvm.functions.Function1<? super E,kotlin.Unit> block);
+ method @kotlin.PublishedApi internal final inline void forEachIndex(kotlin.jvm.functions.Function1<? super java.lang.Integer,kotlin.Unit> block);
+ method @IntRange(from=0L) public final int getCapacity();
+ method @IntRange(from=0L) public final int getSize();
+ method public final boolean isEmpty();
+ method public final boolean isNotEmpty();
+ method public final String joinToString();
+ method public final String joinToString(optional CharSequence separator);
+ method public final String joinToString(optional CharSequence separator, optional CharSequence prefix);
+ method public final String joinToString(optional CharSequence separator, optional CharSequence prefix, optional CharSequence postfix);
+ method public final String joinToString(optional CharSequence separator, optional CharSequence prefix, optional CharSequence postfix, optional int limit);
+ method public final String joinToString(optional CharSequence separator, optional CharSequence prefix, optional CharSequence postfix, optional int limit, optional CharSequence truncated);
+ method public final String joinToString(optional CharSequence separator, optional CharSequence prefix, optional CharSequence postfix, optional int limit, optional CharSequence truncated, optional kotlin.jvm.functions.Function1<? super E,? extends java.lang.CharSequence>? transform);
+ method public final boolean none();
+ property @IntRange(from=0L) public final int capacity;
+ property @kotlin.PublishedApi internal final Object?[] elements;
+ property @kotlin.PublishedApi internal final long[] metadata;
+ property @IntRange(from=0L) public final int size;
+ field @kotlin.PublishedApi internal Object?[] elements;
+ field @kotlin.PublishedApi internal long[] metadata;
+ }
+
+ public final class ScatterSetKt {
+ method public static <E> androidx.collection.ScatterSet<E> emptyScatterSet();
+ method public static <E> androidx.collection.MutableScatterSet<E> mutableScatterSetOf();
+ method public static <E> androidx.collection.MutableScatterSet<E> mutableScatterSetOf(E element1);
+ method public static <E> androidx.collection.MutableScatterSet<E> mutableScatterSetOf(E element1, E element2);
+ method public static <E> androidx.collection.MutableScatterSet<E> mutableScatterSetOf(E element1, E element2, E element3);
+ method public static <E> androidx.collection.MutableScatterSet<E> mutableScatterSetOf(E... elements);
+ method public static <E> androidx.collection.ScatterSet<E> scatterSetOf();
+ method public static <E> androidx.collection.ScatterSet<E> scatterSetOf(E element1);
+ method public static <E> androidx.collection.ScatterSet<E> scatterSetOf(E element1, E element2);
+ method public static <E> androidx.collection.ScatterSet<E> scatterSetOf(E element1, E element2, E element3);
+ method public static <E> androidx.collection.ScatterSet<E> scatterSetOf(E... elements);
+ }
+
+ public final class SieveCache<K, V> {
+ ctor public SieveCache(@IntRange(from=1L, to=androidx.collection.SieveCacheKt.MaxSize) int maxSize, optional @IntRange(from=0L, to=androidx.collection.SieveCacheKt.MaxSize) int initialCapacity, optional kotlin.jvm.functions.Function2<? super K,? super V,java.lang.Integer> sizeOf, optional kotlin.jvm.functions.Function1<? super K,? extends V?> createValueFromKey, optional kotlin.jvm.functions.Function4<? super K,? super V,? super V?,? super java.lang.Boolean,kotlin.Unit> onEntryRemoved);
+ method public inline boolean all(kotlin.jvm.functions.Function2<? super K,? super V,java.lang.Boolean> predicate);
+ method public boolean any();
+ method public inline boolean any(kotlin.jvm.functions.Function2<? super K,? super V,java.lang.Boolean> predicate);
+ method public operator boolean contains(K key);
+ method public boolean containsKey(K key);
+ method public boolean containsValue(V value);
+ method public int count();
+ method public inline int count(kotlin.jvm.functions.Function2<? super K,? super V,java.lang.Boolean> predicate);
+ method public void evictAll();
+ method public inline void forEach(kotlin.jvm.functions.Function2<? super K,? super V,kotlin.Unit> block);
+ method @kotlin.PublishedApi internal inline void forEachIndexed(kotlin.jvm.functions.Function1<? super java.lang.Integer,kotlin.Unit> block);
+ method public inline void forEachKey(kotlin.jvm.functions.Function1<? super K,kotlin.Unit> block);
+ method public inline void forEachValue(kotlin.jvm.functions.Function1<? super V,kotlin.Unit> block);
+ method public operator V? get(K key);
+ method public int getCapacity();
+ method public int getCount();
+ method public int getMaxSize();
+ method public int getSize();
+ method public boolean isEmpty();
+ method public boolean isNotEmpty();
+ method public inline operator void minusAssign(androidx.collection.ObjectList<K> keys);
+ method public inline operator void minusAssign(androidx.collection.ScatterSet<K> keys);
+ method public inline operator void minusAssign(Iterable<? extends K> keys);
+ method public inline operator void minusAssign(K key);
+ method public inline operator void minusAssign(K[] keys);
+ method public inline operator void minusAssign(kotlin.sequences.Sequence<? extends K> keys);
+ method public boolean none();
+ method public inline operator void plusAssign(androidx.collection.ScatterMap<K,V> from);
+ method public inline operator void plusAssign(androidx.collection.SieveCache<K,V> from);
+ method public inline operator void plusAssign(Iterable<? extends kotlin.Pair<? extends K,? extends V>> pairs);
+ method public inline operator void plusAssign(java.util.Map<K,? extends V> from);
+ method public inline operator void plusAssign(kotlin.Pair<? extends K,? extends V> pair);
+ method public inline operator void plusAssign(kotlin.Pair<? extends K,? extends V>[] pairs);
+ method public inline operator void plusAssign(kotlin.sequences.Sequence<? extends kotlin.Pair<? extends K,? extends V>> pairs);
+ method public V? put(K key, V value);
+ method public void putAll(androidx.collection.ScatterMap<K,V> from);
+ method public void putAll(androidx.collection.SieveCache<K,V> from);
+ method public void putAll(Iterable<? extends kotlin.Pair<? extends K,? extends V>> pairs);
+ method public void putAll(java.util.Map<K,? extends V> from);
+ method public void putAll(kotlin.Pair<? extends K,? extends V>[] pairs);
+ method public void putAll(kotlin.sequences.Sequence<? extends kotlin.Pair<? extends K,? extends V>> pairs);
+ method public V? remove(K key);
+ method public boolean remove(K key, V value);
+ method public void removeIf(kotlin.jvm.functions.Function2<? super K,? super V,java.lang.Boolean> predicate);
+ method public void resize(@IntRange(from=1L, to=androidx.collection.SieveCacheKt.MaxSize) int maxSize);
+ method public inline operator void set(K key, V value);
+ method public void trimToSize(int maxSize);
+ property public final int capacity;
+ property public final int count;
+ property @kotlin.PublishedApi internal final Object?[] keys;
+ property public final int maxSize;
+ property @kotlin.PublishedApi internal final long[] metadata;
+ property public final int size;
+ property @kotlin.PublishedApi internal final Object?[] values;
+ field @kotlin.PublishedApi internal Object?[] keys;
+ field @kotlin.PublishedApi internal long[] metadata;
+ field @kotlin.PublishedApi internal Object?[] values;
+ }
+
+ public final class SieveCacheKt {
+ property @kotlin.PublishedApi internal static final int NodeInvalidLink;
+ property @kotlin.PublishedApi internal static final long NodeLinkMask;
+ field @kotlin.PublishedApi internal static final int NodeInvalidLink = 2147483647; // 0x7fffffff
+ field @kotlin.PublishedApi internal static final long NodeLinkMask = 2147483647L; // 0x7fffffffL
+ }
+
+ public class SimpleArrayMap<K, V> {
+ ctor public SimpleArrayMap();
+ ctor public SimpleArrayMap(androidx.collection.SimpleArrayMap<? extends K,? extends V>? map);
+ ctor public SimpleArrayMap(optional int capacity);
+ method public void clear();
+ method public boolean containsKey(K key);
+ method public boolean containsValue(V value);
+ method public void ensureCapacity(int minimumCapacity);
+ method public operator V? get(K key);
+ method public V getOrDefault(Object? key, V defaultValue);
+ method public int indexOfKey(K key);
+ method public boolean isEmpty();
+ method public K keyAt(int index);
+ method public V? put(K key, V value);
+ method public void putAll(androidx.collection.SimpleArrayMap<? extends K,? extends V> map);
+ method public V? putIfAbsent(K key, V value);
+ method public V? remove(K key);
+ method public boolean remove(K key, V value);
+ method public V removeAt(int index);
+ method public V? replace(K key, V value);
+ method public boolean replace(K key, V oldValue, V newValue);
+ method public V setValueAt(int index, V value);
+ method public int size();
+ method public V valueAt(int index);
+ }
+
+ public class SparseArrayCompat<E> implements java.lang.Cloneable {
+ ctor public SparseArrayCompat();
+ ctor public SparseArrayCompat(optional int initialCapacity);
+ method public void append(int key, E value);
+ method public void clear();
+ method public androidx.collection.SparseArrayCompat<E> clone();
+ method public boolean containsKey(int key);
+ method public boolean containsValue(E value);
+ method @Deprecated public void delete(int key);
+ method public operator E? get(int key);
+ method public E get(int key, E defaultValue);
+ method public final boolean getIsEmpty();
+ method public int indexOfKey(int key);
+ method public int indexOfValue(E value);
+ method public boolean isEmpty();
+ method public int keyAt(int index);
+ method public void put(int key, E value);
+ method public void putAll(androidx.collection.SparseArrayCompat<? extends E> other);
+ method public E? putIfAbsent(int key, E value);
+ method public void remove(int key);
+ method public boolean remove(int key, Object? value);
+ method public void removeAt(int index);
+ method public void removeAtRange(int index, int size);
+ method public E? replace(int key, E value);
+ method public boolean replace(int key, E oldValue, E newValue);
+ method public void setValueAt(int index, E value);
+ method public int size();
+ method public E valueAt(int index);
+ property public final boolean isEmpty;
+ }
+
+ public final class SparseArrayKt {
+ method public static inline operator <T> boolean contains(androidx.collection.SparseArrayCompat<T>, int key);
+ method public static inline <T> void forEach(androidx.collection.SparseArrayCompat<T>, kotlin.jvm.functions.Function2<? super java.lang.Integer,? super T,kotlin.Unit> action);
+ method public static inline <T> T getOrDefault(androidx.collection.SparseArrayCompat<T>, int key, T defaultValue);
+ method public static inline <T> T getOrElse(androidx.collection.SparseArrayCompat<T>, int key, kotlin.jvm.functions.Function0<? extends T> defaultValue);
+ method public static inline <T> int getSize(androidx.collection.SparseArrayCompat<T>);
+ method public static inline <T> boolean isNotEmpty(androidx.collection.SparseArrayCompat<T>);
+ method public static <T> kotlin.collections.IntIterator keyIterator(androidx.collection.SparseArrayCompat<T>);
+ method public static operator <T> androidx.collection.SparseArrayCompat<T> plus(androidx.collection.SparseArrayCompat<T>, androidx.collection.SparseArrayCompat<T> other);
+ method @Deprecated public static <T> boolean remove(androidx.collection.SparseArrayCompat<T>, int key, T value);
+ method public static inline operator <T> void set(androidx.collection.SparseArrayCompat<T>, int key, T value);
+ method public static <T> java.util.Iterator<T> valueIterator(androidx.collection.SparseArrayCompat<T>);
+ }
+
+}
+
+package androidx.collection.internal {
+
+ public final class PackingHelpers_jvmKt {
+ method @kotlin.PublishedApi internal static inline float floatFromBits(int bits);
+ }
+
+ public final class RuntimeHelpersKt {
+ method @kotlin.PublishedApi internal static Void throwNoSuchElementExceptionForInline(String message);
+ }
+
+}
+
diff --git a/compose/foundation/foundation-layout/benchmark/src/androidTest/java/androidx/compose/foundation/layout/benchmark/ColumnIntrinsicsBenchmark.kt b/compose/foundation/foundation-layout/benchmark/src/androidTest/java/androidx/compose/foundation/layout/benchmark/ColumnIntrinsicsBenchmark.kt
new file mode 100644
index 0000000..38bbb6b
--- /dev/null
+++ b/compose/foundation/foundation-layout/benchmark/src/androidTest/java/androidx/compose/foundation/layout/benchmark/ColumnIntrinsicsBenchmark.kt
@@ -0,0 +1,65 @@
+/*
+ * Copyright 2024 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT 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.layout.benchmark
+
+import androidx.compose.foundation.layout.IntrinsicSize
+import androidx.compose.foundation.layout.requiredHeight
+import androidx.compose.foundation.layout.requiredWidth
+import androidx.compose.testutils.benchmark.ComposeBenchmarkRule
+import androidx.compose.testutils.benchmark.benchmarkFirstMeasure
+import androidx.compose.testutils.benchmark.benchmarkLayoutPerf
+import androidx.compose.ui.Modifier
+import androidx.test.filters.LargeTest
+import org.junit.Rule
+import org.junit.Test
+import org.junit.runner.RunWith
+import org.junit.runners.Parameterized
+
+/** Benchmark that runs [RectsInColumnTestCase] and tests performance for intrinsic measurements. */
+@LargeTest
+@RunWith(Parameterized::class)
+class ColumnIntrinsicsBenchmark(
+ private val modifierDebugName: String,
+ private val modifier: Modifier
+) {
+
+ companion object {
+ @JvmStatic
+ @Parameterized.Parameters(name = "{0}")
+ fun initParameters(): Array<Array<Any>> =
+ arrayOf(
+ arrayOf("minWidth", Modifier.requiredWidth(IntrinsicSize.Min)),
+ arrayOf("maxWidth", Modifier.requiredWidth(IntrinsicSize.Max)),
+ arrayOf("minHeight", Modifier.requiredHeight(IntrinsicSize.Min)),
+ arrayOf("maxHeight", Modifier.requiredHeight(IntrinsicSize.Max)),
+ )
+ }
+
+ @get:Rule val benchmarkRule = ComposeBenchmarkRule()
+
+ private val rectsInColumnCaseFactory = { RectsInColumnTestCase(10, modifier) }
+
+ @Test
+ fun first_measure_withIntrinsicSize() {
+ benchmarkRule.benchmarkFirstMeasure(rectsInColumnCaseFactory)
+ }
+
+ @Test
+ fun layout_withIntrinsicSize() {
+ benchmarkRule.benchmarkLayoutPerf(rectsInColumnCaseFactory)
+ }
+}
diff --git a/compose/foundation/foundation-layout/benchmark/src/androidTest/java/androidx/compose/foundation/layout/benchmark/FlowColumnIntrinsicsBenchmark.kt b/compose/foundation/foundation-layout/benchmark/src/androidTest/java/androidx/compose/foundation/layout/benchmark/FlowColumnIntrinsicsBenchmark.kt
new file mode 100644
index 0000000..12e7dfe
--- /dev/null
+++ b/compose/foundation/foundation-layout/benchmark/src/androidTest/java/androidx/compose/foundation/layout/benchmark/FlowColumnIntrinsicsBenchmark.kt
@@ -0,0 +1,67 @@
+/*
+ * Copyright 2024 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT 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.layout.benchmark
+
+import androidx.compose.foundation.layout.IntrinsicSize
+import androidx.compose.foundation.layout.requiredHeight
+import androidx.compose.foundation.layout.requiredWidth
+import androidx.compose.testutils.benchmark.ComposeBenchmarkRule
+import androidx.compose.testutils.benchmark.benchmarkFirstMeasure
+import androidx.compose.testutils.benchmark.benchmarkLayoutPerf
+import androidx.compose.ui.Modifier
+import androidx.test.filters.LargeTest
+import org.junit.Rule
+import org.junit.Test
+import org.junit.runner.RunWith
+import org.junit.runners.Parameterized
+
+/**
+ * Benchmark that runs [RectsInFlowColumnTestCase] and tests performance for intrinsic measurements.
+ */
+@LargeTest
+@RunWith(Parameterized::class)
+class FlowColumnIntrinsicsBenchmark(
+ private val modifierDebugName: String,
+ private val modifier: Modifier
+) {
+
+ companion object {
+ @JvmStatic
+ @Parameterized.Parameters(name = "{0}")
+ fun initParameters(): Array<Array<Any>> =
+ arrayOf(
+ arrayOf("minWidth", Modifier.requiredWidth(IntrinsicSize.Min)),
+ arrayOf("maxWidth", Modifier.requiredWidth(IntrinsicSize.Max)),
+ arrayOf("minHeight", Modifier.requiredHeight(IntrinsicSize.Min)),
+ arrayOf("maxHeight", Modifier.requiredHeight(IntrinsicSize.Max)),
+ )
+ }
+
+ @get:Rule val benchmarkRule = ComposeBenchmarkRule()
+
+ private val rectsInFlowColumnCaseFactory = { RectsInFlowColumnTestCase(10, modifier) }
+
+ @Test
+ fun first_measure_withIntrinsicSize() {
+ benchmarkRule.benchmarkFirstMeasure(rectsInFlowColumnCaseFactory)
+ }
+
+ @Test
+ fun layout_withIntrinsicSize() {
+ benchmarkRule.benchmarkLayoutPerf(rectsInFlowColumnCaseFactory)
+ }
+}
diff --git a/compose/foundation/foundation-layout/benchmark/src/androidTest/java/androidx/compose/foundation/layout/benchmark/RectsInColumnTestCase.kt b/compose/foundation/foundation-layout/benchmark/src/androidTest/java/androidx/compose/foundation/layout/benchmark/RectsInColumnTestCase.kt
index e0c65d6..bb7c9d5d 100644
--- a/compose/foundation/foundation-layout/benchmark/src/androidTest/java/androidx/compose/foundation/layout/benchmark/RectsInColumnTestCase.kt
+++ b/compose/foundation/foundation-layout/benchmark/src/androidTest/java/androidx/compose/foundation/layout/benchmark/RectsInColumnTestCase.kt
@@ -36,14 +36,16 @@
*
* Note: Each rectangle has its own model so changes should always affect only the first one.
*/
-class RectsInColumnTestCase(private val amountOfRectangles: Int) :
- LayeredComposeTestCase(), ToggleableTestCase {
+class RectsInColumnTestCase(
+ private val amountOfRectangles: Int,
+ private val modifier: Modifier = Modifier
+) : LayeredComposeTestCase(), ToggleableTestCase {
private val states = mutableListOf<MutableState<Color>>()
@Composable
override fun MeasuredContent() {
- Column { repeat(amountOfRectangles) { ColoredRectWithModel() } }
+ Column(modifier) { repeat(amountOfRectangles) { ColoredRectWithModel() } }
}
override fun toggleState() {
diff --git a/compose/foundation/foundation-layout/benchmark/src/androidTest/java/androidx/compose/foundation/layout/benchmark/RectsInFlowColumnTestCase.kt b/compose/foundation/foundation-layout/benchmark/src/androidTest/java/androidx/compose/foundation/layout/benchmark/RectsInFlowColumnTestCase.kt
index 299a622..cf87c54 100644
--- a/compose/foundation/foundation-layout/benchmark/src/androidTest/java/androidx/compose/foundation/layout/benchmark/RectsInFlowColumnTestCase.kt
+++ b/compose/foundation/foundation-layout/benchmark/src/androidTest/java/androidx/compose/foundation/layout/benchmark/RectsInFlowColumnTestCase.kt
@@ -38,14 +38,16 @@
* Note: Each rectangle has its own model so changes should always affect only the first one.
*/
@OptIn(ExperimentalLayoutApi::class)
-class RectsInFlowColumnTestCase(private val amountOfRectangles: Int) :
- LayeredComposeTestCase(), ToggleableTestCase {
+class RectsInFlowColumnTestCase(
+ private val amountOfRectangles: Int,
+ private val modifier: Modifier = Modifier
+) : LayeredComposeTestCase(), ToggleableTestCase {
private val states = mutableListOf<MutableState<Color>>()
@Composable
override fun MeasuredContent() {
- FlowColumn(maxItemsInEachColumn = 3) {
+ FlowColumn(modifier, maxItemsInEachColumn = 3) {
repeat(amountOfRectangles) { ColoredRectWithModel() }
}
}
diff --git a/compose/foundation/foundation-layout/src/commonMain/kotlin/androidx/compose/foundation/layout/AlignmentLine.kt b/compose/foundation/foundation-layout/src/commonMain/kotlin/androidx/compose/foundation/layout/AlignmentLine.kt
index fb9ac8c05..99d2381 100644
--- a/compose/foundation/foundation-layout/src/commonMain/kotlin/androidx/compose/foundation/layout/AlignmentLine.kt
+++ b/compose/foundation/foundation-layout/src/commonMain/kotlin/androidx/compose/foundation/layout/AlignmentLine.kt
@@ -33,6 +33,7 @@
import androidx.compose.ui.unit.Constraints
import androidx.compose.ui.unit.Dp
import androidx.compose.ui.unit.TextUnit
+import androidx.compose.ui.unit.isSpecified
import androidx.compose.ui.unit.isUnspecified
import kotlin.math.max
@@ -142,14 +143,14 @@
@Stable
fun Modifier.paddingFromBaseline(top: Dp = Dp.Unspecified, bottom: Dp = Dp.Unspecified) =
this.then(
- if (top != Dp.Unspecified) {
+ if (top.isSpecified) {
Modifier.paddingFrom(FirstBaseline, before = top)
} else {
Modifier
}
)
.then(
- if (bottom != Dp.Unspecified) {
+ if (bottom.isSpecified) {
Modifier.paddingFrom(LastBaseline, after = bottom)
} else {
Modifier
@@ -192,8 +193,8 @@
) : ModifierNodeElement<AlignmentLineOffsetDpNode>() {
init {
requirePrecondition(
- (before.value >= 0f || before == Dp.Unspecified) &&
- (after.value >= 0f || after == Dp.Unspecified)
+ (before.value >= 0f || before.isUnspecified) and
+ (after.value >= 0f || after.isUnspecified)
) {
"Padding from alignment line must be a non-negative number"
}
@@ -319,12 +320,12 @@
val axisMax = if (alignmentLine.horizontal) constraints.maxHeight else constraints.maxWidth
// Compute padding required to satisfy the total before and after offsets.
val paddingBefore =
- ((if (before != Dp.Unspecified) before.roundToPx() else 0) - linePosition).coerceIn(
+ ((if (before.isSpecified) before.roundToPx() else 0) - linePosition).coerceIn(
0,
axisMax - axis
)
val paddingAfter =
- ((if (after != Dp.Unspecified) after.roundToPx() else 0) - axis + linePosition).coerceIn(
+ ((if (after.isSpecified) after.roundToPx() else 0) - axis + linePosition).coerceIn(
0,
axisMax - axis - paddingBefore
)
diff --git a/compose/foundation/foundation-layout/src/commonMain/kotlin/androidx/compose/foundation/layout/FlowLayout.kt b/compose/foundation/foundation-layout/src/commonMain/kotlin/androidx/compose/foundation/layout/FlowLayout.kt
index 05f1276..8417dd1 100644
--- a/compose/foundation/foundation-layout/src/commonMain/kotlin/androidx/compose/foundation/layout/FlowLayout.kt
+++ b/compose/foundation/foundation-layout/src/commonMain/kotlin/androidx/compose/foundation/layout/FlowLayout.kt
@@ -788,8 +788,8 @@
) =
minIntrinsicMainAxisSize(
measurables,
- mainAxisSize = minMainAxisIntrinsicItemSize,
- crossAxisSize = minCrossAxisIntrinsicItemSize,
+ mainAxisSize = { _, size -> minMainAxisIntrinsicItemSize(size) },
+ crossAxisSize = { _, size -> minCrossAxisIntrinsicItemSize(size) },
crossAxisAvailable,
mainAxisSpacing,
crossAxisSpacing,
@@ -805,7 +805,7 @@
) =
maxIntrinsicMainAxisSize(
measurables,
- maxMainAxisIntrinsicItemSize,
+ { _, size -> maxMainAxisIntrinsicItemSize(size) },
height,
arrangementSpacing,
maxItemsInMainAxis
@@ -822,8 +822,8 @@
) =
intrinsicCrossAxisSize(
measurables,
- mainAxisSize = minMainAxisIntrinsicItemSize,
- crossAxisSize = minCrossAxisIntrinsicItemSize,
+ mainAxisSize = { _, size -> minMainAxisIntrinsicItemSize(size) },
+ crossAxisSize = { _, size -> minCrossAxisIntrinsicItemSize(size) },
mainAxisAvailable,
mainAxisSpacing,
crossAxisSpacing,
@@ -833,20 +833,17 @@
)
.first
- val maxMainAxisIntrinsicItemSize: IntrinsicMeasurable.(Int, Int) -> Int =
- if (isHorizontal) { _, h -> maxIntrinsicWidth(h) } else { _, w -> maxIntrinsicHeight(w) }
+ fun IntrinsicMeasurable.maxMainAxisIntrinsicItemSize(size: Int): Int =
+ if (isHorizontal) maxIntrinsicWidth(size) else maxIntrinsicHeight(size)
- val maxCrossAxisIntrinsicItemSize: IntrinsicMeasurable.(Int, Int) -> Int =
- if (isHorizontal) { _, w -> maxIntrinsicHeight(w) } else { _, h -> maxIntrinsicWidth(h) }
+ fun IntrinsicMeasurable.minCrossAxisIntrinsicItemSize(size: Int): Int =
+ if (isHorizontal) minIntrinsicHeight(size) else minIntrinsicWidth(size)
- val minCrossAxisIntrinsicItemSize: IntrinsicMeasurable.(Int, Int) -> Int =
- if (isHorizontal) { _, w -> minIntrinsicHeight(w) } else { _, h -> minIntrinsicWidth(h) }
-
- val minMainAxisIntrinsicItemSize: IntrinsicMeasurable.(Int, Int) -> Int =
- if (isHorizontal) { _, h -> minIntrinsicWidth(h) } else { _, w -> minIntrinsicHeight(w) }
+ fun IntrinsicMeasurable.minMainAxisIntrinsicItemSize(size: Int): Int =
+ if (isHorizontal) minIntrinsicWidth(size) else minIntrinsicHeight(size)
}
-private fun maxIntrinsicMainAxisSize(
+private inline fun maxIntrinsicMainAxisSize(
children: List<IntrinsicMeasurable>,
mainAxisSize: IntrinsicMeasurable.(Int, Int) -> Int,
crossAxisAvailable: Int,
@@ -875,8 +872,9 @@
* Slower algorithm but needed to determine the minimum main axis size Uses a binary search to
* search different scenarios to see the minimum main axis size
*/
+@Suppress("BanInlineOptIn")
@OptIn(ExperimentalLayoutApi::class)
-private fun minIntrinsicMainAxisSize(
+private inline fun minIntrinsicMainAxisSize(
children: List<IntrinsicMeasurable>,
mainAxisSize: IntrinsicMeasurable.(Int, Int) -> Int,
crossAxisSize: IntrinsicMeasurable.(Int, Int) -> Int,
@@ -994,7 +992,7 @@
* FlowRow: Intrinsic height (cross Axis) is based on a specified width
* * FlowColumn: Intrinsic width (crossAxis) based on a specified height
*/
-private fun intrinsicCrossAxisSize(
+private inline fun intrinsicCrossAxisSize(
children: List<IntrinsicMeasurable>,
mainAxisSize: IntrinsicMeasurable.(Int, Int) -> Int,
crossAxisSize: IntrinsicMeasurable.(Int, Int) -> Int,
diff --git a/compose/foundation/foundation-layout/src/commonMain/kotlin/androidx/compose/foundation/layout/Padding.kt b/compose/foundation/foundation-layout/src/commonMain/kotlin/androidx/compose/foundation/layout/Padding.kt
index 24ac686..c038279 100644
--- a/compose/foundation/foundation-layout/src/commonMain/kotlin/androidx/compose/foundation/layout/Padding.kt
+++ b/compose/foundation/foundation-layout/src/commonMain/kotlin/androidx/compose/foundation/layout/Padding.kt
@@ -33,6 +33,7 @@
import androidx.compose.ui.unit.constrainHeight
import androidx.compose.ui.unit.constrainWidth
import androidx.compose.ui.unit.dp
+import androidx.compose.ui.unit.isUnspecified
import androidx.compose.ui.unit.offset
/**
@@ -203,10 +204,14 @@
) : PaddingValues {
init {
- requirePrecondition(left.value >= 0) { "Left padding must be non-negative" }
- requirePrecondition(top.value >= 0) { "Top padding must be non-negative" }
- requirePrecondition(right.value >= 0) { "Right padding must be non-negative" }
- requirePrecondition(bottom.value >= 0) { "Bottom padding must be non-negative" }
+ requirePrecondition(
+ (left.value >= 0f) and
+ (top.value >= 0f) and
+ (right.value >= 0f) and
+ (bottom.value >= 0f)
+ ) {
+ "Padding must be non-negative"
+ }
}
override fun calculateLeftPadding(layoutDirection: LayoutDirection) = left
@@ -291,10 +296,11 @@
) : PaddingValues {
init {
- requirePrecondition(start.value >= 0) { "Start padding must be non-negative" }
- requirePrecondition(top.value >= 0) { "Top padding must be non-negative" }
- requirePrecondition(end.value >= 0) { "End padding must be non-negative" }
- requirePrecondition(bottom.value >= 0) { "Bottom padding must be non-negative" }
+ requirePrecondition(
+ (start.value >= 0f) and (top.value >= 0f) and (end.value >= 0f) and (bottom.value >= 0f)
+ ) {
+ "Padding must be non-negative"
+ }
}
override fun calculateLeftPadding(layoutDirection: LayoutDirection) =
@@ -332,10 +338,10 @@
init {
requirePrecondition(
- (start.value >= 0f || start == Dp.Unspecified) &&
- (top.value >= 0f || top == Dp.Unspecified) &&
- (end.value >= 0f || end == Dp.Unspecified) &&
- (bottom.value >= 0f || bottom == Dp.Unspecified)
+ (start.value >= 0f || start.isUnspecified) and
+ (top.value >= 0f || top.isUnspecified) and
+ (end.value >= 0f || end.isUnspecified) and
+ (bottom.value >= 0f || bottom.isUnspecified)
) {
"Padding must be non-negative"
}
@@ -436,30 +442,30 @@
measurable: Measurable,
constraints: Constraints
): MeasureResult {
+ val leftPadding = paddingValues.calculateLeftPadding(layoutDirection)
+ val topPadding = paddingValues.calculateTopPadding()
+ val rightPadding = paddingValues.calculateRightPadding(layoutDirection)
+ val bottomPadding = paddingValues.calculateBottomPadding()
+
requirePrecondition(
- paddingValues.calculateLeftPadding(layoutDirection) >= 0.dp &&
- paddingValues.calculateTopPadding() >= 0.dp &&
- paddingValues.calculateRightPadding(layoutDirection) >= 0.dp &&
- paddingValues.calculateBottomPadding() >= 0.dp
+ (leftPadding >= 0.dp) and
+ (topPadding >= 0.dp) and
+ (rightPadding >= 0.dp) and
+ (bottomPadding >= 0.dp)
) {
"Padding must be non-negative"
}
- val horizontal =
- paddingValues.calculateLeftPadding(layoutDirection).roundToPx() +
- paddingValues.calculateRightPadding(layoutDirection).roundToPx()
- val vertical =
- paddingValues.calculateTopPadding().roundToPx() +
- paddingValues.calculateBottomPadding().roundToPx()
+
+ val roundedLeftPadding = leftPadding.roundToPx()
+ val horizontal = roundedLeftPadding + rightPadding.roundToPx()
+
+ val roundedTopPadding = topPadding.roundToPx()
+ val vertical = roundedTopPadding + bottomPadding.roundToPx()
val placeable = measurable.measure(constraints.offset(-horizontal, -vertical))
val width = constraints.constrainWidth(placeable.width + horizontal)
val height = constraints.constrainHeight(placeable.height + vertical)
- return layout(width, height) {
- placeable.place(
- paddingValues.calculateLeftPadding(layoutDirection).roundToPx(),
- paddingValues.calculateTopPadding().roundToPx()
- )
- }
+ return layout(width, height) { placeable.place(roundedLeftPadding, roundedTopPadding) }
}
}
diff --git a/compose/foundation/foundation-layout/src/commonMain/kotlin/androidx/compose/foundation/layout/Size.kt b/compose/foundation/foundation-layout/src/commonMain/kotlin/androidx/compose/foundation/layout/Size.kt
index b221c8b..52e00de 100644
--- a/compose/foundation/foundation-layout/src/commonMain/kotlin/androidx/compose/foundation/layout/Size.kt
+++ b/compose/foundation/foundation-layout/src/commonMain/kotlin/androidx/compose/foundation/layout/Size.kt
@@ -39,6 +39,10 @@
import androidx.compose.ui.unit.constrain
import androidx.compose.ui.unit.constrainHeight
import androidx.compose.ui.unit.constrainWidth
+import androidx.compose.ui.unit.isSpecified
+import androidx.compose.ui.util.fastCoerceAtLeast
+import androidx.compose.ui.util.fastCoerceAtMost
+import androidx.compose.ui.util.fastCoerceIn
import androidx.compose.ui.util.fastRoundToInt
/**
@@ -694,7 +698,7 @@
val width =
(constraints.maxWidth * fraction)
.fastRoundToInt()
- .coerceIn(constraints.minWidth, constraints.maxWidth)
+ .fastCoerceIn(constraints.minWidth, constraints.maxWidth)
minWidth = width
maxWidth = width
} else {
@@ -707,7 +711,7 @@
val height =
(constraints.maxHeight * fraction)
.fastRoundToInt()
- .coerceIn(constraints.minHeight, constraints.maxHeight)
+ .fastCoerceIn(constraints.minHeight, constraints.maxHeight)
minHeight = height
maxHeight = height
} else {
@@ -782,28 +786,28 @@
private val Density.targetConstraints: Constraints
get() {
val maxWidth =
- if (maxWidth != Dp.Unspecified) {
- maxWidth.roundToPx().coerceAtLeast(0)
+ if (maxWidth.isSpecified) {
+ maxWidth.roundToPx().fastCoerceAtLeast(0)
} else {
Constraints.Infinity
}
val maxHeight =
- if (maxHeight != Dp.Unspecified) {
- maxHeight.roundToPx().coerceAtLeast(0)
+ if (maxHeight.isSpecified) {
+ maxHeight.roundToPx().fastCoerceAtLeast(0)
} else {
Constraints.Infinity
}
val minWidth =
- if (minWidth != Dp.Unspecified) {
- minWidth.roundToPx().coerceAtMost(maxWidth).coerceAtLeast(0).let {
+ if (minWidth.isSpecified) {
+ minWidth.roundToPx().fastCoerceIn(0, maxWidth).let {
if (it != Constraints.Infinity) it else 0
}
} else {
0
}
val minHeight =
- if (minHeight != Dp.Unspecified) {
- minHeight.roundToPx().coerceAtMost(maxHeight).coerceAtLeast(0).let {
+ if (minHeight.isSpecified) {
+ minHeight.roundToPx().fastCoerceIn(0, maxHeight).let {
if (it != Constraints.Infinity) it else 0
}
} else {
@@ -827,28 +831,28 @@
constraints.constrain(targetConstraints)
} else {
val resolvedMinWidth =
- if (minWidth != Dp.Unspecified) {
+ if (minWidth.isSpecified) {
targetConstraints.minWidth
} else {
- constraints.minWidth.coerceAtMost(targetConstraints.maxWidth)
+ constraints.minWidth.fastCoerceAtMost(targetConstraints.maxWidth)
}
val resolvedMaxWidth =
- if (maxWidth != Dp.Unspecified) {
+ if (maxWidth.isSpecified) {
targetConstraints.maxWidth
} else {
- constraints.maxWidth.coerceAtLeast(targetConstraints.minWidth)
+ constraints.maxWidth.fastCoerceAtLeast(targetConstraints.minWidth)
}
val resolvedMinHeight =
- if (minHeight != Dp.Unspecified) {
+ if (minHeight.isSpecified) {
targetConstraints.minHeight
} else {
- constraints.minHeight.coerceAtMost(targetConstraints.maxHeight)
+ constraints.minHeight.fastCoerceAtMost(targetConstraints.maxHeight)
}
val resolvedMaxHeight =
- if (maxHeight != Dp.Unspecified) {
+ if (maxHeight.isSpecified) {
targetConstraints.maxHeight
} else {
- constraints.maxHeight.coerceAtLeast(targetConstraints.minHeight)
+ constraints.maxHeight.fastCoerceAtLeast(targetConstraints.minHeight)
}
Constraints(
resolvedMinWidth,
@@ -1072,14 +1076,14 @@
): MeasureResult {
val wrappedConstraints =
Constraints(
- if (minWidth != Dp.Unspecified && constraints.minWidth == 0) {
- minWidth.roundToPx().coerceAtMost(constraints.maxWidth).coerceAtLeast(0)
+ if (minWidth.isSpecified && constraints.minWidth == 0) {
+ minWidth.roundToPx().fastCoerceIn(0, constraints.maxWidth)
} else {
constraints.minWidth
},
constraints.maxWidth,
- if (minHeight != Dp.Unspecified && constraints.minHeight == 0) {
- minHeight.roundToPx().coerceAtMost(constraints.maxHeight).coerceAtLeast(0)
+ if (minHeight.isSpecified && constraints.minHeight == 0) {
+ minHeight.roundToPx().fastCoerceIn(0, constraints.maxHeight)
} else {
constraints.minHeight
},
@@ -1095,7 +1099,7 @@
) =
measurable
.minIntrinsicWidth(height)
- .coerceAtLeast(if (minWidth != Dp.Unspecified) minWidth.roundToPx() else 0)
+ .fastCoerceAtLeast(if (minWidth.isSpecified) minWidth.roundToPx() else 0)
override fun IntrinsicMeasureScope.maxIntrinsicWidth(
measurable: IntrinsicMeasurable,
@@ -1103,7 +1107,7 @@
) =
measurable
.maxIntrinsicWidth(height)
- .coerceAtLeast(if (minWidth != Dp.Unspecified) minWidth.roundToPx() else 0)
+ .fastCoerceAtLeast(if (minWidth.isSpecified) minWidth.roundToPx() else 0)
override fun IntrinsicMeasureScope.minIntrinsicHeight(
measurable: IntrinsicMeasurable,
@@ -1111,7 +1115,7 @@
) =
measurable
.minIntrinsicHeight(width)
- .coerceAtLeast(if (minHeight != Dp.Unspecified) minHeight.roundToPx() else 0)
+ .fastCoerceAtLeast(if (minHeight.isSpecified) minHeight.roundToPx() else 0)
override fun IntrinsicMeasureScope.maxIntrinsicHeight(
measurable: IntrinsicMeasurable,
@@ -1119,7 +1123,7 @@
) =
measurable
.maxIntrinsicHeight(width)
- .coerceAtLeast(if (minHeight != Dp.Unspecified) minHeight.roundToPx() else 0)
+ .fastCoerceAtLeast(if (minHeight.isSpecified) minHeight.roundToPx() else 0)
}
internal enum class Direction {
diff --git a/compose/foundation/foundation/build.gradle b/compose/foundation/foundation/build.gradle
index 0d84d31..91a0069 100644
--- a/compose/foundation/foundation/build.gradle
+++ b/compose/foundation/foundation/build.gradle
@@ -50,6 +50,7 @@
implementation(project(":compose:ui:ui-text"))
implementation(project(":compose:ui:ui-util"))
implementation(project(":compose:foundation:foundation-layout"))
+ implementation(project(":performance:performance-annotation"))
}
}
@@ -80,12 +81,16 @@
dependsOn(commonMain)
}
- jvmStubsMain {
+ nonAndroidStubsMain {
dependsOn(commonStubsMain)
}
+ jvmStubsMain {
+ dependsOn(nonAndroidStubsMain)
+ }
+
linuxx64StubsMain {
- dependsOn(commonStubsMain)
+ dependsOn(nonAndroidStubsMain)
}
androidInstrumentedTest {
diff --git a/compose/foundation/foundation/proguard-rules.pro b/compose/foundation/foundation/proguard-rules.pro
index 4039ea4..2d14261 100644
--- a/compose/foundation/foundation/proguard-rules.pro
+++ b/compose/foundation/foundation/proguard-rules.pro
@@ -20,3 +20,7 @@
# For methods returning Nothing
static java.lang.Void throw*Exception(...);
}
+
+-keepclassmembers class * {
+ @dalvik.annotation.optimization.NeverInline *;
+}
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 7a034224..7c73fa8 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
@@ -443,44 +443,28 @@
measurable: IntrinsicMeasurable,
height: Int
): Int {
- return if (isVertical) {
- measurable.minIntrinsicWidth(Constraints.Infinity)
- } else {
- measurable.minIntrinsicWidth(height)
- }
+ return measurable.minIntrinsicWidth(if (isVertical) Constraints.Infinity else height)
}
override fun IntrinsicMeasureScope.minIntrinsicHeight(
measurable: IntrinsicMeasurable,
width: Int
): Int {
- return if (isVertical) {
- measurable.minIntrinsicHeight(width)
- } else {
- measurable.minIntrinsicHeight(Constraints.Infinity)
- }
+ return measurable.minIntrinsicHeight(if (isVertical) width else Constraints.Infinity)
}
override fun IntrinsicMeasureScope.maxIntrinsicWidth(
measurable: IntrinsicMeasurable,
height: Int
): Int {
- return if (isVertical) {
- measurable.maxIntrinsicWidth(Constraints.Infinity)
- } else {
- measurable.maxIntrinsicWidth(height)
- }
+ return measurable.maxIntrinsicWidth(if (isVertical) Constraints.Infinity else height)
}
override fun IntrinsicMeasureScope.maxIntrinsicHeight(
measurable: IntrinsicMeasurable,
width: Int
): Int {
- return if (isVertical) {
- measurable.maxIntrinsicHeight(width)
- } else {
- measurable.maxIntrinsicHeight(Constraints.Infinity)
- }
+ return measurable.maxIntrinsicHeight(if (isVertical) width else Constraints.Infinity)
}
override fun SemanticsPropertyReceiver.applySemantics() {
diff --git a/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/gestures/AnchoredDraggable.kt b/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/gestures/AnchoredDraggable.kt
index dd3ef0b..db0c790 100644
--- a/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/gestures/AnchoredDraggable.kt
+++ b/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/gestures/AnchoredDraggable.kt
@@ -62,6 +62,7 @@
import androidx.compose.ui.unit.LayoutDirection
import androidx.compose.ui.unit.Velocity
import androidx.compose.ui.unit.dp
+import dalvik.annotation.optimization.NeverInline
import kotlin.math.abs
import kotlin.math.max
import kotlin.math.min
@@ -632,6 +633,7 @@
positions[keys.size - 1] = position
}
+ @NeverInline
internal fun buildPositions(): FloatArray {
// We might have expanded more than we actually need, so trim the array
return positions.copyOfRange(
@@ -643,6 +645,7 @@
internal fun buildKeys(): List<T> = keys
+ @NeverInline
private fun expandPositions() {
positions = positions.copyOf(keys.size + 2)
}
@@ -1650,7 +1653,7 @@
}
}
-internal expect inline fun assertOnJvm(statement: Boolean, message: () -> String): Unit
+internal expect inline fun assertOnJvm(statement: Boolean, message: () -> String)
internal val AnchoredDraggableMinFlingVelocity = 125.dp
diff --git a/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/internal/InlineClassHelper.kt b/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/internal/InlineClassHelper.kt
index 4af862a..686d885 100644
--- a/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/internal/InlineClassHelper.kt
+++ b/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/internal/InlineClassHelper.kt
@@ -53,7 +53,7 @@
}
}
-@Suppress("NOTHING_TO_INLINE", "BanInlineOptIn")
+@Suppress("NOTHING_TO_INLINE", "BanInlineOptIn", "KotlinRedundantDiagnosticSuppress")
@OptIn(ExperimentalContracts::class)
internal inline fun checkPrecondition(value: Boolean) {
contract { returns() implies value }
diff --git a/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/text/input/internal/OffsetMappingCalculator.kt b/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/text/input/internal/OffsetMappingCalculator.kt
index b6fb607..eaa2856 100644
--- a/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/text/input/internal/OffsetMappingCalculator.kt
+++ b/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/text/input/internal/OffsetMappingCalculator.kt
@@ -370,18 +370,18 @@
*/
@kotlin.jvm.JvmInline
private value class OpArray private constructor(private val values: IntArray) {
- constructor(size: Int) : this(IntArray(size * ElementSize))
+ constructor(size: Int) : this(IntArray(size * OpArrayElementSize))
val size: Int
- get() = values.size / ElementSize
+ get() = values.size / OpArrayElementSize
fun set(index: Int, offset: Int, srcLen: Int, destLen: Int) {
- values[index * ElementSize] = offset
- values[index * ElementSize + 1] = srcLen
- values[index * ElementSize + 2] = destLen
+ values[index * OpArrayElementSize] = offset
+ values[index * OpArrayElementSize + 1] = srcLen
+ values[index * OpArrayElementSize + 2] = destLen
}
- fun copyOf(newSize: Int) = OpArray(values.copyOf(newSize * ElementSize))
+ fun copyOf(newSize: Int) = OpArray(values.copyOf(newSize * OpArrayElementSize))
/**
* Loops through the array between 0 and [max] (exclusive). If [reversed] is false (the
@@ -399,22 +399,20 @@
// duplication here keeps the more complicated logic at the callsite more readable.
if (reversed) {
for (i in max - 1 downTo 0) {
- val offset = values[i * ElementSize]
- val srcLen = values[i * ElementSize + 1]
- val destLen = values[i * ElementSize + 2]
+ val offset = values[i * OpArrayElementSize]
+ val srcLen = values[i * OpArrayElementSize + 1]
+ val destLen = values[i * OpArrayElementSize + 2]
block(offset, srcLen, destLen)
}
} else {
for (i in 0 until max) {
- val offset = values[i * ElementSize]
- val srcLen = values[i * ElementSize + 1]
- val destLen = values[i * ElementSize + 2]
+ val offset = values[i * OpArrayElementSize]
+ val srcLen = values[i * OpArrayElementSize + 1]
+ val destLen = values[i * OpArrayElementSize + 2]
block(offset, srcLen, destLen)
}
}
}
-
- private companion object {
- const val ElementSize = 3
- }
}
+
+private const val OpArrayElementSize = 3
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 81b56b6..c6894c5 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
@@ -68,6 +68,11 @@
val ParentDataModifier = Name(PackageName, "ParentDataModifier")
}
+ object Platform {
+ val PackageName = Package(Ui.PackageName, "platform")
+ val LocalConfiguration = Name(PackageName, "LocalConfiguration")
+ }
+
object Pointer {
val PackageName = Package(Ui.PackageName, "input.pointer")
val PointerInputScope = Name(PackageName, "PointerInputScope")
diff --git a/compose/material/material-navigation/build.gradle b/compose/material/material-navigation/build.gradle
index 7f8be4a..a80dfb7 100644
--- a/compose/material/material-navigation/build.gradle
+++ b/compose/material/material-navigation/build.gradle
@@ -34,6 +34,7 @@
androidTestImplementation(project(":compose:test-utils"))
androidTestImplementation("androidx.navigation:navigation-testing:2.7.7")
androidTestImplementation(project(":compose:ui:ui-test-junit4"))
+ androidTestImplementation(project(":compose:ui:ui-test-manifest"))
androidTestImplementation(libs.testRunner)
androidTestImplementation(libs.junit)
androidTestImplementation(libs.truth)
diff --git a/compose/material/material/src/commonMain/kotlin/androidx/compose/material/SnackbarHost.kt b/compose/material/material/src/commonMain/kotlin/androidx/compose/material/SnackbarHost.kt
index 36afe64..864ea49 100644
--- a/compose/material/material/src/commonMain/kotlin/androidx/compose/material/SnackbarHost.kt
+++ b/compose/material/material/src/commonMain/kotlin/androidx/compose/material/SnackbarHost.kt
@@ -298,7 +298,9 @@
alpha = opacity.value
)
.semantics {
- liveRegion = LiveRegionMode.Polite
+ if (isVisible) {
+ liveRegion = LiveRegionMode.Polite
+ }
paneTitle = a11yPaneTitle
dismiss {
key.dismiss()
diff --git a/compose/material3/material3/src/androidInstrumentedTest/kotlin/androidx/compose/material3/BadgeTest.kt b/compose/material3/material3/src/androidInstrumentedTest/kotlin/androidx/compose/material3/BadgeTest.kt
index b8c527d..43717c5 100644
--- a/compose/material3/material3/src/androidInstrumentedTest/kotlin/androidx/compose/material3/BadgeTest.kt
+++ b/compose/material3/material3/src/androidInstrumentedTest/kotlin/androidx/compose/material3/BadgeTest.kt
@@ -133,6 +133,7 @@
}
@Test
+ @SdkSuppress(maxSdkVersion = 34) // b/384973010: Failing on SDK 35
fun badgeBox_shortContent_position() {
rule.setMaterialContent(lightColorScheme()) {
BadgedBox(badge = { Badge { Text("8") } }) {
diff --git a/compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/SnackbarHost.kt b/compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/SnackbarHost.kt
index 38b6762..dd8b7ad 100644
--- a/compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/SnackbarHost.kt
+++ b/compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/SnackbarHost.kt
@@ -363,7 +363,9 @@
alpha = opacity.value
)
.semantics {
- liveRegion = LiveRegionMode.Polite
+ if (isVisible) {
+ liveRegion = LiveRegionMode.Polite
+ }
dismiss {
key.dismiss()
true
diff --git a/compose/runtime/runtime/build.gradle b/compose/runtime/runtime/build.gradle
index bbff188..1406001 100644
--- a/compose/runtime/runtime/build.gradle
+++ b/compose/runtime/runtime/build.gradle
@@ -46,6 +46,7 @@
implementation(libs.kotlinStdlibCommon)
implementation(libs.kotlinCoroutinesCore)
implementation(project(":collection:collection"))
+ implementation(project(":performance:performance-annotation"))
}
}
diff --git a/compose/runtime/runtime/proguard-rules.pro b/compose/runtime/runtime/proguard-rules.pro
index 8e1c21e..400440d 100644
--- a/compose/runtime/runtime/proguard-rules.pro
+++ b/compose/runtime/runtime/proguard-rules.pro
@@ -31,3 +31,7 @@
static void compose*RuntimeError(...);
static java.lang.Void compose*RuntimeError(...);
}
+
+-keepclassmembers class * {
+ @dalvik.annotation.optimization.NeverInline *;
+}
diff --git a/compose/runtime/runtime/src/androidMain/kotlin/androidx/compose/runtime/collection/ArrayUtils.android.kt b/compose/runtime/runtime/src/androidMain/kotlin/androidx/compose/runtime/collection/ArrayUtils.android.kt
new file mode 100644
index 0000000..c487bdc
--- /dev/null
+++ b/compose/runtime/runtime/src/androidMain/kotlin/androidx/compose/runtime/collection/ArrayUtils.android.kt
@@ -0,0 +1,29 @@
+/*
+ * Copyright 2024 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT 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("NOTHING_TO_INLINE", "KotlinRedundantDiagnosticSuppress")
+
+package androidx.compose.runtime.collection
+
+internal actual inline fun <T> Array<out T>.fastCopyInto(
+ destination: Array<T>,
+ destinationOffset: Int,
+ startIndex: Int,
+ endIndex: Int
+): Array<T> {
+ System.arraycopy(this, startIndex, destination, destinationOffset, endIndex - startIndex)
+ return destination
+}
diff --git a/compose/runtime/runtime/src/commonMain/kotlin/androidx/compose/runtime/SlotTable.kt b/compose/runtime/runtime/src/commonMain/kotlin/androidx/compose/runtime/SlotTable.kt
index a295937..afd4db85 100644
--- a/compose/runtime/runtime/src/commonMain/kotlin/androidx/compose/runtime/SlotTable.kt
+++ b/compose/runtime/runtime/src/commonMain/kotlin/androidx/compose/runtime/SlotTable.kt
@@ -23,6 +23,7 @@
import androidx.collection.MutableIntSet
import androidx.collection.MutableObjectList
import androidx.collection.mutableIntListOf
+import androidx.compose.runtime.collection.fastCopyInto
import androidx.compose.runtime.platform.makeSynchronizedObject
import androidx.compose.runtime.platform.synchronized
import androidx.compose.runtime.snapshots.fastAny
@@ -2122,7 +2123,7 @@
// 4) copy the slots to their new location
if (moveDataLen > 0) {
val slots = slots
- slots.copyInto(
+ slots.fastCopyInto(
destination = slots,
destinationOffset = destinationSlot,
startIndex = dataIndexToDataAddress(dataStart + moveDataLen),
@@ -2206,7 +2207,7 @@
)
val slots = toWriter.slots
val currentSlot = toWriter.currentSlot
- fromWriter.slots.copyInto(
+ fromWriter.slots.fastCopyInto(
destination = slots,
destinationOffset = currentSlot,
startIndex = sourceSlotsStart,
@@ -2676,7 +2677,7 @@
val slots = slots
if (index < gapStart) {
// move the gap down to index by shifting the data up.
- slots.copyInto(
+ slots.fastCopyInto(
destination = slots,
destinationOffset = index + gapLen,
startIndex = index,
@@ -2684,7 +2685,7 @@
)
} else {
// Shift the data down, leaving the gap at index
- slots.copyInto(
+ slots.fastCopyInto(
destination = slots,
destinationOffset = gapStart,
startIndex = gapStart + gapLen,
@@ -2830,13 +2831,13 @@
val newGapEndAddress = gapStart + newGapLen
// Copy the old arrays into the new arrays
- slots.copyInto(
+ slots.fastCopyInto(
destination = newData,
destinationOffset = 0,
startIndex = 0,
endIndex = gapStart
)
- slots.copyInto(
+ slots.fastCopyInto(
destination = newData,
destinationOffset = newGapEndAddress,
startIndex = oldGapEndAddress,
diff --git a/compose/runtime/runtime/src/commonMain/kotlin/androidx/compose/runtime/Stack.kt b/compose/runtime/runtime/src/commonMain/kotlin/androidx/compose/runtime/Stack.kt
index 03989dd..c2e25cd 100644
--- a/compose/runtime/runtime/src/commonMain/kotlin/androidx/compose/runtime/Stack.kt
+++ b/compose/runtime/runtime/src/commonMain/kotlin/androidx/compose/runtime/Stack.kt
@@ -14,9 +14,13 @@
* limitations under the License.
*/
+@file:Suppress("NOTHING_TO_INLINE", "KotlinRedundantDiagnosticSuppress")
+
package androidx.compose.runtime
+import kotlin.jvm.JvmField
import kotlin.jvm.JvmInline
+import kotlin.math.min
@JvmInline
internal value class Stack<T>(private val backing: ArrayList<T> = ArrayList()) {
@@ -42,22 +46,33 @@
}
internal class IntStack {
- private var slots = IntArray(10)
- private var tos = 0
+ @JvmField internal var slots = IntArray(10)
+ @JvmField internal var tos = 0
- val size: Int
+ inline val size: Int
get() = tos
+ @dalvik.annotation.optimization.NeverInline
+ private fun resize(): IntArray {
+ val copy = slots.copyOf(slots.size * 2)
+ slots = copy
+ return copy
+ }
+
fun push(value: Int) {
+ var slots = slots
if (tos >= slots.size) {
- slots = slots.copyOf(slots.size * 2)
+ slots = resize()
}
slots[tos++] = value
}
fun pop(): Int = slots[--tos]
- fun peekOr(default: Int): Int = if (tos > 0) peek() else default
+ fun peekOr(default: Int): Int {
+ val index = tos - 1
+ return if (index >= 0) slots[index] else default
+ }
fun peek() = slots[tos - 1]
@@ -65,16 +80,20 @@
fun peek(index: Int) = slots[index]
- fun isEmpty() = tos == 0
+ inline fun isEmpty() = tos == 0
- fun isNotEmpty() = tos != 0
+ inline fun isNotEmpty() = tos != 0
fun clear() {
tos = 0
}
fun indexOf(value: Int): Int {
- for (i in 0 until tos) if (slots[i] == value) return i
+ val slots = slots
+ val end = min(slots.size, tos)
+ for (i in 0 until end) {
+ if (slots[i] == value) return i
+ }
return -1
}
}
diff --git a/compose/runtime/runtime/src/commonMain/kotlin/androidx/compose/runtime/changelist/Operations.kt b/compose/runtime/runtime/src/commonMain/kotlin/androidx/compose/runtime/changelist/Operations.kt
index f250bc8..6a1339b 100644
--- a/compose/runtime/runtime/src/commonMain/kotlin/androidx/compose/runtime/changelist/Operations.kt
+++ b/compose/runtime/runtime/src/commonMain/kotlin/androidx/compose/runtime/changelist/Operations.kt
@@ -24,8 +24,10 @@
import androidx.compose.runtime.RememberManager
import androidx.compose.runtime.SlotWriter
import androidx.compose.runtime.changelist.Operation.ObjectParameter
+import androidx.compose.runtime.collection.fastCopyInto
import androidx.compose.runtime.debugRuntimeCheck
import androidx.compose.runtime.requirePrecondition
+import dalvik.annotation.optimization.NeverInline
import kotlin.contracts.ExperimentalContracts
import kotlin.contracts.InvocationKind.EXACTLY_ONCE
import kotlin.contracts.contract
@@ -133,11 +135,12 @@
return (currentSize + resizeAmount).coerceAtLeast(requiredSize)
}
+ @NeverInline
private fun resizeOpCodes() {
val resizeAmount = opCodesSize.coerceAtMost(OperationsMaxResizeAmount)
@Suppress("UNCHECKED_CAST")
val newOpCodes = arrayOfNulls<Operation>(opCodesSize + resizeAmount) as Array<Operation>
- opCodes = opCodes.copyInto(newOpCodes, 0, 0, opCodesSize)
+ opCodes = opCodes.fastCopyInto(newOpCodes, 0, 0, opCodesSize)
}
private inline fun ensureIntArgsSizeAtLeast(requiredSize: Int) {
@@ -147,6 +150,7 @@
}
}
+ @NeverInline
private fun resizeIntArgs(currentSize: Int, requiredSize: Int) {
val newIntArgs = IntArray(determineNewSize(currentSize, requiredSize))
intArgs.copyInto(newIntArgs, 0, 0, currentSize)
@@ -160,9 +164,10 @@
}
}
+ @NeverInline
private fun resizeObjectArgs(currentSize: Int, requiredSize: Int) {
val newObjectArgs = arrayOfNulls<Any>(determineNewSize(currentSize, requiredSize))
- objectArgs.copyInto(newObjectArgs, 0, 0, currentSize)
+ objectArgs.fastCopyInto(newObjectArgs, 0, 0, currentSize)
objectArgs = newObjectArgs
}
@@ -291,7 +296,7 @@
other.pushOp(op)
// Move the objects then null out our contents
- objectArgs.copyInto(
+ objectArgs.fastCopyInto(
destination = other.objectArgs,
destinationOffset = other.objectArgsSize - op.objects,
startIndex = objectArgsSize - op.objects,
diff --git a/compose/runtime/runtime/src/commonMain/kotlin/androidx/compose/runtime/collection/ArrayUtils.kt b/compose/runtime/runtime/src/commonMain/kotlin/androidx/compose/runtime/collection/ArrayUtils.kt
new file mode 100644
index 0000000..03c2546
--- /dev/null
+++ b/compose/runtime/runtime/src/commonMain/kotlin/androidx/compose/runtime/collection/ArrayUtils.kt
@@ -0,0 +1,28 @@
+/*
+ * Copyright 2024 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT 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.collection
+
+/**
+ * Equivalent of Array.copyInto() with an implementation designed to avoid unnecessary null checks
+ * and exception throws on Android after inlining.
+ */
+internal expect fun <T> Array<out T>.fastCopyInto(
+ destination: Array<T>,
+ destinationOffset: Int,
+ startIndex: Int,
+ endIndex: Int
+): Array<T>
diff --git a/compose/runtime/runtime/src/commonMain/kotlin/androidx/compose/runtime/collection/MutableVector.kt b/compose/runtime/runtime/src/commonMain/kotlin/androidx/compose/runtime/collection/MutableVector.kt
index 1315b32..8144a7b 100644
--- a/compose/runtime/runtime/src/commonMain/kotlin/androidx/compose/runtime/collection/MutableVector.kt
+++ b/compose/runtime/runtime/src/commonMain/kotlin/androidx/compose/runtime/collection/MutableVector.kt
@@ -18,6 +18,7 @@
package androidx.compose.runtime.collection
+import dalvik.annotation.optimization.NeverInline
import kotlin.contracts.ExperimentalContracts
import kotlin.contracts.contract
import kotlin.jvm.JvmField
@@ -66,7 +67,7 @@
ensureCapacity(size + 1)
val content = content
if (index != size) {
- content.copyInto(
+ content.fastCopyInto(
destination = content,
destinationOffset = index + 1,
startIndex = index,
@@ -83,12 +84,13 @@
*/
fun addAll(index: Int, elements: List<T>): Boolean {
if (elements.isEmpty()) return false
- ensureCapacity(size + elements.size)
+ val elementsSize = elements.size
+ ensureCapacity(size + elementsSize)
val content = content
if (index != size) {
- content.copyInto(
+ content.fastCopyInto(
destination = content,
- destinationOffset = index + elements.size,
+ destinationOffset = index + elementsSize,
startIndex = index,
endIndex = size
)
@@ -96,7 +98,7 @@
for (i in elements.indices) {
content[index + i] = elements[i]
}
- size += elements.size
+ size += elementsSize
return true
}
@@ -105,24 +107,25 @@
* that are in the way.
*/
fun addAll(index: Int, elements: MutableVector<T>): Boolean {
- if (elements.isEmpty()) return false
- ensureCapacity(size + elements.size)
+ val elementsSize = elements.size
+ if (elementsSize == 0) return false
+ ensureCapacity(size + elementsSize)
val content = content
if (index != size) {
- content.copyInto(
+ content.fastCopyInto(
destination = content,
- destinationOffset = index + elements.size,
+ destinationOffset = index + elementsSize,
startIndex = index,
endIndex = size
)
}
- elements.content.copyInto(
+ elements.content.fastCopyInto(
destination = content,
destinationOffset = index,
startIndex = 0,
- endIndex = elements.size
+ endIndex = elementsSize
)
- size += elements.size
+ size += elementsSize
return true
}
@@ -147,12 +150,13 @@
* [MutableVector] was changed.
*/
fun addAll(@Suppress("ArrayReturn") elements: Array<T>): Boolean {
- if (elements.isEmpty()) {
+ val elementsSize = elements.size
+ if (elementsSize == 0) {
return false
}
- ensureCapacity(size + elements.size)
- elements.copyInto(destination = content, destinationOffset = size)
- size += elements.size
+ ensureCapacity(size + elementsSize)
+ elements.fastCopyInto(destination = content, destinationOffset = size, 0, elementsSize)
+ size += elementsSize
return true
}
@@ -162,18 +166,19 @@
*/
fun addAll(index: Int, elements: Collection<T>): Boolean {
if (elements.isEmpty()) return false
- ensureCapacity(size + elements.size)
+ val elementsSize = elements.size
+ ensureCapacity(size + elementsSize)
val content = content
if (index != size) {
- content.copyInto(
+ content.fastCopyInto(
destination = content,
- destinationOffset = index + elements.size,
+ destinationOffset = index + elementsSize,
startIndex = index,
endIndex = size
)
}
elements.forEachIndexed { i, item -> content[index + i] = item }
- size += elements.size
+ size += elementsSize
return true
}
@@ -287,13 +292,14 @@
}
}
+ @NeverInline
@PublishedApi
internal fun resizeStorage(capacity: Int) {
val oldContent = content
val oldSize = oldContent.size
val newSize = max(capacity, oldSize * 2)
val newContent = arrayOfNulls<Any?>(newSize) as Array<T?>
- oldContent.copyInto(newContent, 0, 0, oldSize)
+ oldContent.fastCopyInto(newContent, 0, 0, oldSize)
content = newContent
}
@@ -694,7 +700,7 @@
val content = content
val item = content[index] as T
if (index != lastIndex) {
- content.copyInto(
+ content.fastCopyInto(
destination = content,
destinationOffset = index,
startIndex = index + 1,
@@ -710,7 +716,7 @@
fun removeRange(start: Int, end: Int) {
if (end > start) {
if (end < size) {
- content.copyInto(
+ content.fastCopyInto(
destination = content,
destinationOffset = start,
startIndex = end,
diff --git a/compose/runtime/runtime/src/commonMain/kotlin/androidx/compose/runtime/snapshots/SnapshotWeakSet.kt b/compose/runtime/runtime/src/commonMain/kotlin/androidx/compose/runtime/snapshots/SnapshotWeakSet.kt
index 66075f0a..e70d6fd 100644
--- a/compose/runtime/runtime/src/commonMain/kotlin/androidx/compose/runtime/snapshots/SnapshotWeakSet.kt
+++ b/compose/runtime/runtime/src/commonMain/kotlin/androidx/compose/runtime/snapshots/SnapshotWeakSet.kt
@@ -17,6 +17,7 @@
package androidx.compose.runtime.snapshots
import androidx.compose.runtime.TestOnly
+import androidx.compose.runtime.collection.fastCopyInto
import androidx.compose.runtime.internal.WeakReference
import androidx.compose.runtime.internal.identityHashCode
@@ -70,13 +71,18 @@
val newCapacity = capacity * 2
val newValues = arrayOfNulls<WeakReference<T>?>(newCapacity)
val newHashes = IntArray(newCapacity)
- values.copyInto(
+ values.fastCopyInto(
destination = newValues,
destinationOffset = insertIndex + 1,
startIndex = insertIndex,
endIndex = size
)
- values.copyInto(destination = newValues, endIndex = insertIndex)
+ values.fastCopyInto(
+ destination = newValues,
+ destinationOffset = 0,
+ startIndex = 0,
+ endIndex = insertIndex
+ )
hashes.copyInto(
destination = newHashes,
destinationOffset = insertIndex + 1,
@@ -87,7 +93,7 @@
values = newValues
hashes = newHashes
} else {
- values.copyInto(
+ values.fastCopyInto(
destination = values,
destinationOffset = insertIndex + 1,
startIndex = insertIndex,
diff --git a/compose/runtime/runtime/src/nonAndroidMain/kotlin/androidx/compose/runtime/collection/ArrayUtils.nonAndroid.kt b/compose/runtime/runtime/src/nonAndroidMain/kotlin/androidx/compose/runtime/collection/ArrayUtils.nonAndroid.kt
new file mode 100644
index 0000000..2e2c834
--- /dev/null
+++ b/compose/runtime/runtime/src/nonAndroidMain/kotlin/androidx/compose/runtime/collection/ArrayUtils.nonAndroid.kt
@@ -0,0 +1,26 @@
+/*
+ * Copyright 2024 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT 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("NOTHING_TO_INLINE", "KotlinRedundantDiagnosticSuppress")
+
+package androidx.compose.runtime.collection
+
+internal actual inline fun <T> Array<out T>.fastCopyInto(
+ destination: Array<T>,
+ destinationOffset: Int,
+ startIndex: Int,
+ endIndex: Int
+): Array<T> = this.copyInto(destination, destinationOffset, startIndex, endIndex)
diff --git a/compose/ui/ui-graphics/lint-baseline.xml b/compose/ui/ui-graphics/lint-baseline.xml
index 3255d39..862a7fe 100644
--- a/compose/ui/ui-graphics/lint-baseline.xml
+++ b/compose/ui/ui-graphics/lint-baseline.xml
@@ -1,13 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?>
-<issues format="6" by="lint 8.7.0-alpha02" type="baseline" client="gradle" dependencies="false" name="AGP (8.7.0-alpha02)" variant="all" version="8.7.0-alpha02">
+<issues format="6" by="lint 8.9.0-alpha06" type="baseline" client="gradle" dependencies="false" name="AGP (8.9.0-alpha06)" variant="all" version="8.9.0-alpha06">
<issue
id="NewApi"
- message="This Kotlin extension function will be hidden by `java.util.SequencedCollection` starting in API 35"
- errorLine1=" val node = s.removeLastKt()"
- errorLine2=" ~~~~~~~~~~~~~~~~">
+ message="Call requires API level 23 (current min is 21): `android.view.View#setForeground`"
+ errorLine1=" foreground = GraphicsContextHostDrawable(graphicsContext, block)"
+ errorLine2=" ~">
<location
- file="src/commonMain/kotlin/androidx/compose/ui/graphics/IntervalTree.kt"/>
+ file="src/androidInstrumentedTest/kotlin/androidx/compose/ui/graphics/layer/AndroidGraphicsLayerTest.kt"/>
</issue>
<issue
diff --git a/compose/ui/ui-graphics/src/commonMain/kotlin/androidx/compose/ui/graphics/IntervalTree.kt b/compose/ui/ui-graphics/src/commonMain/kotlin/androidx/compose/ui/graphics/IntervalTree.kt
index 1d3b503..8a2ff33 100644
--- a/compose/ui/ui-graphics/src/commonMain/kotlin/androidx/compose/ui/graphics/IntervalTree.kt
+++ b/compose/ui/ui-graphics/src/commonMain/kotlin/androidx/compose/ui/graphics/IntervalTree.kt
@@ -82,8 +82,7 @@
// structure beyond what can be found in various descriptions of binary search
// trees and red/black trees
- @JvmField
- internal val terminator = Node(Float.MAX_VALUE, Float.MIN_VALUE, null, TreeColor.Black)
+ @JvmField internal val terminator = Node(Float.MAX_VALUE, Float.MIN_VALUE, null, TreeColorBlack)
@JvmField internal var root = terminator
@JvmField internal val stack = ArrayList<Node>()
@@ -203,7 +202,7 @@
* @param data Data to associate with the interval
*/
fun addInterval(start: Float, end: Float, data: T?) {
- val node = Node(start, end, data, TreeColor.Red)
+ val node = Node(start, end, data, TreeColorRed)
// Update the tree without doing any balancing
var current = root
@@ -239,44 +238,44 @@
private fun rebalance(target: Node) {
var node = target
- while (node !== root && node.parent.color == TreeColor.Red) {
+ while (node !== root && node.parent.color == TreeColorRed) {
val ancestor = node.parent.parent
if (node.parent === ancestor.left) {
val right = ancestor.right
- if (right.color == TreeColor.Red) {
- right.color = TreeColor.Black
- node.parent.color = TreeColor.Black
- ancestor.color = TreeColor.Red
+ if (right.color == TreeColorRed) {
+ right.color = TreeColorBlack
+ node.parent.color = TreeColorBlack
+ ancestor.color = TreeColorRed
node = ancestor
} else {
if (node === node.parent.right) {
node = node.parent
rotateLeft(node)
}
- node.parent.color = TreeColor.Black
- ancestor.color = TreeColor.Red
+ node.parent.color = TreeColorBlack
+ ancestor.color = TreeColorRed
rotateRight(ancestor)
}
} else {
val left = ancestor.left
- if (left.color == TreeColor.Red) {
- left.color = TreeColor.Black
- node.parent.color = TreeColor.Black
- ancestor.color = TreeColor.Red
+ if (left.color == TreeColorRed) {
+ left.color = TreeColorBlack
+ node.parent.color = TreeColorBlack
+ ancestor.color = TreeColorRed
node = ancestor
} else {
if (node === node.parent.left) {
node = node.parent
rotateRight(node)
}
- node.parent.color = TreeColor.Black
- ancestor.color = TreeColor.Red
+ node.parent.color = TreeColorBlack
+ ancestor.color = TreeColorRed
rotateLeft(ancestor)
}
}
}
- root.color = TreeColor.Black
+ root.color = TreeColorBlack
}
private fun rotateLeft(node: Node) {
@@ -340,11 +339,6 @@
}
}
- internal enum class TreeColor {
- Red,
- Black
- }
-
internal inner class Node(start: Float, end: Float, data: T?, var color: TreeColor) :
Interval<T>(start, end, data) {
var min: Float = start
@@ -378,3 +372,8 @@
}
}
}
+
+private typealias TreeColor = Int
+
+private const val TreeColorRed = 0
+private const val TreeColorBlack = 1
diff --git a/compose/ui/ui-graphics/src/commonMain/kotlin/androidx/compose/ui/graphics/PathGeometry.kt b/compose/ui/ui-graphics/src/commonMain/kotlin/androidx/compose/ui/graphics/PathGeometry.kt
index 53b0d54..4c96e1e 100644
--- a/compose/ui/ui-graphics/src/commonMain/kotlin/androidx/compose/ui/graphics/PathGeometry.kt
+++ b/compose/ui/ui-graphics/src/commonMain/kotlin/androidx/compose/ui/graphics/PathGeometry.kt
@@ -58,7 +58,7 @@
// segments.
var type = iterator.next(points)
while (type != PathSegment.Type.Done) {
- @Suppress("KotlinConstantConditions")
+ @Suppress("KotlinConstantConditions", "RedundantSuppression")
when (type) {
PathSegment.Type.Move -> {
if (!first) {
@@ -175,7 +175,7 @@
var type = iterator.next(points)
while (type != PathSegment.Type.Done) {
- @Suppress("KotlinConstantConditions")
+ @Suppress("KotlinConstantConditions", "RedundantSuppression")
when (type) {
PathSegment.Type.Move -> {
if (!first && !isEmpty) {
diff --git a/compose/ui/ui-graphics/src/commonMain/kotlin/androidx/compose/ui/graphics/colorspace/ColorSpace.kt b/compose/ui/ui-graphics/src/commonMain/kotlin/androidx/compose/ui/graphics/colorspace/ColorSpace.kt
index 3905cff..ec0cc69 100644
--- a/compose/ui/ui-graphics/src/commonMain/kotlin/androidx/compose/ui/graphics/colorspace/ColorSpace.kt
+++ b/compose/ui/ui-graphics/src/commonMain/kotlin/androidx/compose/ui/graphics/colorspace/ColorSpace.kt
@@ -633,7 +633,7 @@
* @param r2: The third element of the vector
* @return The first element of the resulting multiplication.
*/
-@Suppress("NOTHING_TO_INLINE")
+@Suppress("NOTHING_TO_INLINE", "KotlinRedundantDiagnosticSuppress")
internal inline fun mul3x3Float3_0(lhs: FloatArray, r0: Float, r1: Float, r2: Float): Float {
return lhs[0] * r0 + lhs[3] * r1 + lhs[6] * r2
}
@@ -648,7 +648,7 @@
* @param r2: The third element of the vector
* @return The second element of the resulting multiplication.
*/
-@Suppress("NOTHING_TO_INLINE")
+@Suppress("NOTHING_TO_INLINE", "KotlinRedundantDiagnosticSuppress")
internal inline fun mul3x3Float3_1(lhs: FloatArray, r0: Float, r1: Float, r2: Float): Float {
return lhs[1] * r0 + lhs[4] * r1 + lhs[7] * r2
}
@@ -663,7 +663,7 @@
* @param r2: The third element of the vector
* @return The third element of the resulting multiplication.
*/
-@Suppress("NOTHING_TO_INLINE")
+@Suppress("NOTHING_TO_INLINE", "KotlinRedundantDiagnosticSuppress")
internal inline fun mul3x3Float3_2(lhs: FloatArray, r0: Float, r1: Float, r2: Float): Float {
return lhs[2] * r0 + lhs[5] * r1 + lhs[8] * r2
}
diff --git a/compose/ui/ui-graphics/src/commonMain/kotlin/androidx/compose/ui/graphics/colorspace/Connector.kt b/compose/ui/ui-graphics/src/commonMain/kotlin/androidx/compose/ui/graphics/colorspace/Connector.kt
index 7a47484..2a81bac 100644
--- a/compose/ui/ui-graphics/src/commonMain/kotlin/androidx/compose/ui/graphics/colorspace/Connector.kt
+++ b/compose/ui/ui-graphics/src/commonMain/kotlin/androidx/compose/ui/graphics/colorspace/Connector.kt
@@ -230,7 +230,7 @@
chromaticAdaptation(
Adaptation.Bradford.transform,
srcXYZ,
- Illuminant.D50Xyz.copyOf()
+ Illuminant.newD50Xyz()
)
transform = mul3x3(srcAdaptation, source.transform)
}
@@ -240,7 +240,7 @@
chromaticAdaptation(
Adaptation.Bradford.transform,
dstXYZ,
- Illuminant.D50Xyz.copyOf()
+ Illuminant.newD50Xyz()
)
inverseTransform = inverse3x3(mul3x3(dstAdaptation, destination.transform))
}
diff --git a/compose/ui/ui-graphics/src/commonMain/kotlin/androidx/compose/ui/graphics/colorspace/Illuminant.kt b/compose/ui/ui-graphics/src/commonMain/kotlin/androidx/compose/ui/graphics/colorspace/Illuminant.kt
index b3598c3..0bf3461 100644
--- a/compose/ui/ui-graphics/src/commonMain/kotlin/androidx/compose/ui/graphics/colorspace/Illuminant.kt
+++ b/compose/ui/ui-graphics/src/commonMain/kotlin/androidx/compose/ui/graphics/colorspace/Illuminant.kt
@@ -73,4 +73,6 @@
val E = WhitePoint(0.33333f, 0.33333f)
internal val D50Xyz = floatArrayOf(0.964212f, 1.0f, 0.825188f)
+
+ internal fun newD50Xyz() = floatArrayOf(0.964212f, 1.0f, 0.825188f)
}
diff --git a/compose/ui/ui-graphics/src/commonMain/kotlin/androidx/compose/ui/graphics/colorspace/Rgb.kt b/compose/ui/ui-graphics/src/commonMain/kotlin/androidx/compose/ui/graphics/colorspace/Rgb.kt
index 06f2891..e9d3032 100644
--- a/compose/ui/ui-graphics/src/commonMain/kotlin/androidx/compose/ui/graphics/colorspace/Rgb.kt
+++ b/compose/ui/ui-graphics/src/commonMain/kotlin/androidx/compose/ui/graphics/colorspace/Rgb.kt
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-@file:Suppress("NOTHING_TO_INLINE")
+@file:Suppress("NOTHING_TO_INLINE", "KotlinRedundantDiagnosticSuppress")
package androidx.compose.ui.graphics.colorspace
@@ -853,10 +853,9 @@
var result = super.hashCode()
result = 31 * result + whitePoint.hashCode()
result = 31 * result + primaries.contentHashCode()
- result = 31 * result + (if (min != +0.0f) min.toBits() else 0)
- result = 31 * result + (if (max != +0.0f) max.toBits() else 0)
- result =
- (31 * result + if (transferParameters != null) transferParameters.hashCode() else 0)
+ result = 31 * result + (if (min != 0.0f) min.toBits() else 0)
+ result = 31 * result + (if (max != 0.0f) max.toBits() else 0)
+ result = (31 * result + (transferParameters?.hashCode() ?: 0))
if (transferParameters == null) {
result = 31 * result + oetfOrig.hashCode()
result = 31 * result + eotfOrig.hashCode()
diff --git a/compose/ui/ui-lint/src/main/java/androidx/compose/ui/lint/LocalContextConfigurationReadDetector.kt b/compose/ui/ui-lint/src/main/java/androidx/compose/ui/lint/LocalContextConfigurationReadDetector.kt
new file mode 100644
index 0000000..257cf98
--- /dev/null
+++ b/compose/ui/ui-lint/src/main/java/androidx/compose/ui/lint/LocalContextConfigurationReadDetector.kt
@@ -0,0 +1,180 @@
+/*
+ * Copyright 2024 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT 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.ui.lint
+
+import androidx.compose.lint.Names.Ui.Platform.LocalConfiguration
+import androidx.compose.lint.Package
+import androidx.compose.lint.isInPackageName
+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
+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.Scope
+import com.android.tools.lint.detector.api.Severity
+import com.android.tools.lint.detector.api.SourceCodeScanner
+import com.android.tools.lint.detector.api.UastLintUtils.Companion.tryResolveUDeclaration
+import com.intellij.psi.PsiMethod
+import java.util.EnumSet
+import org.jetbrains.uast.UElement
+import org.jetbrains.uast.UExpression
+import org.jetbrains.uast.UQualifiedReferenceExpression
+import org.jetbrains.uast.USimpleNameReferenceExpression
+import org.jetbrains.uast.UVariable
+import org.jetbrains.uast.matchesQualified
+import org.jetbrains.uast.skipParenthesizedExprDown
+import org.jetbrains.uast.tryResolve
+
+/**
+ * Detector that warns for calls to LocalContext.current.resources.configuration - changes to the
+ * configuration object will not cause this to recompose, so callers of this API will not be
+ * notified of the new configuration. LocalConfiguration.current should be used instead.
+ */
+class LocalContextConfigurationReadDetector : Detector(), SourceCodeScanner {
+ override fun getApplicableUastTypes() = listOf(UQualifiedReferenceExpression::class.java)
+
+ override fun createUastHandler(context: JavaContext): UElementHandler =
+ object : UElementHandler() {
+ override fun visitQualifiedReferenceExpression(node: UQualifiedReferenceExpression) {
+ // Fast path for whole string - note the logic below would catch this (and variants
+ // that use method calls such as getResources() instead), but we want a fast path
+ // so we can suggest a replacement.
+ if (node.matchesQualified(LocalContextCurrentResourcesConfiguration)) {
+ context.report(
+ LocalContextConfigurationRead,
+ node,
+ context.getNameLocation(node),
+ "Reading Configuration using $LocalContextCurrentResourcesConfiguration",
+ LintFix.create()
+ .replace()
+ .name("Replace with $LocalConfigurationCurrent")
+ .all()
+ .with(LocalConfigurationCurrent)
+ .imports(LocalConfiguration.javaFqn)
+ .autoFix()
+ .build()
+ )
+ return
+ }
+ // Simple logic to try and match a few specific cases (there are many cases that
+ // this won't warn for) where the chain is split up
+ // E.g. val context = LocalContext.current, val resources = context.resources,
+ // val configuration = resources.configuration
+ // A future improvement would be to catch receiver scope cases, such as
+ // `with(LocalContext.current.resources) { configuration... }`, but this is more
+ // complicated and error prone
+
+ // See if this is a resources.configuration call
+ val selector = node.selector.skipParenthesizedExprDown()
+ if (!selector.isCallToGetConfiguration()) return
+ // Try and find out where this resources came from.
+ val resources = node.receiver.skipParenthesizedExprDown()
+ val contextExpression: UExpression? =
+ when (resources) {
+ // Still part of a qualified expression, e.g. context.resources
+ is UQualifiedReferenceExpression -> {
+ if (!resources.isCallToGetResources()) return
+ // Return the receiver, e.g. `context` in the case of
+ // `context.resources`
+ resources.receiver.skipParenthesizedExprDown()
+ }
+ // Possible reference to a variable, e.g. val resources = context.resources,
+ // and this USimpleNameReferenceExpression is `resources`
+ is USimpleNameReferenceExpression -> {
+ // If it is a property such as val resources = context.resources, find
+ // the initializer
+ val initializer =
+ (resources.tryResolveUDeclaration() as? UVariable)?.uastInitializer
+ ?: return
+ if (initializer !is UQualifiedReferenceExpression) return
+ if (!initializer.isCallToGetResources()) return
+ // Return the receiver, e.g. `context` in the case of
+ // `context.resources`
+ initializer.receiver.skipParenthesizedExprDown()
+ }
+ else -> return
+ }
+
+ // Try and find out where this context came from
+ val contextSource =
+ when (contextExpression) {
+ // Still part of a qualified expression, e.g. LocalContext.current
+ is UQualifiedReferenceExpression -> contextExpression
+ // Possible reference to a variable, e.g. val context =
+ // LocalContext.current,
+ // and this USimpleNameReferenceExpression is `context`
+ is USimpleNameReferenceExpression -> {
+ // If it is a property such as val context = LocalContext.current, find
+ // the initializer
+ val initializer =
+ (contextExpression.tryResolveUDeclaration() as? UVariable)
+ ?.uastInitializer ?: return
+ if (initializer !is UQualifiedReferenceExpression) return
+ initializer
+ }
+ else -> return
+ }
+
+ if (contextSource.matchesQualified("LocalContext.current")) {
+ context.report(
+ LocalContextConfigurationRead,
+ node,
+ context.getNameLocation(node),
+ "Reading Configuration using $LocalContextCurrentResourcesConfiguration"
+ )
+ }
+ }
+ }
+
+ private fun UElement.isCallToGetConfiguration(): Boolean {
+ val resolved = tryResolve() as? PsiMethod ?: return false
+ return resolved.name == "getConfiguration" && resolved.isInPackageName(ResPackage)
+ }
+
+ private fun UElement.isCallToGetResources(): Boolean {
+ val resolved = tryResolve() as? PsiMethod ?: return false
+ return resolved.name == "getResources" && resolved.isInPackageName(ContentPackage)
+ }
+
+ companion object {
+ private const val LocalContextCurrentResourcesConfiguration =
+ "LocalContext.current.resources.configuration"
+ private const val LocalConfigurationCurrent = "LocalConfiguration.current"
+ private val ContentPackage = Package("android.content")
+ private val ResPackage = Package("android.content.res")
+
+ val LocalContextConfigurationRead =
+ Issue.create(
+ "LocalContextConfigurationRead",
+ "Reading Configuration using $LocalContextCurrentResourcesConfiguration",
+ "Changes to the Configuration object will not cause LocalContext reads to be " +
+ "invalidated, so you may end up with stale values when the Configuration " +
+ "changes. Instead, use $LocalConfigurationCurrent to retrieve the " +
+ "Configuration - this will recompose callers when the Configuration object " +
+ "changes.",
+ Category.CORRECTNESS,
+ 3,
+ Severity.ERROR,
+ Implementation(
+ LocalContextConfigurationReadDetector::class.java,
+ EnumSet.of(Scope.JAVA_FILE, Scope.TEST_SOURCES)
+ )
+ )
+ }
+}
diff --git a/compose/ui/ui-lint/src/main/java/androidx/compose/ui/lint/UiIssueRegistry.kt b/compose/ui/ui-lint/src/main/java/androidx/compose/ui/lint/UiIssueRegistry.kt
index deb81a3..636de46 100644
--- a/compose/ui/ui-lint/src/main/java/androidx/compose/ui/lint/UiIssueRegistry.kt
+++ b/compose/ui/ui-lint/src/main/java/androidx/compose/ui/lint/UiIssueRegistry.kt
@@ -31,6 +31,7 @@
get() =
listOf(
ComposedModifierDetector.UnnecessaryComposedModifier,
+ LocalContextConfigurationReadDetector.LocalContextConfigurationRead,
ModifierDeclarationDetector.ModifierFactoryExtensionFunction,
ModifierDeclarationDetector.ModifierFactoryReturnType,
ModifierDeclarationDetector.ModifierFactoryUnreferencedReceiver,
diff --git a/compose/ui/ui-lint/src/test/java/androidx/compose/ui/lint/AndroidStubs.kt b/compose/ui/ui-lint/src/test/java/androidx/compose/ui/lint/AndroidStubs.kt
new file mode 100644
index 0000000..ca900f9
--- /dev/null
+++ b/compose/ui/ui-lint/src/test/java/androidx/compose/ui/lint/AndroidStubs.kt
@@ -0,0 +1,103 @@
+/*
+ * Copyright 2024 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT 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.ui.lint
+
+import com.android.tools.lint.checks.infrastructure.LintDetectorTest.bytecode
+import com.android.tools.lint.checks.infrastructure.LintDetectorTest.java
+
+object AndroidStubs {
+
+ val Context =
+ bytecode(
+ "libs/android.jar",
+ java(
+ """
+package android.content;
+
+import android.content.res.Resources;
+
+public class Context {
+ public Resources getResources() {
+ return null;
+ }
+}
+ """
+ ),
+ 0xc2b7484b,
+ """
+ android/content/Context.class:
+ H4sIAAAAAAAA/zv1b9c+BgYGRwZ+LgYmBmZ2BhYeBlYGNkYGgazEskT9nMS8
+ dH3/pKzU5BJGBjabzLzMEjtGBmYNzTB2Bg5GBvHEvJSi/MwU/eT8vJLUvBJ9
+ ZxBdAVTL4pyfksrIwO+TmZfqV5qblFoUkpiUAxThSU8tCUotzi8tSk4tZmRQ
+ 1ND0QTekKLVYH67EmpGBKxjMdMsE64daoQdyH4MiAzvQ2SDAxMAIcjiQ5ATy
+ ZIE0I5Bm1drOwLgRyACaAiTZwIIgkpuBB6pUCqqUiXEDmjoOIMkLNpoPAIc3
+ ZUAnAQAA
+ """
+ )
+
+ val Resources =
+ bytecode(
+ "libs/android.jar",
+ java(
+ """
+package android.content.res;
+
+public class Resources {
+ public Configuration getConfiguration() {
+ return null;
+ }
+}
+ """
+ ),
+ 0xf1ea767d,
+ """
+ android/content/res/Resources.class:
+ H4sIAAAAAAAA/22Pz0rDQBDGv0nTRGttexZ68CC0HtwHUAQpeCoWqnjfJGPY
+ Undhs/G59CR48AF8KOlsKILiHL75w8dvZr6+Pz4B3GA8QIJejnSIPjLCZKNf
+ tNpqW6tVseEyELIrY024JvRm88ccB4SptpV3plKls4FtUJ4btebGtb7khpAu
+ XMWE8dJYvmufC/YPutjKZFJzWDj7ZOrW62CcJZzN5sv/cL9sl4TBfUe/NZEz
+ +ll2Ee/FKXJ5I0YCio+IHko3lUyS++fvoDcphCOadcNU9AjDvfVkb03o9Y8v
+ 6nGHHu0AlRLTZjcBAAA=
+ """
+ )
+
+ val Configuration =
+ bytecode(
+ "libs/android.jar",
+ java(
+ """
+package android.content.res;
+
+public class Configuration {
+ public int screenWidthDp;
+ public int screenHeightDp;
+}
+
+ """
+ ),
+ 0xbb67f264,
+ """
+ android/content/res/Configuration.class:
+ H4sIAAAAAAAA/1WPTU7DQAyFn2ma0NA/se+iu8KCuQBCQkUIJAQLUFlPEpO6
+ Kh40nXAvVkgsOACHQkwCGxZ+9vssPdlf3x+fAM4xzbGHXoZkiD5SwnRjX63Z
+ Wq3NXbHhMhDSU1EJZ4Te4miVYZ8wt1p5J5UpnQbWYDzvzNLpk9SNt0GcEka7
+ 0jPro1RhffFCoGvC+JddsdTr0MJk6SomTG5E+bZ5Ltg/2GIbSX7vGl/ypbTm
+ 8F/0SXsh5sji4YhFGCCPE+Hgr1P7StRhdLPOA/3jd9Bbtx5FTTuYRB13IZMf
+ blk3qhEBAAA=
+ """
+ )
+}
diff --git a/compose/ui/ui-lint/src/test/java/androidx/compose/ui/lint/LocalContextConfigurationReadDetectorTest.kt b/compose/ui/ui-lint/src/test/java/androidx/compose/ui/lint/LocalContextConfigurationReadDetectorTest.kt
new file mode 100644
index 0000000..9e9c017
--- /dev/null
+++ b/compose/ui/ui-lint/src/test/java/androidx/compose/ui/lint/LocalContextConfigurationReadDetectorTest.kt
@@ -0,0 +1,181 @@
+/*
+ * Copyright 2024 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT 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.ui.lint
+
+import androidx.compose.lint.test.Stubs
+import androidx.compose.lint.test.bytecodeStub
+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.junit.Test
+import org.junit.runner.RunWith
+import org.junit.runners.JUnit4
+
+/** Test for [LocalContextConfigurationReadDetector]. */
+@RunWith(JUnit4::class)
+class LocalContextConfigurationReadDetectorTest : LintDetectorTest() {
+ override fun getDetector(): Detector = LocalContextConfigurationReadDetector()
+
+ override fun getIssues(): MutableList<Issue> =
+ mutableListOf(LocalContextConfigurationReadDetector.LocalContextConfigurationRead)
+
+ val LocalContextStub =
+ bytecodeStub(
+ "AndroidCompositionLocals.kt",
+ "androidx/compose/ui/platform",
+ 0xe66eae21,
+ """
+ package androidx.compose.ui.platform
+
+ import android.content.Context
+ import androidx.compose.runtime.staticCompositionLocalOf
+
+ val LocalContext = staticCompositionLocalOf<Context>()
+ """,
+ """
+ META-INF/main.kotlin_module:
+ H4sIAAAAAAAA/2NgYGBmYGBgAmJGBijg0uOSSMxLKcrPTKnQS87PLcgvTtUr
+ Ks0rycxNFRJyBgtklmTm5/nkJyfmeJdwWXHJYKgvzdQryEksScsvyhWScoTI
+ omstBurl42IpSS0uEWILAZLeJUoMWgwAohQbypQAAAA=
+ """,
+ """
+ androidx/compose/ui/platform/AndroidCompositionLocalsKt.class:
+ H4sIAAAAAAAA/61TW0sbQRT+ZrPqZpuamF40alsbbRspuLG0FBoRRBBCUxUt
+ vvg02d2EiZsZ2Z0NPvpb+gt6eSl9KNLH/qjSM5tIMeKLdGFnzjlzvu9c5szv
+ Pz9+AniNVYa3XAaxEsGZ56v+qUpCLxXeacR1R8V9b2t4uJ0dCS2UbCmfR8l7
+ PQXGUOrxAfciLrveXrsX+mTNMRS7oc7ctpXU4ZmmILXV1rU4cSq16IfefqwG
+ IuDtKBwP02A4uB1y4xJEGMpBam+US2OTSJdbKu56vVC3Yy5k4nEpleYGnHi7
+ Su+mkQlduFrDm1tVUEAebh4W7jA4G34kpNCbDLna6hHDyxsZx3lMv4sMS4lJ
+ 0x8/3eusBGGHpxGl2au1TpSmOF5v0Pc6qfSHde2MpHqj2Rq/tcbtbqeAGZRd
+ lHCPYf//39LMZSEfQs0DrjnZrP4gR5NrmYWZBQzshOxnwmh1koJ1hrWL82n3
+ 4ty15qzh71jV2dLF+bxTtstW3aqzX58mHfKYt51cyTaoVwyVG9NhWLjpJayd
+ UNPzh6IruU7jkDwPhnU35UAkgqre+jddDPa2Csip2BIy3E377TD+aDrD4B6q
+ NPbDHWGUyojj6BoD1mmW7KzueTNapC2bhuABVmifJLuT6RVMkJbDM9IWyWo+
+ +ysKnzPs85EvMDXCT13BO7iLaZINuoqs0XCZzb7j/jcUvlzjsPAiY6miRvs7
+ sj6k+LPHyDUx10SlSdkukIjFJh7h8TFYgidYOsZEgnwCN8HTxMiTfwE44RI/
+ mwQAAA==
+ """
+ )
+
+ @Test
+ fun error() {
+ lint()
+ .files(
+ kotlin(
+ """
+ package test
+
+ import androidx.compose.runtime.Composable
+ import androidx.compose.ui.platform.LocalContext
+
+ @Composable
+ fun Test() {
+ LocalContext.current.resources.configuration
+ LocalContext.current.getResources().getConfiguration()
+ }
+ """
+ ),
+ LocalContextStub,
+ Stubs.Composable,
+ Stubs.CompositionLocal,
+ AndroidStubs.Context,
+ AndroidStubs.Resources,
+ AndroidStubs.Configuration
+ )
+ .run()
+ .expect(
+ """
+src/test/test.kt:9: Error: Reading Configuration using LocalContext.current.resources.configuration [LocalContextConfigurationRead]
+ LocalContext.current.resources.configuration
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+src/test/test.kt:10: Error: Reading Configuration using LocalContext.current.resources.configuration [LocalContextConfigurationRead]
+ LocalContext.current.getResources().getConfiguration()
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+2 errors, 0 warnings
+ """
+ )
+ .expectFixDiffs(
+ """
+Autofix for src/test/test.kt line 9: Replace with LocalConfiguration.current:
+@@ -5 +5
+- import androidx.compose.ui.platform.LocalContext
++ import androidx.compose.ui.platform.LocalConfiguration
++ import androidx.compose.ui.platform.LocalContext
+@@ -9 +10
+- LocalContext.current.resources.configuration
++ LocalConfiguration.current
+ """
+ )
+ }
+
+ @Test
+ fun errors_splitReferences() {
+ lint()
+ .files(
+ kotlin(
+ """
+ package test
+
+ import androidx.compose.runtime.Composable
+ import androidx.compose.ui.platform.LocalContext
+
+ @Composable
+ fun Test1() {
+ val resources = LocalContext.current.resources
+ resources.configuration
+ }
+
+ @Composable
+ fun Test2() {
+ val context = LocalContext.current
+ context.resources.configuration
+ }
+
+ @Composable
+ fun Test3() {
+ val context = LocalContext.current
+ val res = context.resources
+ res.configuration
+ }
+ """
+ ),
+ LocalContextStub,
+ Stubs.Composable,
+ Stubs.CompositionLocal,
+ AndroidStubs.Context,
+ AndroidStubs.Resources,
+ AndroidStubs.Configuration
+ )
+ .run()
+ .expect(
+ """
+src/test/test.kt:10: Error: Reading Configuration using LocalContext.current.resources.configuration [LocalContextConfigurationRead]
+ resources.configuration
+ ~~~~~~~~~~~~~~~~~~~~~~~
+src/test/test.kt:16: Error: Reading Configuration using LocalContext.current.resources.configuration [LocalContextConfigurationRead]
+ context.resources.configuration
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+src/test/test.kt:23: Error: Reading Configuration using LocalContext.current.resources.configuration [LocalContextConfigurationRead]
+ res.configuration
+ ~~~~~~~~~~~~~~~~~
+3 errors, 0 warnings
+ """
+ )
+ }
+}
diff --git a/compose/ui/ui-test-manifest/integration-tests/testapp/build.gradle b/compose/ui/ui-test-manifest/integration-tests/testapp/build.gradle
index 1997776..a0957a4 100644
--- a/compose/ui/ui-test-manifest/integration-tests/testapp/build.gradle
+++ b/compose/ui/ui-test-manifest/integration-tests/testapp/build.gradle
@@ -22,10 +22,10 @@
}
dependencies {
+
debugImplementation(project(":compose:ui:ui-test-manifest"))
implementation(project(":compose:ui:ui"))
- implementation(project(":compose:foundation:foundation"))
implementation("androidx.tracing:tracing:1.1.0")
androidTestImplementation(project(":compose:ui:ui-test-junit4"))
androidTestImplementation(libs.testRunner)
@@ -35,8 +35,4 @@
android {
compileSdk = 35
namespace = "androidx.compose.ui.test.manifest.integration.testapp"
-
- defaultConfig {
- targetSdkVersion 35
- }
}
diff --git a/compose/ui/ui-test-manifest/integration-tests/testapp/src/androidTest/java/androidx/compose/ui/test/manifest/integration/testapp/ComponentActivityLaunchesTest.kt b/compose/ui/ui-test-manifest/integration-tests/testapp/src/androidTest/java/androidx/compose/ui/test/manifest/integration/testapp/ComponentActivityLaunchesTest.kt
index 1ddeb53..6895df0 100644
--- a/compose/ui/ui-test-manifest/integration-tests/testapp/src/androidTest/java/androidx/compose/ui/test/manifest/integration/testapp/ComponentActivityLaunchesTest.kt
+++ b/compose/ui/ui-test-manifest/integration-tests/testapp/src/androidTest/java/androidx/compose/ui/test/manifest/integration/testapp/ComponentActivityLaunchesTest.kt
@@ -16,22 +16,9 @@
package androidx.compose.ui.test.manifest.integration.testapp
-import android.os.Build
-import androidx.activity.ComponentActivity
-import androidx.compose.foundation.background
-import androidx.compose.foundation.layout.Box
-import androidx.compose.foundation.layout.size
-import androidx.compose.ui.Modifier
-import androidx.compose.ui.graphics.Color
-import androidx.compose.ui.graphics.toPixelMap
-import androidx.compose.ui.platform.LocalDensity
-import androidx.compose.ui.platform.testTag
-import androidx.compose.ui.test.captureToImage
-import androidx.compose.ui.test.junit4.createAndroidComposeRule
-import androidx.compose.ui.test.onNodeWithTag
+import androidx.compose.ui.test.junit4.createComposeRule
import androidx.test.ext.junit.runners.AndroidJUnit4
import androidx.test.filters.LargeTest
-import androidx.test.filters.SdkSuppress
import org.junit.Rule
import org.junit.Test
import org.junit.runner.RunWith
@@ -39,42 +26,11 @@
@LargeTest
@RunWith(AndroidJUnit4::class)
class ComponentActivityLaunchesTest {
- @get:Rule val rule = createAndroidComposeRule<ComponentActivity>()
+ @get:Rule val rule = createComposeRule()
@Test
- fun activity_launches() {
+ fun test() {
rule.setContent {}
// Test does not crash and does not time out
}
-
- // Regression test for b/383368165
- // When targeting SDK 35, an activity is edge-to-edge by default and the action bar will overlap
- // the content. We can only detect this by taking a screenshot, assertIsDisplayed() doesn't work
- // due to b/383368165#comment2.
- @Test
- @SdkSuppress(minSdkVersion = Build.VERSION_CODES.O)
- fun activity_notCoveredByActionBar() {
- val color = Color.Red
- val size = 10
- rule.setContent {
- with(LocalDensity.current) {
- Box(Modifier.size(size.toDp()).background(color).testTag("box"))
- }
- }
-
- rule.onNodeWithTag("box").captureToImage().let {
- assert(it.width == size && it.height == size) {
- // We don't really need to test this, but better be safe then sorry
- "Screenshot size should be 10x10, but was ${it.width}x${it.height}"
- }
- val map = it.toPixelMap()
- for (y in 0 until map.height) {
- for (x in 0 until map.width) {
- assert(map[x, y] == color) {
- "Pixel at ($x, $y) is ${map[x, y]} instead of $color"
- }
- }
- }
- }
- }
}
diff --git a/compose/ui/ui-test-manifest/src/main/AndroidManifest.xml b/compose/ui/ui-test-manifest/src/main/AndroidManifest.xml
index 620129d..d96a063 100644
--- a/compose/ui/ui-test-manifest/src/main/AndroidManifest.xml
+++ b/compose/ui/ui-test-manifest/src/main/AndroidManifest.xml
@@ -16,7 +16,6 @@
-->
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
<application>
- <activity android:theme="@android:style/Theme.Material.Light.NoActionBar"
- android:name="androidx.activity.ComponentActivity" android:exported="true" />
+ <activity android:name="androidx.activity.ComponentActivity" android:exported="true" />
</application>
</manifest>
diff --git a/compose/ui/ui-test/src/androidInstrumentedTest/AndroidManifest.xml b/compose/ui/ui-test/src/androidInstrumentedTest/AndroidManifest.xml
index 5ceffbc..d70ca0d 100644
--- a/compose/ui/ui-test/src/androidInstrumentedTest/AndroidManifest.xml
+++ b/compose/ui/ui-test/src/androidInstrumentedTest/AndroidManifest.xml
@@ -16,7 +16,7 @@
-->
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
<application>
- <activity android:name="androidx.compose.ui.test.CustomComposeHostActivity" />
+ <activity android:name="androidx.compose.ui.test.ActivityWithActionBar" />
<activity android:name="androidx.compose.ui.test.ClickCounterActivity" />
<activity android:name="androidx.compose.ui.test.EmptyActivity" />
diff --git a/compose/ui/ui-test/src/androidInstrumentedTest/kotlin/androidx/compose/ui/test/CustomComposeHostActivity.kt b/compose/ui/ui-test/src/androidInstrumentedTest/kotlin/androidx/compose/ui/test/ActivityWithActionBar.kt
similarity index 96%
rename from compose/ui/ui-test/src/androidInstrumentedTest/kotlin/androidx/compose/ui/test/CustomComposeHostActivity.kt
rename to compose/ui/ui-test/src/androidInstrumentedTest/kotlin/androidx/compose/ui/test/ActivityWithActionBar.kt
index f40f330..4fc309f 100644
--- a/compose/ui/ui-test/src/androidInstrumentedTest/kotlin/androidx/compose/ui/test/CustomComposeHostActivity.kt
+++ b/compose/ui/ui-test/src/androidInstrumentedTest/kotlin/androidx/compose/ui/test/ActivityWithActionBar.kt
@@ -25,7 +25,7 @@
import androidx.compose.ui.platform.ComposeView
// The presence of an ActionBar follows from the theme set in AndroidManifest.xml
-class CustomComposeHostActivity : ComponentActivity() {
+class ActivityWithActionBar : ComponentActivity() {
private lateinit var composeHolder: ComposeView
override fun onCreate(savedInstanceState: Bundle?) {
diff --git a/compose/ui/ui-test/src/androidInstrumentedTest/kotlin/androidx/compose/ui/test/BitmapCapturingTest.kt b/compose/ui/ui-test/src/androidInstrumentedTest/kotlin/androidx/compose/ui/test/BitmapCapturingTest.kt
index aaa5e16..2120a4c 100644
--- a/compose/ui/ui-test/src/androidInstrumentedTest/kotlin/androidx/compose/ui/test/BitmapCapturingTest.kt
+++ b/compose/ui/ui-test/src/androidInstrumentedTest/kotlin/androidx/compose/ui/test/BitmapCapturingTest.kt
@@ -63,7 +63,7 @@
fun createTestSet(): List<TestConfig> =
listOf(
TestConfig(ComponentActivity::class.java),
- TestConfig(CustomComposeHostActivity::class.java)
+ TestConfig(ActivityWithActionBar::class.java)
)
}
@@ -239,7 +239,7 @@
private fun setContent(content: @Composable () -> Unit) {
when (val activity = rule.activity) {
- is CustomComposeHostActivity -> activity.setContent(content)
+ is ActivityWithActionBar -> activity.setContent(content)
else -> rule.setContent(content)
}
}
diff --git a/compose/ui/ui-test/src/androidInstrumentedTest/kotlin/androidx/compose/ui/test/IsDisplayedTest.kt b/compose/ui/ui-test/src/androidInstrumentedTest/kotlin/androidx/compose/ui/test/IsDisplayedTest.kt
index a05ce4c..4311d59 100644
--- a/compose/ui/ui-test/src/androidInstrumentedTest/kotlin/androidx/compose/ui/test/IsDisplayedTest.kt
+++ b/compose/ui/ui-test/src/androidInstrumentedTest/kotlin/androidx/compose/ui/test/IsDisplayedTest.kt
@@ -70,7 +70,7 @@
fun createTestSet(): List<TestConfig> =
listOf(
TestConfig(ComponentActivity::class.java),
- TestConfig(CustomComposeHostActivity::class.java)
+ TestConfig(ActivityWithActionBar::class.java)
)
}
@@ -314,7 +314,7 @@
private fun setContent(content: @Composable () -> Unit) {
when (val activity = rule.activity) {
- is CustomComposeHostActivity -> activity.setContent(content)
+ is ActivityWithActionBar -> activity.setContent(content)
else -> rule.setContent(content)
}
}
diff --git a/compose/ui/ui-test/src/androidInstrumentedTest/kotlin/androidx/compose/ui/test/gesturescope/SendClickTest.kt b/compose/ui/ui-test/src/androidInstrumentedTest/kotlin/androidx/compose/ui/test/gesturescope/SendClickTest.kt
index 736a3a9..c38fbc1 100644
--- a/compose/ui/ui-test/src/androidInstrumentedTest/kotlin/androidx/compose/ui/test/gesturescope/SendClickTest.kt
+++ b/compose/ui/ui-test/src/androidInstrumentedTest/kotlin/androidx/compose/ui/test/gesturescope/SendClickTest.kt
@@ -24,7 +24,7 @@
import androidx.compose.ui.input.pointer.PointerInputFilter
import androidx.compose.ui.input.pointer.PointerInputModifier
import androidx.compose.ui.input.pointer.changedToUp
-import androidx.compose.ui.test.CustomComposeHostActivity
+import androidx.compose.ui.test.ActivityWithActionBar
import androidx.compose.ui.test.click
import androidx.compose.ui.test.junit4.ComposeTestRule
import androidx.compose.ui.test.junit4.createAndroidComposeRule
@@ -55,11 +55,11 @@
for (x in listOf(0.0f, squareSize - 1.0f)) {
for (y in listOf(0.0f, squareSize - 1.0f)) {
add(TestConfig(Offset(x, y), ComponentActivity::class.java))
- add(TestConfig(Offset(x, y), CustomComposeHostActivity::class.java))
+ add(TestConfig(Offset(x, y), ActivityWithActionBar::class.java))
}
}
add(TestConfig(null, ComponentActivity::class.java))
- add(TestConfig(null, CustomComposeHostActivity::class.java))
+ add(TestConfig(null, ActivityWithActionBar::class.java))
}
}
}
@@ -89,7 +89,7 @@
// Given a column of 5 small components
var contentSet = false
rule.activityRule.scenario.onActivity {
- if (it is CustomComposeHostActivity) {
+ if (it is ActivityWithActionBar) {
it.setContent { ColumnOfSquares(5) }
contentSet = true
}
diff --git a/compose/ui/ui-tooling-preview/api/current.ignore b/compose/ui/ui-tooling-preview/api/current.ignore
index bb613a9..0c2a99c 100644
--- a/compose/ui/ui-tooling-preview/api/current.ignore
+++ b/compose/ui/ui-tooling-preview/api/current.ignore
@@ -1,4 +1,8 @@
// Baseline format: 1.0
+ChangedType: androidx.compose.ui.tooling.preview.PreviewParameter#provider():
+ Method androidx.compose.ui.tooling.preview.PreviewParameter.provider has changed return type from kotlin.reflect.KClass<? extends androidx.compose.ui.tooling.preview.PreviewParameterProvider<?>> to java.lang.Class<? extends androidx.compose.ui.tooling.preview.PreviewParameterProvider<?>>
+
+
ChangedValue: androidx.compose.ui.tooling.preview.Devices#DESKTOP:
Field androidx.compose.ui.tooling.preview.Devices.DESKTOP has changed value from spec:id=reference_desktop,shape=Normal,width=1920,height=1080,unit=dp,dpi=160 to spec:width=1920dp,height=1080dp,dpi=160
ChangedValue: androidx.compose.ui.tooling.preview.Devices#FOLDABLE:
diff --git a/compose/ui/ui-tooling-preview/api/current.txt b/compose/ui/ui-tooling-preview/api/current.txt
index b431232..d6b5c19 100644
--- a/compose/ui/ui-tooling-preview/api/current.txt
+++ b/compose/ui/ui-tooling-preview/api/current.txt
@@ -148,9 +148,9 @@
@java.lang.annotation.Retention(java.lang.annotation.RetentionPolicy.RUNTIME) public @interface PreviewParameter {
method public abstract int limit() default kotlin.jvm.internal.IntCompanionObject.MAX_VALUE;
- method public abstract kotlin.reflect.KClass<? extends androidx.compose.ui.tooling.preview.PreviewParameterProvider<? extends java.lang.Object?>> provider();
+ method public abstract Class<? extends androidx.compose.ui.tooling.preview.PreviewParameterProvider<? extends java.lang.Object?>> provider();
property public abstract int limit;
- property public abstract kotlin.reflect.KClass<? extends androidx.compose.ui.tooling.preview.PreviewParameterProvider<? extends java.lang.Object?>> provider;
+ property public abstract Class<? extends androidx.compose.ui.tooling.preview.PreviewParameterProvider<? extends java.lang.Object?>> provider;
}
@kotlin.jvm.JvmDefaultWithCompatibility public interface PreviewParameterProvider<T> {
diff --git a/compose/ui/ui-tooling-preview/api/restricted_current.ignore b/compose/ui/ui-tooling-preview/api/restricted_current.ignore
index bb613a9..0c2a99c 100644
--- a/compose/ui/ui-tooling-preview/api/restricted_current.ignore
+++ b/compose/ui/ui-tooling-preview/api/restricted_current.ignore
@@ -1,4 +1,8 @@
// Baseline format: 1.0
+ChangedType: androidx.compose.ui.tooling.preview.PreviewParameter#provider():
+ Method androidx.compose.ui.tooling.preview.PreviewParameter.provider has changed return type from kotlin.reflect.KClass<? extends androidx.compose.ui.tooling.preview.PreviewParameterProvider<?>> to java.lang.Class<? extends androidx.compose.ui.tooling.preview.PreviewParameterProvider<?>>
+
+
ChangedValue: androidx.compose.ui.tooling.preview.Devices#DESKTOP:
Field androidx.compose.ui.tooling.preview.Devices.DESKTOP has changed value from spec:id=reference_desktop,shape=Normal,width=1920,height=1080,unit=dp,dpi=160 to spec:width=1920dp,height=1080dp,dpi=160
ChangedValue: androidx.compose.ui.tooling.preview.Devices#FOLDABLE:
diff --git a/compose/ui/ui-tooling-preview/api/restricted_current.txt b/compose/ui/ui-tooling-preview/api/restricted_current.txt
index b431232..d6b5c19 100644
--- a/compose/ui/ui-tooling-preview/api/restricted_current.txt
+++ b/compose/ui/ui-tooling-preview/api/restricted_current.txt
@@ -148,9 +148,9 @@
@java.lang.annotation.Retention(java.lang.annotation.RetentionPolicy.RUNTIME) public @interface PreviewParameter {
method public abstract int limit() default kotlin.jvm.internal.IntCompanionObject.MAX_VALUE;
- method public abstract kotlin.reflect.KClass<? extends androidx.compose.ui.tooling.preview.PreviewParameterProvider<? extends java.lang.Object?>> provider();
+ method public abstract Class<? extends androidx.compose.ui.tooling.preview.PreviewParameterProvider<? extends java.lang.Object?>> provider();
property public abstract int limit;
- property public abstract kotlin.reflect.KClass<? extends androidx.compose.ui.tooling.preview.PreviewParameterProvider<? extends java.lang.Object?>> provider;
+ property public abstract Class<? extends androidx.compose.ui.tooling.preview.PreviewParameterProvider<? extends java.lang.Object?>> provider;
}
@kotlin.jvm.JvmDefaultWithCompatibility public interface PreviewParameterProvider<T> {
diff --git a/compose/ui/ui-tooling-preview/build.gradle b/compose/ui/ui-tooling-preview/build.gradle
index 2ea5618..59a92e2 100644
--- a/compose/ui/ui-tooling-preview/build.gradle
+++ b/compose/ui/ui-tooling-preview/build.gradle
@@ -99,6 +99,5 @@
description = "Compose tooling library API. This library provides the API required to declare" +
" @Preview composables in user apps."
legacyDisableKotlinStrictApiMode = true
- metalavaK2UastEnabled = false
}
diff --git a/compose/ui/ui-unit/src/commonMain/kotlin/androidx/compose/ui/unit/Constraints.kt b/compose/ui/ui-unit/src/commonMain/kotlin/androidx/compose/ui/unit/Constraints.kt
index 79ba2da..80e1938 100644
--- a/compose/ui/ui-unit/src/commonMain/kotlin/androidx/compose/ui/unit/Constraints.kt
+++ b/compose/ui/ui-unit/src/commonMain/kotlin/androidx/compose/ui/unit/Constraints.kt
@@ -368,10 +368,16 @@
private const val MinFocusBits = 16
private const val MaxAllowedForMinFocusBits = (1 shl (31 - MinFocusBits)) - 2
+/** The mask to use for the focused dimension when there is minimal focus. */
+private const val MinFocusMask = 0xFFFF // 64K (16 bits)
+
/** The number of bits used for the non-focused dimension when there is minimal focus. */
private const val MinNonFocusBits = 15
private const val MaxAllowedForMinNonFocusBits = (1 shl (31 - MinNonFocusBits)) - 2
+/** The mask to use for the non-focused dimension when there is minimal focus. */
+private const val MinNonFocusMask = 0x7FFF // 32K (15 bits)
+
/** The number of bits to use for the focused dimension when there is maximal focus. */
private const val MaxFocusBits = 18
private const val MaxAllowedForMaxFocusBits = (1 shl (31 - MaxFocusBits)) - 2
@@ -383,6 +389,9 @@
private const val MaxNonFocusBits = 13
private const val MaxAllowedForMaxNonFocusBits = (1 shl (31 - MaxNonFocusBits)) - 2
+/** The mask to use for the non-focused dimension when there is maximal focus. */
+private const val MaxNonFocusMask = 0x1FFF // 8K (13 bits)
+
// 0xFFFFFFFE_00000003UL.toLong(), written as a signed value to declare it const
@PublishedApi internal const val MaxDimensionsAndFocusMask = -0x00000001_FFFFFFFDL
@@ -443,35 +452,22 @@
}
internal fun bitsNeedForSizeUnchecked(size: Int): Int {
- // We could look at the value of size itself, for instance by doing:
- // when {
- // size < MaxNonFocusMask -> MaxNonFocusBits
- // ...
- // }
- // but the following solution saves a few instructions by avoiding
- // multiple moves to load large constants
- val bits = (size + 1).countLeadingZeroBits()
return when {
- bits >= 32 - MaxNonFocusBits -> MaxNonFocusBits
- bits >= 32 - MinNonFocusBits -> MinNonFocusBits
- bits >= 32 - MinFocusBits -> MinFocusBits
- bits >= 32 - MaxFocusBits -> MaxFocusBits
+ size < MaxNonFocusMask -> MaxNonFocusBits
+ size < MinNonFocusMask -> MinNonFocusBits
+ size < MinFocusMask -> MinFocusBits
+ size < MaxFocusMask -> MaxFocusBits
else -> 255
}
}
private inline fun maxAllowedForSize(size: Int): Int {
- // See comment in bitsNeedForSizeUnchecked()
- // Note: the return value in every case is `1 shl (31 - bits) - 2`
- // However, computing the value instead of using constants uses more
- // instructions, so not worth it
- val bits = (size + 1).countLeadingZeroBits()
- if (bits <= 13) throwInvalidConstraintsSizeException(size)
return when {
- bits >= 32 - MaxNonFocusBits -> MaxAllowedForMaxNonFocusBits
- bits >= 32 - MinNonFocusBits -> MaxAllowedForMinNonFocusBits
- bits >= 32 - MinFocusBits -> MaxAllowedForMinFocusBits
- else -> MaxAllowedForMaxFocusBits
+ size < MaxNonFocusMask -> MaxAllowedForMaxNonFocusBits
+ size < MinNonFocusMask -> MaxAllowedForMinNonFocusBits
+ size < MinFocusMask -> MaxAllowedForMinFocusBits
+ size < MaxFocusMask -> MaxAllowedForMaxFocusBits
+ else -> throwInvalidConstraintsSizeException(size)
}
}
diff --git a/compose/ui/ui-unit/src/commonMain/kotlin/androidx/compose/ui/unit/Density.kt b/compose/ui/ui-unit/src/commonMain/kotlin/androidx/compose/ui/unit/Density.kt
index 5b3e3c5..cbefe8a 100644
--- a/compose/ui/ui-unit/src/commonMain/kotlin/androidx/compose/ui/unit/Density.kt
+++ b/compose/ui/ui-unit/src/commonMain/kotlin/androidx/compose/ui/unit/Density.kt
@@ -65,7 +65,7 @@
*/
@Stable
fun TextUnit.toPx(): Float {
- check(type == TextUnitType.Sp) { "Only Sp can convert to Px" }
+ checkPrecondition(type == TextUnitType.Sp) { "Only Sp can convert to Px" }
return toDp().toPx()
}
diff --git a/compose/ui/ui-unit/src/commonMain/kotlin/androidx/compose/ui/unit/Dp.kt b/compose/ui/ui-unit/src/commonMain/kotlin/androidx/compose/ui/unit/Dp.kt
index a88b3c0..e5cac56 100644
--- a/compose/ui/ui-unit/src/commonMain/kotlin/androidx/compose/ui/unit/Dp.kt
+++ b/compose/ui/ui-unit/src/commonMain/kotlin/androidx/compose/ui/unit/Dp.kt
@@ -83,7 +83,10 @@
/** Infinite dp dimension. */
@Stable val Infinity = Dp(Float.POSITIVE_INFINITY)
- /** Constant that means unspecified Dp */
+ /**
+ * Constant that means unspecified Dp. Instead of comparing a [Dp] value to this constant,
+ * consider using [isSpecified] and [isUnspecified] instead.
+ */
@Stable val Unspecified = Dp(Float.NaN)
}
}
diff --git a/compose/ui/ui/benchmark/src/androidTest/java/androidx/compose/ui/benchmark/input/pointer/TapIntegrationBenchmarkValues.kt b/compose/ui/ui/benchmark/src/androidTest/java/androidx/compose/ui/benchmark/input/pointer/TapIntegrationBenchmarkValues.kt
index 8ef603f..0649fe7 100644
--- a/compose/ui/ui/benchmark/src/androidTest/java/androidx/compose/ui/benchmark/input/pointer/TapIntegrationBenchmarkValues.kt
+++ b/compose/ui/ui/benchmark/src/androidTest/java/androidx/compose/ui/benchmark/input/pointer/TapIntegrationBenchmarkValues.kt
@@ -1,5 +1,5 @@
/*
- * Copyright 20201 The Android Open Source Project
+ * 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.
diff --git a/compose/ui/ui/build.gradle b/compose/ui/ui/build.gradle
index 73d3551..3a1ada1 100644
--- a/compose/ui/ui/build.gradle
+++ b/compose/ui/ui/build.gradle
@@ -24,7 +24,6 @@
import androidx.build.KotlinTarget
import androidx.build.LibraryType
-import androidx.build.KmpPlatformsKt
import androidx.build.PlatformIdentifier
import static androidx.inspection.gradle.InspectionPluginKt.packageInspector
@@ -60,6 +59,8 @@
api(project(":compose:ui:ui-util"))
api("androidx.lifecycle:lifecycle-runtime-compose:2.8.7")
+
+ implementation(project(":performance:performance-annotation"))
}
}
diff --git a/compose/ui/ui/proguard-rules.pro b/compose/ui/ui/proguard-rules.pro
index d6f21c4..1f592ff3 100644
--- a/compose/ui/ui/proguard-rules.pro
+++ b/compose/ui/ui/proguard-rules.pro
@@ -52,3 +52,7 @@
-keepnames class androidx.compose.ui.input.pointer.PointerInputEventHandler {
*;
}
+
+-keepclassmembers class * {
+ @dalvik.annotation.optimization.NeverInline *;
+}
diff --git a/compose/ui/ui/src/androidInstrumentedTest/kotlin/androidx/compose/ui/input/pointer/AndroidPointerInputTest.kt b/compose/ui/ui/src/androidInstrumentedTest/kotlin/androidx/compose/ui/input/pointer/AndroidPointerInputTest.kt
index c9d13ac..67dcaf4 100644
--- a/compose/ui/ui/src/androidInstrumentedTest/kotlin/androidx/compose/ui/input/pointer/AndroidPointerInputTest.kt
+++ b/compose/ui/ui/src/androidInstrumentedTest/kotlin/androidx/compose/ui/input/pointer/AndroidPointerInputTest.kt
@@ -206,6 +206,7 @@
}
@Test
+ @SdkSuppress(maxSdkVersion = 34) // b/384972397: Failing on SDK 35
fun dispatchTouchEvent_noPointerInputModifiers_returnsFalse() {
// Arrange
diff --git a/compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/input/pointer/util/PointerIdArray.kt b/compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/input/pointer/util/PointerIdArray.kt
index d96d294..f295af3 100644
--- a/compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/input/pointer/util/PointerIdArray.kt
+++ b/compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/input/pointer/util/PointerIdArray.kt
@@ -19,6 +19,7 @@
package androidx.compose.ui.input.pointer.util
import androidx.compose.ui.input.pointer.PointerId
+import dalvik.annotation.optimization.NeverInline
/**
* This collection is specifically for dealing with [PointerId] values. We know that they contain
@@ -144,6 +145,7 @@
if (index >= size) size = index + 1
}
+ @NeverInline
private fun resizeStorage(minSize: Int): LongArray {
return internalArray.copyOf(maxOf(minSize, internalArray.size * 2)).apply {
internalArray = this
diff --git a/compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/node/MyersDiff.kt b/compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/node/MyersDiff.kt
index acc7620..1d84d69 100644
--- a/compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/node/MyersDiff.kt
+++ b/compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/node/MyersDiff.kt
@@ -18,6 +18,7 @@
package androidx.compose.ui.node
import androidx.compose.ui.internal.checkPrecondition
+import dalvik.annotation.optimization.NeverInline
import kotlin.jvm.JvmInline
import kotlin.math.abs
import kotlin.math.min
@@ -417,6 +418,7 @@
val size: Int
get() = lastIndex
+ @NeverInline
private fun resizeStack(stack: IntArray): IntArray {
val copy = stack.copyOf(stack.size * 2)
this.stack = copy
diff --git a/compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/spatial/RectList.kt b/compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/spatial/RectList.kt
index 259ae65..ab2eb07 100644
--- a/compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/spatial/RectList.kt
+++ b/compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/spatial/RectList.kt
@@ -14,10 +14,11 @@
* limitations under the License.
*/
-@file:Suppress("NOTHING_TO_INLINE")
+@file:Suppress("NOTHING_TO_INLINE", "KotlinRedundantDiagnosticSuppress")
package androidx.compose.ui.spatial
+import dalvik.annotation.optimization.NeverInline
import kotlin.jvm.JvmField
import kotlin.math.max
import kotlin.math.min
@@ -98,19 +99,24 @@
* keep this in mind if you call this method and have cached any of those values in a local
* variable, you may need to refresh them.
*/
- internal fun allocateItemsIndex(): Int {
+ private inline fun allocateItemsIndex(): Int {
val currentItems = items
val currentSize = itemsSize
itemsSize = currentSize + LongsPerItem
val actualSize = currentItems.size
if (actualSize <= currentSize + LongsPerItem) {
- val newSize = max(actualSize * 2, currentSize + LongsPerItem)
- items = currentItems.copyOf(newSize)
- stack = stack.copyOf(newSize)
+ resizeStorage(actualSize, currentSize, currentItems)
}
return currentSize
}
+ @NeverInline
+ private fun resizeStorage(actualSize: Int, currentSize: Int, currentItems: LongArray) {
+ val newSize = max(actualSize * 2, currentSize + LongsPerItem)
+ items = currentItems.copyOf(newSize)
+ stack = stack.copyOf(newSize)
+ }
+
/**
* Insert a value and corresponding bounding rectangle into the RectList. This method does not
* check to see that [value] doesn't already exist somewhere in the list.
diff --git a/constraintlayout/constraintlayout-compose/build.gradle b/constraintlayout/constraintlayout-compose/build.gradle
index 970db03..333e65d 100644
--- a/constraintlayout/constraintlayout-compose/build.gradle
+++ b/constraintlayout/constraintlayout-compose/build.gradle
@@ -83,6 +83,7 @@
implementation(project(":compose:material:material"))
implementation("androidx.compose.material:material-icons-core:1.6.7")
implementation(project(":compose:ui:ui-test-junit4"))
+ implementation(project(":compose:ui:ui-test-manifest"))
implementation(project(":compose:test-utils"))
}
}
diff --git a/coordinatorlayout/coordinatorlayout/src/androidTest/java/androidx/coordinatorlayout/widget/CoordinatorLayoutTest.java b/coordinatorlayout/coordinatorlayout/src/androidTest/java/androidx/coordinatorlayout/widget/CoordinatorLayoutTest.java
index 8a1c752..0611df9 100644
--- a/coordinatorlayout/coordinatorlayout/src/androidTest/java/androidx/coordinatorlayout/widget/CoordinatorLayoutTest.java
+++ b/coordinatorlayout/coordinatorlayout/src/androidTest/java/androidx/coordinatorlayout/widget/CoordinatorLayoutTest.java
@@ -91,7 +91,7 @@
}
@Test
- @SdkSuppress(minSdkVersion = 21)
+ @SdkSuppress(minSdkVersion = 21, maxSdkVersion = 34) // b/384972523: Failing on SDK 35
public void testSetFitSystemWindows() throws Throwable {
// Skip this test on Android TV
PackageManager manager = mActivityTestRule.getActivity().getPackageManager();
diff --git a/core/core-ktx/src/main/java/androidx/core/graphics/Picture.kt b/core/core-ktx/src/main/java/androidx/core/graphics/Picture.kt
index 47a4c8e..a0fec99 100644
--- a/core/core-ktx/src/main/java/androidx/core/graphics/Picture.kt
+++ b/core/core-ktx/src/main/java/androidx/core/graphics/Picture.kt
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 20188 The Android Open Source Project
+ * 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.
diff --git a/core/core-telecom/src/androidTest/AndroidManifest.xml b/core/core-telecom/src/androidTest/AndroidManifest.xml
index 897f4cb..8e9ed4d 100644
--- a/core/core-telecom/src/androidTest/AndroidManifest.xml
+++ b/core/core-telecom/src/androidTest/AndroidManifest.xml
@@ -18,6 +18,7 @@
<uses-permission android:name="android.permission.MANAGE_OWN_CALLS" />
<uses-permission android:name="android.permission.READ_PHONE_NUMBERS"/>
<uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS" />
+ <uses-permission android:name="android.permission.BLUETOOTH_CONNECT" />
<application>
<service
diff --git a/core/core-telecom/src/androidTest/java/androidx/core/telecom/test/PreCallEndpointsTest.kt b/core/core-telecom/src/androidTest/java/androidx/core/telecom/test/PreCallEndpointsTest.kt
index 8b65769..f1bcaff 100644
--- a/core/core-telecom/src/androidTest/java/androidx/core/telecom/test/PreCallEndpointsTest.kt
+++ b/core/core-telecom/src/androidTest/java/androidx/core/telecom/test/PreCallEndpointsTest.kt
@@ -24,7 +24,7 @@
import androidx.core.telecom.CallEndpointCompat.Companion.TYPE_EARPIECE
import androidx.core.telecom.CallEndpointCompat.Companion.TYPE_SPEAKER
import androidx.core.telecom.internal.CallEndpointUuidTracker
-import androidx.core.telecom.internal.PreCallEndpoints
+import androidx.core.telecom.internal.PreCallEndpointsUpdater
import androidx.test.filters.SdkSuppress
import androidx.test.filters.SmallTest
import kotlinx.coroutines.channels.Channel
@@ -52,7 +52,7 @@
@Test
fun testInitialValues() {
val initEndpoints = mutableListOf(defaultEarpiece, defaultSpeaker, defaultBluetooth)
- val currentPreCallEndpoints = PreCallEndpoints(initEndpoints, Channel())
+ val currentPreCallEndpoints = PreCallEndpointsUpdater(initEndpoints, Channel())
assertTrue(currentPreCallEndpoints.isCallEndpointBeingTracked(defaultEarpiece))
assertTrue(currentPreCallEndpoints.isCallEndpointBeingTracked(defaultSpeaker))
assertTrue(currentPreCallEndpoints.isCallEndpointBeingTracked(defaultBluetooth))
@@ -65,51 +65,51 @@
@Test
fun testEndpointsAddedWithNewEndpoint() {
val initEndpoints = mutableListOf(defaultEarpiece)
- val currentPreCallEndpoints = PreCallEndpoints(initEndpoints, Channel())
+ val currentPreCallEndpoints = PreCallEndpointsUpdater(initEndpoints, Channel())
assertTrue(currentPreCallEndpoints.isCallEndpointBeingTracked(defaultEarpiece))
assertFalse(currentPreCallEndpoints.isCallEndpointBeingTracked(defaultSpeaker))
val res = currentPreCallEndpoints.maybeAddCallEndpoint(defaultSpeaker)
- assertEquals(PreCallEndpoints.START_TRACKING_NEW_ENDPOINT, res)
+ assertEquals(PreCallEndpointsUpdater.START_TRACKING_NEW_ENDPOINT, res)
}
@SmallTest
@Test
fun testEndpointsAddedWithNoNewEndpoints() {
val initEndpoints = mutableListOf(defaultEarpiece, defaultSpeaker)
- val currentPreCallEndpoints = PreCallEndpoints(initEndpoints, Channel())
+ val currentPreCallEndpoints = PreCallEndpointsUpdater(initEndpoints, Channel())
assertTrue(currentPreCallEndpoints.isCallEndpointBeingTracked(defaultEarpiece))
assertTrue(currentPreCallEndpoints.isCallEndpointBeingTracked(defaultSpeaker))
val res = currentPreCallEndpoints.maybeAddCallEndpoint(defaultSpeaker)
- assertEquals(PreCallEndpoints.ALREADY_TRACKING_ENDPOINT, res)
+ assertEquals(PreCallEndpointsUpdater.ALREADY_TRACKING_ENDPOINT, res)
}
@SmallTest
@Test
fun testEndpointsRemovedWithUntrackedEndpoint() {
val initEndpoints = mutableListOf(defaultEarpiece)
- val currentPreCallEndpoints = PreCallEndpoints(initEndpoints, Channel())
+ val currentPreCallEndpoints = PreCallEndpointsUpdater(initEndpoints, Channel())
assertTrue(currentPreCallEndpoints.isCallEndpointBeingTracked(defaultEarpiece))
assertFalse(currentPreCallEndpoints.isCallEndpointBeingTracked(defaultSpeaker))
val res = currentPreCallEndpoints.maybeRemoveCallEndpoint(defaultSpeaker)
- assertEquals(PreCallEndpoints.NOT_TRACKING_REMOVED_ENDPOINT, res)
+ assertEquals(PreCallEndpointsUpdater.NOT_TRACKING_REMOVED_ENDPOINT, res)
}
@SmallTest
@Test
fun testEndpointsRemovedWithTrackedEndpoint() {
val initEndpoints = mutableListOf(defaultEarpiece, defaultSpeaker)
- val currentPreCallEndpoints = PreCallEndpoints(initEndpoints, Channel())
+ val currentPreCallEndpoints = PreCallEndpointsUpdater(initEndpoints, Channel())
assertTrue(currentPreCallEndpoints.isCallEndpointBeingTracked(defaultEarpiece))
assertTrue(currentPreCallEndpoints.isCallEndpointBeingTracked(defaultSpeaker))
val res = currentPreCallEndpoints.maybeRemoveCallEndpoint(defaultSpeaker)
- assertEquals(PreCallEndpoints.STOP_TRACKING_REMOVED_ENDPOINT, res)
+ assertEquals(PreCallEndpointsUpdater.STOP_TRACKING_REMOVED_ENDPOINT, res)
}
}
diff --git a/core/core-telecom/src/main/java/androidx/core/telecom/CallsManager.kt b/core/core-telecom/src/main/java/androidx/core/telecom/CallsManager.kt
index 94ecba9..f84b88d 100644
--- a/core/core-telecom/src/main/java/androidx/core/telecom/CallsManager.kt
+++ b/core/core-telecom/src/main/java/androidx/core/telecom/CallsManager.kt
@@ -18,9 +18,6 @@
import android.content.ComponentName
import android.content.Context
-import android.media.AudioDeviceCallback
-import android.media.AudioDeviceInfo
-import android.media.AudioManager
import android.os.Build.VERSION_CODES
import android.os.Bundle
import android.os.OutcomeReceiver
@@ -44,15 +41,15 @@
import androidx.core.telecom.extensions.ExtensionInitializationScope
import androidx.core.telecom.extensions.ExtensionInitializationScopeImpl
import androidx.core.telecom.internal.AddCallResult
+import androidx.core.telecom.internal.AudioDeviceListener
+import androidx.core.telecom.internal.BluetoothProfileListener
import androidx.core.telecom.internal.CallChannels
import androidx.core.telecom.internal.CallEndpointUuidTracker
import androidx.core.telecom.internal.CallSession
import androidx.core.telecom.internal.CallSessionLegacy
import androidx.core.telecom.internal.CallStateEvent
import androidx.core.telecom.internal.JetpackConnectionService
-import androidx.core.telecom.internal.PreCallEndpoints
-import androidx.core.telecom.internal.utils.AudioManagerUtil.Companion.getAvailableAudioDevices
-import androidx.core.telecom.internal.utils.EndpointUtils.Companion.getEndpointsFromAudioDeviceInfo
+import androidx.core.telecom.internal.PreCallEndpointsUpdater
import androidx.core.telecom.internal.utils.Utils
import androidx.core.telecom.internal.utils.Utils.Companion.remapJetpackCapsToPlatformCaps
import androidx.core.telecom.util.ExperimentalAppActions
@@ -356,56 +353,38 @@
}
/**
- * Continuously stream the available call audio endpoints that can be used for a new call
- * session. The [callbackFlow] should be cleaned up client-side by calling cancel() from the
- * same [kotlinx.coroutines.CoroutineScope] the [callbackFlow] is collecting in.
+ * Continuously streams available call audio endpoints that can be used for a new call session.
+ * This API leverages [callbackFlow] to emit updates as the available audio endpoints change.
*
- * Note: The endpoints emitted will be sorted by the [CallEndpointCompat.type] . See
- * [CallEndpointCompat.compareTo] for the ordering. The first element in the list will be the
- * recommended call endpoint to default to for the user.
+ * **Bluetooth Permissions:** The [android.Manifest.permission.BLUETOOTH_CONNECT] runtime
+ * permission is essential when multiple bluetooth devices are connected. Granting this
+ * permission allows the API to display the names of multiple connected Bluetooth devices.
+ * Without this permission, only the active Bluetooth device will be surfaced.
*
- * @return a flow of [CallEndpointCompat]s that can be used for a new call session
+ * **Coroutine Usage and Cleanup:** The returned [Flow] from this [callbackFlow] should be
+ * collected within a [kotlinx.coroutines.CoroutineScope]. To properly manage resources and
+ * prevent leaks, ensure that the [Flow] is cancelled when it's no longer needed. This can be
+ * achieved by calling `cancel()` on the [kotlinx.coroutines.Job] of the collecting
+ * [kotlinx.coroutines.CoroutineScope]. Ideally, this cleanup should occur within the same scope
+ * where the [Flow] is being collected.
+ *
+ * @return A [Flow] that continuously emits a list of available [CallEndpointCompat]s.
*/
public fun getAvailableStartingCallEndpoints(): Flow<List<CallEndpointCompat>> = callbackFlow {
val id: Int = CallEndpointUuidTracker.startSession()
- val audioManager = mContext.getSystemService(Context.AUDIO_SERVICE) as AudioManager
- // [AudioDeviceInfo] <-- AudioManager / platform
- val initialAudioDevices = getAvailableAudioDevices(audioManager)
- // [CallEndpoints] <-- [AudioDeviceInfo]
- val initialEndpoints = getEndpointsFromAudioDeviceInfo(mContext, id, initialAudioDevices)
// The emitted endpoints need to be tracked so that when the device list changes,
// the added or removed endpoints can be re-emitted as a whole list. Otherwise, only
// the added or removed endpoints will be emitted.
- val preCallEndpoints = PreCallEndpoints(initialEndpoints.toMutableList(), this.channel)
+ val callEndpointsUpdater = PreCallEndpointsUpdater(mSendChannel = this.channel)
// register an audio callback that will listen for updates
- val audioDeviceCallback =
- object : AudioDeviceCallback() {
- override fun onAudioDevicesAdded(addedDevices: Array<out AudioDeviceInfo>?) {
- if (addedDevices != null) {
- preCallEndpoints.endpointsAddedUpdate(
- getEndpointsFromAudioDeviceInfo(mContext, id, addedDevices.toList())
- )
- }
- }
-
- override fun onAudioDevicesRemoved(removedDevices: Array<out AudioDeviceInfo>?) {
- if (removedDevices != null) {
- preCallEndpoints.endpointsRemovedUpdate(
- getEndpointsFromAudioDeviceInfo(mContext, id, removedDevices.toList())
- )
- }
- }
- }
- // The following callback is needed in the event the user connects or disconnects
- // and audio device after this API is called.
- audioManager.registerAudioDeviceCallback(audioDeviceCallback, null /*handler*/)
- // Send the initial list of pre-call [CallEndpointCompat]s out to the client. They
- // will be emitted and cached in the Flow & only consumed once the client has
- // collected it.
- trySend(initialEndpoints)
+ val audioDeviceListener = AudioDeviceListener(mContext, callEndpointsUpdater, id)
+ // register a bluetooth listener to surface connected bluetooth devices instead of just
+ // the active bluetooth device
+ val bluetoothProfileListener = BluetoothProfileListener(mContext, callEndpointsUpdater, id)
awaitClose {
Log.i(TAG, "getAvailableStartingCallEndpoints: awaitClose")
- audioManager.unregisterAudioDeviceCallback(audioDeviceCallback)
+ bluetoothProfileListener.close()
+ audioDeviceListener.close()
CallEndpointUuidTracker.endSession(id)
}
}
diff --git a/core/core-telecom/src/main/java/androidx/core/telecom/internal/AudioDeviceListener.kt b/core/core-telecom/src/main/java/androidx/core/telecom/internal/AudioDeviceListener.kt
new file mode 100644
index 0000000..aab87a6
--- /dev/null
+++ b/core/core-telecom/src/main/java/androidx/core/telecom/internal/AudioDeviceListener.kt
@@ -0,0 +1,72 @@
+/*
+ * Copyright 2024 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT 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.core.telecom.internal
+
+import android.content.Context
+import android.media.AudioDeviceCallback
+import android.media.AudioDeviceInfo
+import android.media.AudioManager
+import android.os.Build
+import androidx.annotation.RequiresApi
+import androidx.core.telecom.internal.utils.AudioManagerUtil.Companion.getAvailableAudioDevices
+import androidx.core.telecom.internal.utils.EndpointUtils.Companion.getEndpointsFromAudioDeviceInfo
+
+/**
+ * This class is responsible for getting [AudioDeviceInfo]s from the [AudioManager] pre-call and
+ * emitting them to the [PreCallEndpointsUpdater] as [androidx.core.telecom.CallEndpointCompat]s
+ */
+@RequiresApi(Build.VERSION_CODES.O)
+internal class AudioDeviceListener(
+ val mContext: Context,
+ val mPreCallEndpoints: PreCallEndpointsUpdater,
+ private val mUuidSessionId: Int
+) : AutoCloseable, AudioDeviceCallback() {
+ val mAudioManager = mContext.getSystemService(Context.AUDIO_SERVICE) as AudioManager
+
+ init {
+ // [AudioDeviceInfo] <-- AudioManager / platform
+ val initialAudioDevices = getAvailableAudioDevices(mAudioManager)
+ // [CallEndpoints] <-- [AudioDeviceInfo]
+ val initialEndpoints =
+ getEndpointsFromAudioDeviceInfo(mContext, mUuidSessionId, initialAudioDevices)
+ mAudioManager.registerAudioDeviceCallback(this, null /*handler*/)
+ // Send the initial list of pre-call [CallEndpointCompat]s out to the client. They
+ // will be emitted and cached in the Flow & only consumed once the client has
+ // collected it.
+ mPreCallEndpoints.endpointsAddedUpdate(initialEndpoints)
+ }
+
+ override fun close() {
+ mAudioManager.unregisterAudioDeviceCallback(this)
+ }
+
+ override fun onAudioDevicesAdded(addedDevices: Array<out AudioDeviceInfo>?) {
+ if (addedDevices != null) {
+ mPreCallEndpoints.endpointsAddedUpdate(
+ getEndpointsFromAudioDeviceInfo(mContext, mUuidSessionId, addedDevices.toList())
+ )
+ }
+ }
+
+ override fun onAudioDevicesRemoved(removedDevices: Array<out AudioDeviceInfo>?) {
+ if (removedDevices != null) {
+ mPreCallEndpoints.endpointsRemovedUpdate(
+ getEndpointsFromAudioDeviceInfo(mContext, mUuidSessionId, removedDevices.toList())
+ )
+ }
+ }
+}
diff --git a/core/core-telecom/src/main/java/androidx/core/telecom/internal/BluetoothProfileListener.kt b/core/core-telecom/src/main/java/androidx/core/telecom/internal/BluetoothProfileListener.kt
new file mode 100644
index 0000000..529d205
--- /dev/null
+++ b/core/core-telecom/src/main/java/androidx/core/telecom/internal/BluetoothProfileListener.kt
@@ -0,0 +1,170 @@
+/*
+ * Copyright 2024 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT 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.core.telecom.internal
+
+import android.bluetooth.BluetoothAdapter
+import android.bluetooth.BluetoothDevice
+import android.bluetooth.BluetoothManager
+import android.bluetooth.BluetoothProfile
+import android.content.Context
+import android.os.Build
+import android.util.Log
+import androidx.annotation.RequiresApi
+import androidx.core.telecom.CallEndpointCompat
+import androidx.core.telecom.internal.utils.EndpointUtils
+
+/**
+ * This class is responsible for getting [BluetoothProfile]s from the [BluetoothManager] pre-call
+ * and emitting them to the [PreCallEndpointsUpdater] as [androidx.core.telecom.CallEndpointCompat]s
+ */
+@RequiresApi(Build.VERSION_CODES.O)
+internal class BluetoothProfileListener(
+ context: Context,
+ private val mPreCallEndpointsUpdater: PreCallEndpointsUpdater,
+ private val mUuidSessionId: Int,
+) : BluetoothProfile.ServiceListener, AutoCloseable {
+ /** Constants used for this class */
+ companion object {
+ private val TAG: String = BluetoothProfileListener::class.java.simpleName
+ private val BLUETOOTH_PROFILES =
+ listOf(
+ BluetoothProfile.HEADSET,
+ BluetoothProfile.LE_AUDIO,
+ BluetoothProfile.HEARING_AID
+ )
+ }
+
+ /** Managers used for this class */
+ private val mBluetoothManager: BluetoothManager? =
+ context.getSystemService(Context.BLUETOOTH_SERVICE) as BluetoothManager
+ private val mBluetoothAdapter: BluetoothAdapter? = mBluetoothManager?.adapter
+
+ /**
+ * Internal class tracking. Need to track the endpoints so that when a profile is disconnected,
+ * the client can be informed. Also, for cleanup purposes, the proxy should be tracked to close
+ * when the pre-call endpoints API job is cancelled.
+ */
+ private data class ProfileData(
+ val endpoints: MutableList<CallEndpointCompat>?,
+ val proxy: BluetoothProfile?
+ )
+
+ private val mProfileToData: HashMap<Int, ProfileData> = HashMap()
+
+ /** On class init, get the proxies in order for the profile service connection to establish */
+ init {
+ getBluetoothProfileProxies(context)
+ }
+
+ /** When the listener is destroyed, close the proxies that were connected */
+ override fun close() {
+ Log.i(TAG, "close: uuidSessionId=[$mUuidSessionId]")
+ closeBluetoothProfileProxies()
+ }
+
+ private fun getBluetoothProfileProxies(context: Context) {
+ BLUETOOTH_PROFILES.forEach { profile ->
+ runCatching {
+ val hasProxy = mBluetoothAdapter?.getProfileProxy(context, this, profile)
+ Log.d(TAG, "gBPP: btProfile=[$profile] isConnect=[$hasProxy]")
+ }
+ .onFailure { e ->
+ Log.e(TAG, "gBPP: hit exception while getting bluetooth profile=[$profile]", e)
+ }
+ }
+ }
+
+ private fun closeBluetoothProfileProxies() {
+ mProfileToData.entries
+ .filter { (_, profileData) -> profileData.proxy != null }
+ .forEach { (profile, profileData) ->
+ runCatching { mBluetoothAdapter?.closeProfileProxy(profile, profileData.proxy) }
+ .onFailure { e ->
+ Log.e(
+ TAG,
+ "cBPP: hit exception when closing proxy for profile=[$profile]",
+ e
+ )
+ }
+ }
+ }
+
+ override fun onServiceConnected(profile: Int, proxy: BluetoothProfile?) {
+ Log.i(TAG, "onServiceConnected: profile=[$profile], proxy=[$proxy]")
+ val endpoints: MutableList<CallEndpointCompat> = ArrayList()
+ if (proxy != null) {
+ for (device in proxy.connectedDevices) {
+ endpoints.add(makeEndpoint(device))
+ }
+ }
+ // populate internal map for profile
+ mProfileToData[profile] = ProfileData(endpoints.toMutableList(), proxy)
+ // update client
+ mPreCallEndpointsUpdater.endpointsAddedUpdate(endpoints)
+ }
+
+ override fun onServiceDisconnected(profile: Int) {
+ Log.i(TAG, "onServiceDisconnected: profile=[$profile]")
+ val endpointsToRemove = mProfileToData[profile]?.endpoints ?: mutableListOf()
+ // clear internal map for profile
+ mProfileToData[profile] = ProfileData(mutableListOf(), null)
+ // update the client
+ mPreCallEndpointsUpdater.endpointsRemovedUpdate(endpointsToRemove.toList())
+ }
+
+ /**
+ * ============================================================================================
+ * Helpers
+ * ============================================================================================
+ */
+ private fun getBluetoothDeviceName(device: BluetoothDevice): String {
+ var name: String = EndpointUtils.BLUETOOTH_DEVICE_DEFAULT_NAME
+ try {
+ name = device.name
+ } catch (e: SecurityException) {
+ Log.e(TAG, "getBluetoothDeviceName: hit SecurityException while getting device name", e)
+ }
+ return name
+ }
+
+ private fun getBluetoothDeviceAddress(device: BluetoothDevice): String {
+ var address: String = CallEndpointCompat.UNKNOWN_MAC_ADDRESS
+ try {
+ address = device.address
+ } catch (e: Exception) {
+ Log.e(TAG, "getBluetoothDeviceAddress: hit exception while getting device address", e)
+ }
+ return address
+ }
+
+ private fun makeEndpoint(device: BluetoothDevice): CallEndpointCompat {
+ val bluetoothDeviceName = getBluetoothDeviceName(device)
+ val uuidForBluetoothDevice =
+ CallEndpointUuidTracker.getUuid(
+ mUuidSessionId,
+ CallEndpointCompat.TYPE_BLUETOOTH,
+ bluetoothDeviceName
+ )
+ val callEndpoint =
+ CallEndpointCompat(
+ bluetoothDeviceName,
+ CallEndpointCompat.TYPE_BLUETOOTH,
+ uuidForBluetoothDevice
+ )
+ callEndpoint.mMackAddress = getBluetoothDeviceAddress(device)
+ return callEndpoint
+ }
+}
diff --git a/core/core-telecom/src/main/java/androidx/core/telecom/internal/CallSession.kt b/core/core-telecom/src/main/java/androidx/core/telecom/internal/CallSession.kt
index a96b470..9bbd6eb 100644
--- a/core/core-telecom/src/main/java/androidx/core/telecom/internal/CallSession.kt
+++ b/core/core-telecom/src/main/java/androidx/core/telecom/internal/CallSession.kt
@@ -134,7 +134,7 @@
platformEndpoint.endpointType,
jetpackUuid
)
- Log.d(TAG, " n=[${platformEndpoint.endpointName}] plat=[${platformEndpoint}] --> jet=[$j]")
+ Log.i(TAG, " n=[${platformEndpoint.endpointName}] plat=[${platformEndpoint}] --> jet=[$j]")
return j
}
diff --git a/core/core-telecom/src/main/java/androidx/core/telecom/internal/PreCallEndpoints.kt b/core/core-telecom/src/main/java/androidx/core/telecom/internal/PreCallEndpointsUpdater.kt
similarity index 95%
rename from core/core-telecom/src/main/java/androidx/core/telecom/internal/PreCallEndpoints.kt
rename to core/core-telecom/src/main/java/androidx/core/telecom/internal/PreCallEndpointsUpdater.kt
index d04b339..837d51c 100644
--- a/core/core-telecom/src/main/java/androidx/core/telecom/internal/PreCallEndpoints.kt
+++ b/core/core-telecom/src/main/java/androidx/core/telecom/internal/PreCallEndpointsUpdater.kt
@@ -24,18 +24,17 @@
import kotlinx.coroutines.channels.SendChannel
@RequiresApi(Build.VERSION_CODES.O)
-internal class PreCallEndpoints(
- var mCurrentDevices: MutableList<CallEndpointCompat>,
+internal class PreCallEndpointsUpdater(
+ var mCurrentDevices: MutableList<CallEndpointCompat> = mutableListOf(),
var mSendChannel: SendChannel<List<CallEndpointCompat>>
) {
// earpiece, speaker, unknown, wired_headset
val mNonBluetoothEndpoints: HashMap<Int, CallEndpointCompat> = HashMap()
-
// all bt endpoints
val mBluetoothEndpoints: HashMap<String, CallEndpointCompat> = HashMap()
companion object {
- private val TAG: String = PreCallEndpoints::class.java.simpleName.toString()
+ private val TAG: String = PreCallEndpointsUpdater::class.java.simpleName.toString()
// endpoints added constants
const val ALREADY_TRACKING_ENDPOINT: Int = 0
diff --git a/development/importMaven/src/main/kotlin/androidx/build/importMaven/ArtifactResolver.kt b/development/importMaven/src/main/kotlin/androidx/build/importMaven/ArtifactResolver.kt
index 185d6ac..d4c4c46 100644
--- a/development/importMaven/src/main/kotlin/androidx/build/importMaven/ArtifactResolver.kt
+++ b/development/importMaven/src/main/kotlin/androidx/build/importMaven/ArtifactResolver.kt
@@ -213,9 +213,9 @@
val artifacts = resolutionList.flatMap { resolution ->
resolution.artifacts
}
- val dependenciesPassedVerification = resolutionList.map { resolution ->
+ val dependenciesPassedVerification = resolutionList.all { resolution ->
resolution.dependenciesPassedVerification
- }.all { it == true }
+ }
return ArtifactsResolutionResult(artifacts, dependenciesPassedVerification)
}
diff --git a/development/importMaven/src/main/kotlin/androidx/build/importMaven/MavenRepositoryProxy.kt b/development/importMaven/src/main/kotlin/androidx/build/importMaven/MavenRepositoryProxy.kt
index 85568ab..7318bc3 100644
--- a/development/importMaven/src/main/kotlin/androidx/build/importMaven/MavenRepositoryProxy.kt
+++ b/development/importMaven/src/main/kotlin/androidx/build/importMaven/MavenRepositoryProxy.kt
@@ -102,11 +102,13 @@
server.resolvedConnectors().first().let {
URL(
it.type.name.lowercase(),
- it.host,
+ // Always use `localhost` for local loopback given this is secure for `http` URLs.
+ "localhost",
it.port,
""
)
- URI("${it.type.name.lowercase()}://${it.host}:${it.port}")
+ // Always use `localhost` for local loopback given this is secure for `http` URIs.
+ URI("${it.type.name.lowercase()}://localhost:${it.port}")
}
}
block(url)
diff --git a/development/importMaven/src/test/kotlin/androidx/build/importMaven/ImportVersionCatalogTest.kt b/development/importMaven/src/test/kotlin/androidx/build/importMaven/ImportVersionCatalogTest.kt
index b80401b..a8b7238c 100644
--- a/development/importMaven/src/test/kotlin/androidx/build/importMaven/ImportVersionCatalogTest.kt
+++ b/development/importMaven/src/test/kotlin/androidx/build/importMaven/ImportVersionCatalogTest.kt
@@ -17,7 +17,6 @@
package androidx.build.importMaven
import com.google.common.truth.Truth.assertThat
-import okio.FileSystem
import org.junit.Test
class ImportVersionCatalogTest {
@@ -29,7 +28,6 @@
fun load() {
val path = EnvironmentConfig.supportRoot.resolve("gradle/libs.versions.toml")
val versions = ImportVersionCatalog.load(
- FileSystem.SYSTEM,
path
)
assertThat(
diff --git a/development/update_studio.sh b/development/update_studio.sh
index d4b0ff3..d0ff902 100755
--- a/development/update_studio.sh
+++ b/development/update_studio.sh
@@ -15,8 +15,8 @@
# Versions that the user should update when running this script
echo Getting Studio version and link
-AGP_VERSION=${1:-8.9.0-alpha01}
-STUDIO_VERSION_STRING=${2:-"Android Studio Meerkat | 2024.3.1 Canary 1"}
+AGP_VERSION=${1:-8.9.0-alpha06}
+STUDIO_VERSION_STRING=${2:-"Android Studio Meerkat | 2024.3.1 Canary 6"}
# Get studio version number from version name
STUDIO_IFRAME_LINK=`curl "https://developer.android.com/studio/archive.html" | grep "<iframe " | sed "s/.* src=\"\([^\"]*\)\".*/\1/g"`
diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml
index 510a96e..7012d9e 100644
--- a/gradle/libs.versions.toml
+++ b/gradle/libs.versions.toml
@@ -2,13 +2,13 @@
# -----------------------------------------------------------------------------
# All of the following should be updated in sync.
# -----------------------------------------------------------------------------
-androidGradlePlugin = "8.9.0-alpha01"
+androidGradlePlugin = "8.9.0-alpha06"
# NOTE: When updating the lint version we also need to update the `api` version
# supported by `IssueRegistry`'s.' For e.g. r.android.com/1331903
-androidLint = "31.9.0-alpha01"
+androidLint = "31.9.0-alpha06"
# Once you have a chosen version of AGP to upgrade to, go to
# https://developer.android.com/studio/archive and find the matching version of Studio.
-androidStudio = "2024.3.1.1"
+androidStudio = "2024.3.1.6"
# -----------------------------------------------------------------------------
androidLintMin = "31.1.0"
diff --git a/gradle/verification-keyring.keys b/gradle/verification-keyring.keys
index 322947c..b9e6596 100644
--- a/gradle/verification-keyring.keys
+++ b/gradle/verification-keyring.keys
@@ -4081,6 +4081,40 @@
=Q+9k
-----END PGP PUBLIC KEY BLOCK-----
+pub EB095DA7D2F6AC0E
+sub 603D72C90616CD6B
+-----BEGIN PGP PUBLIC KEY BLOCK-----
+Version: BCPG v@RELEASE_NAME@
+
+mQGNBGBm/LQBDADMr/VPcTvE6k3wEYxq5kZusnDCDTsI6RK51d4oMwaRc3Z0jtZ0
+CfyWocZBok4rMbZAVnE3Q8pMyikGGUnc8ZsWoPEmJyCpw/2Orj0QqZhIgYMQ31Uq
+tiGZF/G4w9phLIkFgU9BLGYjRNM69R0oE/Tj8mjguvnKzYM3GjkY6nDsgWCM5TJX
+01k4sdLs0dVg86m4keq+SeS9uEwnINZTh6kQUKsW6aHvvPXze/UPoaZqxgXDjF+F
+JrPwW8yDllkbzpbo53ulz1TL5RsIH3daUwxXG3ciovUXG/b2ZRuWjtH7Gn/AvCNL
+0RXdHK3A2I23zCooOE+we2D45QUHm/vcmvsnbxOU7Tslm2DsnYxBjf5dAl2yZn+J
+FSrV91Bbd5ZXi1UkkGjBzAgbHDwdMvL9K6fTO9NwjXyBpiHy6ukIOObn9uIgDSSa
+xPnqgeykSv+RZEea8ML4BSif5RJYlmILEzJhH4rtX9X+t8BZv+ZoaN6p/qYg4/2+
+XfSUPmCJjlUaIUUAEQEAAbkBjQRgZvy0AQwAtuysL4l1wLjDIgva/+mD76cekxRu
+54s7zYOkh/87NIZ6tPkPlw/w+m7CEohurx2sQSPrClJoaMqxlPgRCmmj5JQVEC79
+9pkvJZb+QwslD57P84LYntiqpr+nmmR6vgDlZxaiRa6OVUllUTYwDpHcQ8MocXan
+e4iAea99acxL60zOimPeaPVK9tXZQ1nKPVIWs6RSYna54FFZn0uXfG4Qx8xEAXYd
+cUj5oEh4JFtEcP+55YVWopfi+zIQwwJ7JaO6ZZhHco4OpCwTauB/hX2SVdSijV32
+O9IhHXO3xPIi+5RC/iwHrhF3kexNLlfVWMnb/RWC7ROQXdUEK4YQGLy7+dFd7lKQ
+5gbUoAhuqWOnHyaSAyNlFGum3FR5oroad0eKS5jzk2n4UMPNDAoo7yEi1cdCrykD
+Jeb1GQD6ucQx+oqLkc1OGwqVjJU3FDQj/yvSCPKmst9lSGS3JH9l6ac033Db2qAP
+kUxnhw2xN4LHk2Ioovn5SZu1IUzH8/i+HhpfABEBAAGJAbYEGAEKACAWIQR0QPH3
+0nusEV+VPVXrCV2n0vasDgUCYGb8tAIbDAAKCRDrCV2n0vasDkSBC/91fDW0V6U8
+pRwW6HFruAnq/0uQ2gISrmDlpJzsgSO6HQQfho1T/7uuYhnBGyU4dxIF4G9A+Ehh
+2iwhB90JzCNLstTW6ueSWMK+4hvBpfx3kCbs2oxu0z8ZHroxE9I7e5XqDQOazANn
+eLRZJ5SArg1dFGYveBRlyjE55CmDQyj58aJkMbLAAJrdrMkFZHwbeBKOs3ph0zn5
+NvSBDUP8A3wlUXuSySeXYCUIj2k4Q6zJodnhP76ivfpu0eZn4UnD0sI8YdoJOsNK
+gDRO6fR9kEEh/XGY082B1Ad6tO2nea1MIVF0GIgfh3ezd3YcG4Rip0uqIPr7yxpT
+mVEA8wVvpWg8+wY2/xvLuHtZD59bK4KlQ9m+4W5WhursrdUfSI2EuXNp7xYwNRVf
+elApmsOOWqONqWg4leirxkWUMz7XDArDPuei4Qk8VF4/0yfGOVSh8VHQrIauzqrN
+p4LbYC9sii1fqxQTFVGPPhv6Wujd/eUuUeURZbKgpHIfniDXLiaTUyc=
+=aMmv
+-----END PGP PUBLIC KEY BLOCK-----
+
pub EB380DC13C39F675
uid Mark Vedder <[email protected]>
diff --git a/gradle/verification-metadata.xml b/gradle/verification-metadata.xml
index 5f5b0c8..c5a4c74 100644
--- a/gradle/verification-metadata.xml
+++ b/gradle/verification-metadata.xml
@@ -316,6 +316,7 @@
<trusted-key id="719F7C29985A8E95F58F47194D8159D6A1159B69" group="dev.zacsweers.moshix"/>
<trusted-key id="720746177725A89207A7075BFD5DEA07FCB690A8" group="org.codehaus.mojo"/>
<trusted-key id="73976C9C39C1479B84E2641A5A68A2249128E2C6" group="com.google.crypto.tink" name="tink-android"/>
+ <trusted-key id="7440F1F7D27BAC115F953D55EB095DA7D2F6AC0E" group="org.tensorflow"/>
<trusted-key id="748F15B2CF9BA8F024155E6ED7C92B70FA1C814D" group="org.apache.logging.log4j"/>
<trusted-key id="7615AD56144DF2376F49D98B1669C4BB543E0445" group="com.google.errorprone"/>
<trusted-key id="7616EB882DAF57A11477AAF559A252FB1199D873" group="com.google.code.findbugs"/>
diff --git a/health/connect/connect-client/src/main/java/androidx/health/connect/client/HealthConnectFeatures.kt b/health/connect/connect-client/src/main/java/androidx/health/connect/client/HealthConnectFeatures.kt
index 426ed81..6bb354f 100644
--- a/health/connect/connect-client/src/main/java/androidx/health/connect/client/HealthConnectFeatures.kt
+++ b/health/connect/connect-client/src/main/java/androidx/health/connect/client/HealthConnectFeatures.kt
@@ -89,14 +89,14 @@
mapOf(
FEATURE_READ_HEALTH_DATA_IN_BACKGROUND to
HealthConnectVersionInfo(
- apkVersionCode = 165072,
+ apkVersionCode = 171302,
platformVersion = SDK_EXT_13_PLATFORM_VERSION
),
FEATURE_SKIN_TEMPERATURE to
HealthConnectVersionInfo(platformVersion = SDK_EXT_13_PLATFORM_VERSION),
FEATURE_READ_HEALTH_DATA_HISTORY to
HealthConnectVersionInfo(
- apkVersionCode = 165072,
+ apkVersionCode = 171302,
platformVersion = SDK_EXT_13_PLATFORM_VERSION
),
FEATURE_PLANNED_EXERCISE to
diff --git a/libraryversions.toml b/libraryversions.toml
index 0b26c3d..ae5da12 100644
--- a/libraryversions.toml
+++ b/libraryversions.toml
@@ -19,8 +19,8 @@
CAMERA_TESTING = "1.0.0-alpha01"
CAMERA_VIEWFINDER = "1.4.0-alpha12"
CARDVIEW = "1.1.0-alpha01"
-CAR_APP = "1.7.0-beta03"
-COLLECTION = "1.5.0-beta01"
+CAR_APP = "1.7.0-rc01"
+COLLECTION = "1.5.0-beta02"
COMPOSE = "1.8.0-alpha08"
COMPOSE_MATERIAL3 = "1.4.0-alpha05"
COMPOSE_MATERIAL3_ADAPTIVE = "1.1.0-alpha08"
diff --git a/media/version-compat-tests/current/client/src/androidTest/java/android/support/mediacompat/client/AudioAttributesCompatTest.java b/media/version-compat-tests/current/client/src/androidTest/java/android/support/mediacompat/client/AudioAttributesCompatTest.java
index cfdb229..8229f75 100644
--- a/media/version-compat-tests/current/client/src/androidTest/java/android/support/mediacompat/client/AudioAttributesCompatTest.java
+++ b/media/version-compat-tests/current/client/src/androidTest/java/android/support/mediacompat/client/AudioAttributesCompatTest.java
@@ -178,6 +178,7 @@
}
@Test
+ @SdkSuppress(maxSdkVersion = 34) // b/384972088: Failing on SDK 35
public void testUsageAndContentTypeInferredFromLegacyStreamType() {
androidx.media.AudioAttributesCompat alarmAAC =
mkBuilder(AudioManager.STREAM_ALARM).build();
diff --git a/media/version-compat-tests/previous/client/src/androidTest/java/android/support/mediacompat/client/AudioAttributesCompatTest.java b/media/version-compat-tests/previous/client/src/androidTest/java/android/support/mediacompat/client/AudioAttributesCompatTest.java
index 6cc962e..03e0c38 100644
--- a/media/version-compat-tests/previous/client/src/androidTest/java/android/support/mediacompat/client/AudioAttributesCompatTest.java
+++ b/media/version-compat-tests/previous/client/src/androidTest/java/android/support/mediacompat/client/AudioAttributesCompatTest.java
@@ -165,6 +165,7 @@
}
@Test
+ @SdkSuppress(maxSdkVersion = 34) // b/384972088: Failing on SDK 35
public void testUsageAndContentTypeInferredFromLegacyStreamType() {
AudioAttributesCompat alarmAAC = mkBuilder(AudioManager.STREAM_ALARM).build();
assertThat(alarmAAC.getUsage(), equalTo(AudioAttributesCompat.USAGE_ALARM));
diff --git a/navigation/navigation-runtime/src/androidTest/java/androidx/navigation/ActivityNavigatorTest.kt b/navigation/navigation-runtime/src/androidTest/java/androidx/navigation/ActivityNavigatorTest.kt
index 98bf240..083e89c 100644
--- a/navigation/navigation-runtime/src/androidTest/java/androidx/navigation/ActivityNavigatorTest.kt
+++ b/navigation/navigation-runtime/src/androidTest/java/androidx/navigation/ActivityNavigatorTest.kt
@@ -25,6 +25,7 @@
import android.os.Bundle
import android.view.View
import androidx.core.app.ActivityOptionsCompat
+import androidx.savedstate.SavedState
import androidx.test.annotation.UiThreadTest
import androidx.test.ext.junit.runners.AndroidJUnit4
import androidx.test.filters.LargeTest
@@ -247,6 +248,47 @@
}
@Test
+ fun navigateDataPatternIntWithNavType() {
+ val navType =
+ object : NavType<Int>(false) {
+ override fun put(bundle: SavedState, key: String, value: Int) {
+ IntType.put(bundle, key, value)
+ }
+
+ override fun get(bundle: SavedState, key: String): Int? = IntType[bundle, key]
+
+ override fun parseValue(value: String): Int =
+ value.replace("Serialized", "").toInt()
+
+ override fun serializeAsValue(value: Int): String = "${value}Serialized"
+ }
+ val targetDestination =
+ activityNavigator.createDestination().apply {
+ id = TARGET_ID
+ setDataPattern(TARGET_DATA_PATTERN)
+ setComponentName(ComponentName(activityRule.activity, TargetActivity::class.java))
+ addArgument(TARGET_ARGUMENT_NAME, NavArgument.Builder().setType(navType).build())
+ }
+ val args = Bundle().apply { putInt(TARGET_ARGUMENT_NAME, TARGET_ARGUMENT_INT_VALUE) }
+ activityNavigator.navigate(targetDestination, args, null, null)
+
+ val targetActivity = waitForActivity()
+ val intent = targetActivity.intent
+ assertThat(intent).isNotNull()
+ assertWithMessage("Intent should have data set with argument filled in")
+ .that(intent.data?.toString())
+ .isEqualTo(
+ TARGET_DATA_PATTERN.replace(
+ "{$TARGET_ARGUMENT_NAME}",
+ "${TARGET_ARGUMENT_INT_VALUE}Serialized"
+ )
+ )
+ assertWithMessage("Intent should have its arguments in its extras")
+ .that(intent.getIntExtra(TARGET_ARGUMENT_NAME, -1))
+ .isEqualTo(TARGET_ARGUMENT_INT_VALUE)
+ }
+
+ @Test
fun navigateDataPatternMissingArgument() {
val targetDestination =
activityNavigator.createDestination().apply {
diff --git a/navigation/navigation-runtime/src/main/java/androidx/navigation/ActivityNavigator.kt b/navigation/navigation-runtime/src/main/java/androidx/navigation/ActivityNavigator.kt
index 3ab7bd0..4fb24ac 100644
--- a/navigation/navigation-runtime/src/main/java/androidx/navigation/ActivityNavigator.kt
+++ b/navigation/navigation-runtime/src/main/java/androidx/navigation/ActivityNavigator.kt
@@ -93,14 +93,16 @@
val matcher = fillInPattern.matcher(dataPattern)
while (matcher.find()) {
val argName = matcher.group(1)
- if (args.containsKey(argName)) {
- matcher.appendReplacement(data, "")
- data.append(Uri.encode(args[argName].toString()))
- } else {
- throw IllegalArgumentException(
- "Could not find $argName in $args to fill data pattern $dataPattern"
- )
+ require(args.containsKey(argName)) {
+ "Could not find $argName in $args to fill data pattern $dataPattern"
}
+ matcher.appendReplacement(data, "")
+ // Serialize with NavType if present, otherwise fallback to toString()
+ val navType = destination.arguments[argName!!]?.type
+ val value =
+ navType?.serializeAsValue(navType[args, argName])
+ ?: Uri.encode(args[argName].toString())
+ data.append(value)
}
matcher.appendTail(data)
intent.data = Uri.parse(data.toString())
diff --git a/performance/performance-annotation/README.md b/performance/performance-annotation/README.md
index 2ab0c3d..b37c607 100644
--- a/performance/performance-annotation/README.md
+++ b/performance/performance-annotation/README.md
@@ -1 +1 @@
-This library is a **compile-time** only dependency.
+The annotation defined in this library only affects Android.
diff --git a/performance/performance-annotation/src/androidMain/kotlin/dalvik/annotation/optimization/NeverInline.android.kt b/performance/performance-annotation/src/androidMain/kotlin/dalvik/annotation/optimization/NeverInline.android.kt
index 50e22dc..a44f0ff 100644
--- a/performance/performance-annotation/src/androidMain/kotlin/dalvik/annotation/optimization/NeverInline.android.kt
+++ b/performance/performance-annotation/src/androidMain/kotlin/dalvik/annotation/optimization/NeverInline.android.kt
@@ -14,8 +14,10 @@
* limitations under the License.
*/
+@file:Suppress("RedundantVisibilityModifier")
+
package dalvik.annotation.optimization
@Retention(AnnotationRetention.BINARY)
@Target(AnnotationTarget.CONSTRUCTOR, AnnotationTarget.FUNCTION)
-public actual annotation class NeverInline()
+public actual annotation class NeverInline
diff --git a/performance/performance-annotation/src/commonMain/kotlin/dalvik/annotation/optimization/NeverInline.kt b/performance/performance-annotation/src/commonMain/kotlin/dalvik/annotation/optimization/NeverInline.kt
index 89cbfe3..99f736b 100644
--- a/performance/performance-annotation/src/commonMain/kotlin/dalvik/annotation/optimization/NeverInline.kt
+++ b/performance/performance-annotation/src/commonMain/kotlin/dalvik/annotation/optimization/NeverInline.kt
@@ -15,6 +15,7 @@
*/
@file:OptIn(ExperimentalMultiplatform::class)
+@file:Suppress("RedundantVisibilityModifier")
package dalvik.annotation.optimization
diff --git a/performance/performance-unsafe/README.md b/performance/performance-unsafe/README.md
index 6a22e41..b69d197 100644
--- a/performance/performance-unsafe/README.md
+++ b/performance/performance-unsafe/README.md
@@ -1,2 +1,2 @@
-This library is a **compile-time** only dependency for Android.
+This library is a dependency for Android only.
It is not to be used for other targets.
diff --git a/performance/performance-unsafe/src/main/resources/META-INF/proguard/unsafe.pro b/performance/performance-unsafe/src/main/resources/META-INF/proguard/unsafe.pro
new file mode 100644
index 0000000..d908c40
--- /dev/null
+++ b/performance/performance-unsafe/src/main/resources/META-INF/proguard/unsafe.pro
@@ -0,0 +1,3 @@
+-keep class sun.misc.Unsafe {
+ *;
+}
diff --git a/room/integration-tests/kotlintestapp/src/androidTest/java/androidx/room/integration/kotlintestapp/test/SuspendingQueryTest.kt b/room/integration-tests/kotlintestapp/src/androidTest/java/androidx/room/integration/kotlintestapp/test/SuspendingQueryTest.kt
index 05d1a91..3d67b8b 100644
--- a/room/integration-tests/kotlintestapp/src/androidTest/java/androidx/room/integration/kotlintestapp/test/SuspendingQueryTest.kt
+++ b/room/integration-tests/kotlintestapp/src/androidTest/java/androidx/room/integration/kotlintestapp/test/SuspendingQueryTest.kt
@@ -223,7 +223,7 @@
@Test
@Suppress("DEPRECATION")
- fun suspendingBlock_beginEndTransaction_blockingDaoMethods() {
+ fun suspendingBlock_beginEndTransaction_blockingDaoFunctions() {
runBlocking {
try {
database.beginTransaction()
@@ -266,7 +266,7 @@
}
@Test
- fun suspendingBlock_blockingDaoMethods() {
+ fun suspendingBlock_blockingDaoFunctions() {
runBlocking {
booksDao.insertPublisherSuspend(TestUtil.PUBLISHER.publisherId, TestUtil.PUBLISHER.name)
@@ -624,7 +624,7 @@
}
@Test
- fun withTransaction_blockingDaoMethods() {
+ fun withTransaction_blockingDaoFunctions() {
runBlocking {
database.withTransaction {
booksDao.insertPublisherSuspend(
@@ -641,7 +641,7 @@
}
@Test
- fun withTransaction_blockingDaoMethods_contextSwitch() {
+ fun withTransaction_blockingDaoFunctions_contextSwitch() {
runBlocking {
database.withTransaction {
// normal query
@@ -907,7 +907,7 @@
.addCallback(
object : RoomDatabase.Callback() {
override fun onOpen(db: SupportSQLiteDatabase) {
- // this causes all transaction methods to throw, this can happen IRL
+ // this causes all transaction functions to throw, this can happen IRL
throw RuntimeException("Error opening Database.")
}
}
diff --git a/room/room-common/api/current.ignore b/room/room-common/api/current.ignore
index e328ae6..a124e8c 100644
--- a/room/room-common/api/current.ignore
+++ b/room/room-common/api/current.ignore
@@ -1,4 +1,32 @@
// Baseline format: 1.0
+ChangedType: androidx.room.AutoMigration#spec():
+ Method androidx.room.AutoMigration.spec has changed return type from kotlin.reflect.KClass<?> to java.lang.Class<?>
+ChangedType: androidx.room.Database#entities():
+ Method androidx.room.Database.entities has changed return type from kotlin.reflect.KClass<?>[] to java.lang.Class<?>[]
+ChangedType: androidx.room.Database#views():
+ Method androidx.room.Database.views has changed return type from kotlin.reflect.KClass<?>[] to java.lang.Class<?>[]
+ChangedType: androidx.room.Delete#entity():
+ Method androidx.room.Delete.entity has changed return type from kotlin.reflect.KClass<?> to java.lang.Class<?>
+ChangedType: androidx.room.ForeignKey#entity():
+ Method androidx.room.ForeignKey.entity has changed return type from kotlin.reflect.KClass<?> to java.lang.Class<?>
+ChangedType: androidx.room.Fts4#contentEntity():
+ Method androidx.room.Fts4.contentEntity has changed return type from kotlin.reflect.KClass<?> to java.lang.Class<?>
+ChangedType: androidx.room.Insert#entity():
+ Method androidx.room.Insert.entity has changed return type from kotlin.reflect.KClass<?> to java.lang.Class<?>
+ChangedType: androidx.room.Junction#value():
+ Method androidx.room.Junction.value has changed return type from kotlin.reflect.KClass<?> to java.lang.Class<?>
+ChangedType: androidx.room.RawQuery#observedEntities():
+ Method androidx.room.RawQuery.observedEntities has changed return type from kotlin.reflect.KClass<?>[] to java.lang.Class<?>[]
+ChangedType: androidx.room.Relation#entity():
+ Method androidx.room.Relation.entity has changed return type from kotlin.reflect.KClass<?> to java.lang.Class<?>
+ChangedType: androidx.room.TypeConverters#value():
+ Method androidx.room.TypeConverters.value has changed return type from kotlin.reflect.KClass<?>[] to java.lang.Class<?>[]
+ChangedType: androidx.room.Update#entity():
+ Method androidx.room.Update.entity has changed return type from kotlin.reflect.KClass<?> to java.lang.Class<?>
+ChangedType: androidx.room.Upsert#entity():
+ Method androidx.room.Upsert.entity has changed return type from kotlin.reflect.KClass<?> to java.lang.Class<?>
+
+
ChangedValue: androidx.room.AutoMigration#spec():
Method androidx.room.AutoMigration.spec has changed value from java.lang.Object to Any::class
ChangedValue: androidx.room.Delete#entity():
diff --git a/room/room-common/api/current.txt b/room/room-common/api/current.txt
index 43dd4e3..262cfab 100644
--- a/room/room-common/api/current.txt
+++ b/room/room-common/api/current.txt
@@ -3,10 +3,10 @@
@kotlin.annotation.Retention(kotlin.annotation.AnnotationRetention.BINARY) @kotlin.annotation.Target(allowedTargets=kotlin.annotation.AnnotationTarget.CLASS) public @interface AutoMigration {
method public abstract int from();
- method public abstract kotlin.reflect.KClass<? extends java.lang.Object?> spec() default Any::class;
+ method public abstract Class<? extends java.lang.Object?> spec() default Any::class;
method public abstract int to();
property public abstract int from;
- property public abstract kotlin.reflect.KClass<? extends java.lang.Object?> spec;
+ property public abstract Class<? extends java.lang.Object?> spec;
property public abstract int to;
}
@@ -88,8 +88,8 @@
}
@kotlin.annotation.Retention(kotlin.annotation.AnnotationRetention.BINARY) @kotlin.annotation.Target(allowedTargets=kotlin.annotation.AnnotationTarget.CLASS) public @interface ConstructedBy {
- method public abstract kotlin.reflect.KClass<? extends java.lang.Object?> value();
- property public abstract kotlin.reflect.KClass<? extends java.lang.Object?> value;
+ method public abstract Class<? extends java.lang.Object?> value();
+ property public abstract Class<? extends java.lang.Object?> value;
}
@kotlin.annotation.Retention(kotlin.annotation.AnnotationRetention.BINARY) @kotlin.annotation.Target(allowedTargets=kotlin.annotation.AnnotationTarget.CLASS) public @interface Dao {
@@ -97,15 +97,15 @@
@kotlin.annotation.Retention(kotlin.annotation.AnnotationRetention.BINARY) @kotlin.annotation.Target(allowedTargets=kotlin.annotation.AnnotationTarget.CLASS) public @interface Database {
method public abstract androidx.room.AutoMigration[] autoMigrations();
- method public abstract kotlin.reflect.KClass<? extends java.lang.Object?>[] entities();
+ method public abstract Class<? extends java.lang.Object?>[] entities();
method public abstract boolean exportSchema() default true;
method public abstract int version();
- method public abstract kotlin.reflect.KClass<? extends java.lang.Object?>[] views();
+ method public abstract Class<? extends java.lang.Object?>[] views();
property public abstract androidx.room.AutoMigration[] autoMigrations;
- property public abstract kotlin.reflect.KClass<? extends java.lang.Object?>[] entities;
+ property public abstract Class<? extends java.lang.Object?>[] entities;
property public abstract boolean exportSchema;
property public abstract int version;
- property public abstract kotlin.reflect.KClass<? extends java.lang.Object?>[] views;
+ property public abstract Class<? extends java.lang.Object?>[] views;
}
@kotlin.annotation.Retention(kotlin.annotation.AnnotationRetention.BINARY) @kotlin.annotation.Target(allowedTargets=kotlin.annotation.AnnotationTarget.CLASS) public @interface DatabaseView {
@@ -116,8 +116,8 @@
}
@kotlin.annotation.Retention(kotlin.annotation.AnnotationRetention.BINARY) @kotlin.annotation.Target(allowedTargets=kotlin.annotation.AnnotationTarget.FUNCTION) public @interface Delete {
- method public abstract kotlin.reflect.KClass<? extends java.lang.Object?> entity() default Any::class;
- property public abstract kotlin.reflect.KClass<? extends java.lang.Object?> entity;
+ method public abstract Class<? extends java.lang.Object?> entity() default Any::class;
+ property public abstract Class<? extends java.lang.Object?> entity;
}
@java.lang.annotation.Repeatable(DeleteColumn.Entries::class) @kotlin.annotation.Retention(kotlin.annotation.AnnotationRetention.BINARY) @kotlin.annotation.Target(allowedTargets=kotlin.annotation.AnnotationTarget.CLASS) public @interface DeleteColumn {
@@ -165,13 +165,13 @@
@kotlin.annotation.Retention(kotlin.annotation.AnnotationRetention.BINARY) @kotlin.annotation.Target(allowedTargets={}) public @interface ForeignKey {
method public abstract String[] childColumns();
method public abstract boolean deferred() default false;
- method public abstract kotlin.reflect.KClass<? extends java.lang.Object?> entity();
+ method public abstract Class<? extends java.lang.Object?> entity();
method @androidx.room.ForeignKey.Action public abstract int onDelete() default androidx.room.ForeignKey.NO_ACTION;
method @androidx.room.ForeignKey.Action public abstract int onUpdate() default androidx.room.ForeignKey.NO_ACTION;
method public abstract String[] parentColumns();
property public abstract String[] childColumns;
property public abstract boolean deferred;
- property public abstract kotlin.reflect.KClass<? extends java.lang.Object?> entity;
+ property public abstract Class<? extends java.lang.Object?> entity;
property @androidx.room.ForeignKey.Action public abstract int onDelete;
property @androidx.room.ForeignKey.Action public abstract int onUpdate;
property public abstract String[] parentColumns;
@@ -207,7 +207,7 @@
}
@kotlin.annotation.Retention(kotlin.annotation.AnnotationRetention.BINARY) @kotlin.annotation.Target(allowedTargets=kotlin.annotation.AnnotationTarget.CLASS) public @interface Fts4 {
- method public abstract kotlin.reflect.KClass<? extends java.lang.Object?> contentEntity() default Any::class;
+ method public abstract Class<? extends java.lang.Object?> contentEntity() default Any::class;
method public abstract String languageId() default "";
method public abstract androidx.room.FtsOptions.MatchInfo matchInfo() default androidx.room.FtsOptions.MatchInfo.FTS4;
method public abstract String[] notIndexed();
@@ -215,7 +215,7 @@
method public abstract int[] prefix();
method public abstract String tokenizer() default androidx.room.FtsOptions.TOKENIZER_SIMPLE;
method public abstract String[] tokenizerArgs();
- property public abstract kotlin.reflect.KClass<? extends java.lang.Object?> contentEntity;
+ property public abstract Class<? extends java.lang.Object?> contentEntity;
property public abstract String languageId;
property public abstract androidx.room.FtsOptions.MatchInfo matchInfo;
property public abstract String[] notIndexed;
@@ -267,19 +267,19 @@
}
@kotlin.annotation.Retention(kotlin.annotation.AnnotationRetention.BINARY) @kotlin.annotation.Target(allowedTargets=kotlin.annotation.AnnotationTarget.FUNCTION) public @interface Insert {
- method public abstract kotlin.reflect.KClass<? extends java.lang.Object?> entity() default Any::class;
+ method public abstract Class<? extends java.lang.Object?> entity() default Any::class;
method @androidx.room.OnConflictStrategy public abstract int onConflict() default androidx.room.OnConflictStrategy.ABORT;
- property public abstract kotlin.reflect.KClass<? extends java.lang.Object?> entity;
+ property public abstract Class<? extends java.lang.Object?> entity;
property @androidx.room.OnConflictStrategy public abstract int onConflict;
}
@kotlin.annotation.Retention(kotlin.annotation.AnnotationRetention.BINARY) @kotlin.annotation.Target(allowedTargets={}) public @interface Junction {
method public abstract String entityColumn() default "";
method public abstract String parentColumn() default "";
- method public abstract kotlin.reflect.KClass<? extends java.lang.Object?> value();
+ method public abstract Class<? extends java.lang.Object?> value();
property public abstract String entityColumn;
property public abstract String parentColumn;
- property public abstract kotlin.reflect.KClass<? extends java.lang.Object?> value;
+ property public abstract Class<? extends java.lang.Object?> value;
}
@kotlin.annotation.Retention(kotlin.annotation.AnnotationRetention.BINARY) @kotlin.annotation.Target(allowedTargets=kotlin.annotation.AnnotationTarget.TYPE) public @interface MapColumn {
@@ -344,18 +344,18 @@
}
@kotlin.annotation.Retention(kotlin.annotation.AnnotationRetention.BINARY) @kotlin.annotation.Target(allowedTargets=kotlin.annotation.AnnotationTarget.FUNCTION) public @interface RawQuery {
- method public abstract kotlin.reflect.KClass<? extends java.lang.Object?>[] observedEntities();
- property public abstract kotlin.reflect.KClass<? extends java.lang.Object?>[] observedEntities;
+ method public abstract Class<? extends java.lang.Object?>[] observedEntities();
+ property public abstract Class<? extends java.lang.Object?>[] observedEntities;
}
@kotlin.annotation.Retention(kotlin.annotation.AnnotationRetention.BINARY) @kotlin.annotation.Target(allowedTargets={kotlin.annotation.AnnotationTarget.FIELD, kotlin.annotation.AnnotationTarget.FUNCTION}) public @interface Relation {
method public abstract androidx.room.Junction associateBy() default androidx.room.Junction(Any::class);
- method public abstract kotlin.reflect.KClass<? extends java.lang.Object?> entity() default Any::class;
+ method public abstract Class<? extends java.lang.Object?> entity() default Any::class;
method public abstract String entityColumn();
method public abstract String parentColumn();
method public abstract String[] projection();
property public abstract androidx.room.Junction associateBy;
- property public abstract kotlin.reflect.KClass<? extends java.lang.Object?> entity;
+ property public abstract Class<? extends java.lang.Object?> entity;
property public abstract String entityColumn;
property public abstract String parentColumn;
property public abstract String[] projection;
@@ -450,21 +450,21 @@
@kotlin.annotation.Retention(kotlin.annotation.AnnotationRetention.BINARY) @kotlin.annotation.Target(allowedTargets={kotlin.annotation.AnnotationTarget.FUNCTION, kotlin.annotation.AnnotationTarget.VALUE_PARAMETER, kotlin.annotation.AnnotationTarget.FIELD, kotlin.annotation.AnnotationTarget.CLASS}) public @interface TypeConverters {
method public abstract androidx.room.BuiltInTypeConverters builtInTypeConverters() default androidx.room.BuiltInTypeConverters();
- method public abstract kotlin.reflect.KClass<? extends java.lang.Object?>[] value();
+ method public abstract Class<? extends java.lang.Object?>[] value();
property public abstract androidx.room.BuiltInTypeConverters builtInTypeConverters;
- property public abstract kotlin.reflect.KClass<? extends java.lang.Object?>[] value;
+ property public abstract Class<? extends java.lang.Object?>[] value;
}
@kotlin.annotation.Retention(kotlin.annotation.AnnotationRetention.BINARY) @kotlin.annotation.Target(allowedTargets=kotlin.annotation.AnnotationTarget.FUNCTION) public @interface Update {
- method public abstract kotlin.reflect.KClass<? extends java.lang.Object?> entity() default Any::class;
+ method public abstract Class<? extends java.lang.Object?> entity() default Any::class;
method @androidx.room.OnConflictStrategy public abstract int onConflict() default androidx.room.OnConflictStrategy.ABORT;
- property public abstract kotlin.reflect.KClass<? extends java.lang.Object?> entity;
+ property public abstract Class<? extends java.lang.Object?> entity;
property @androidx.room.OnConflictStrategy public abstract int onConflict;
}
@kotlin.annotation.Retention(kotlin.annotation.AnnotationRetention.BINARY) @kotlin.annotation.Target(allowedTargets=kotlin.annotation.AnnotationTarget.FUNCTION) public @interface Upsert {
- method public abstract kotlin.reflect.KClass<? extends java.lang.Object?> entity() default Any::class;
- property public abstract kotlin.reflect.KClass<? extends java.lang.Object?> entity;
+ method public abstract Class<? extends java.lang.Object?> entity() default Any::class;
+ property public abstract Class<? extends java.lang.Object?> entity;
}
}
diff --git a/room/room-common/api/restricted_current.ignore b/room/room-common/api/restricted_current.ignore
index e328ae6..a124e8c 100644
--- a/room/room-common/api/restricted_current.ignore
+++ b/room/room-common/api/restricted_current.ignore
@@ -1,4 +1,32 @@
// Baseline format: 1.0
+ChangedType: androidx.room.AutoMigration#spec():
+ Method androidx.room.AutoMigration.spec has changed return type from kotlin.reflect.KClass<?> to java.lang.Class<?>
+ChangedType: androidx.room.Database#entities():
+ Method androidx.room.Database.entities has changed return type from kotlin.reflect.KClass<?>[] to java.lang.Class<?>[]
+ChangedType: androidx.room.Database#views():
+ Method androidx.room.Database.views has changed return type from kotlin.reflect.KClass<?>[] to java.lang.Class<?>[]
+ChangedType: androidx.room.Delete#entity():
+ Method androidx.room.Delete.entity has changed return type from kotlin.reflect.KClass<?> to java.lang.Class<?>
+ChangedType: androidx.room.ForeignKey#entity():
+ Method androidx.room.ForeignKey.entity has changed return type from kotlin.reflect.KClass<?> to java.lang.Class<?>
+ChangedType: androidx.room.Fts4#contentEntity():
+ Method androidx.room.Fts4.contentEntity has changed return type from kotlin.reflect.KClass<?> to java.lang.Class<?>
+ChangedType: androidx.room.Insert#entity():
+ Method androidx.room.Insert.entity has changed return type from kotlin.reflect.KClass<?> to java.lang.Class<?>
+ChangedType: androidx.room.Junction#value():
+ Method androidx.room.Junction.value has changed return type from kotlin.reflect.KClass<?> to java.lang.Class<?>
+ChangedType: androidx.room.RawQuery#observedEntities():
+ Method androidx.room.RawQuery.observedEntities has changed return type from kotlin.reflect.KClass<?>[] to java.lang.Class<?>[]
+ChangedType: androidx.room.Relation#entity():
+ Method androidx.room.Relation.entity has changed return type from kotlin.reflect.KClass<?> to java.lang.Class<?>
+ChangedType: androidx.room.TypeConverters#value():
+ Method androidx.room.TypeConverters.value has changed return type from kotlin.reflect.KClass<?>[] to java.lang.Class<?>[]
+ChangedType: androidx.room.Update#entity():
+ Method androidx.room.Update.entity has changed return type from kotlin.reflect.KClass<?> to java.lang.Class<?>
+ChangedType: androidx.room.Upsert#entity():
+ Method androidx.room.Upsert.entity has changed return type from kotlin.reflect.KClass<?> to java.lang.Class<?>
+
+
ChangedValue: androidx.room.AutoMigration#spec():
Method androidx.room.AutoMigration.spec has changed value from java.lang.Object to Any::class
ChangedValue: androidx.room.Delete#entity():
diff --git a/room/room-common/api/restricted_current.txt b/room/room-common/api/restricted_current.txt
index d2326d6..6cc5969 100644
--- a/room/room-common/api/restricted_current.txt
+++ b/room/room-common/api/restricted_current.txt
@@ -9,10 +9,10 @@
@kotlin.annotation.Retention(kotlin.annotation.AnnotationRetention.BINARY) @kotlin.annotation.Target(allowedTargets=kotlin.annotation.AnnotationTarget.CLASS) public @interface AutoMigration {
method public abstract int from();
- method public abstract kotlin.reflect.KClass<? extends java.lang.Object?> spec() default Any::class;
+ method public abstract Class<? extends java.lang.Object?> spec() default Any::class;
method public abstract int to();
property public abstract int from;
- property public abstract kotlin.reflect.KClass<? extends java.lang.Object?> spec;
+ property public abstract Class<? extends java.lang.Object?> spec;
property public abstract int to;
}
@@ -94,8 +94,8 @@
}
@kotlin.annotation.Retention(kotlin.annotation.AnnotationRetention.BINARY) @kotlin.annotation.Target(allowedTargets=kotlin.annotation.AnnotationTarget.CLASS) public @interface ConstructedBy {
- method public abstract kotlin.reflect.KClass<? extends java.lang.Object?> value();
- property public abstract kotlin.reflect.KClass<? extends java.lang.Object?> value;
+ method public abstract Class<? extends java.lang.Object?> value();
+ property public abstract Class<? extends java.lang.Object?> value;
}
@kotlin.annotation.Retention(kotlin.annotation.AnnotationRetention.BINARY) @kotlin.annotation.Target(allowedTargets=kotlin.annotation.AnnotationTarget.CLASS) public @interface Dao {
@@ -103,15 +103,15 @@
@kotlin.annotation.Retention(kotlin.annotation.AnnotationRetention.BINARY) @kotlin.annotation.Target(allowedTargets=kotlin.annotation.AnnotationTarget.CLASS) public @interface Database {
method public abstract androidx.room.AutoMigration[] autoMigrations();
- method public abstract kotlin.reflect.KClass<? extends java.lang.Object?>[] entities();
+ method public abstract Class<? extends java.lang.Object?>[] entities();
method public abstract boolean exportSchema() default true;
method public abstract int version();
- method public abstract kotlin.reflect.KClass<? extends java.lang.Object?>[] views();
+ method public abstract Class<? extends java.lang.Object?>[] views();
property public abstract androidx.room.AutoMigration[] autoMigrations;
- property public abstract kotlin.reflect.KClass<? extends java.lang.Object?>[] entities;
+ property public abstract Class<? extends java.lang.Object?>[] entities;
property public abstract boolean exportSchema;
property public abstract int version;
- property public abstract kotlin.reflect.KClass<? extends java.lang.Object?>[] views;
+ property public abstract Class<? extends java.lang.Object?>[] views;
}
@kotlin.annotation.Retention(kotlin.annotation.AnnotationRetention.BINARY) @kotlin.annotation.Target(allowedTargets=kotlin.annotation.AnnotationTarget.CLASS) public @interface DatabaseView {
@@ -122,8 +122,8 @@
}
@kotlin.annotation.Retention(kotlin.annotation.AnnotationRetention.BINARY) @kotlin.annotation.Target(allowedTargets=kotlin.annotation.AnnotationTarget.FUNCTION) public @interface Delete {
- method public abstract kotlin.reflect.KClass<? extends java.lang.Object?> entity() default Any::class;
- property public abstract kotlin.reflect.KClass<? extends java.lang.Object?> entity;
+ method public abstract Class<? extends java.lang.Object?> entity() default Any::class;
+ property public abstract Class<? extends java.lang.Object?> entity;
}
@java.lang.annotation.Repeatable(DeleteColumn.Entries::class) @kotlin.annotation.Retention(kotlin.annotation.AnnotationRetention.BINARY) @kotlin.annotation.Target(allowedTargets=kotlin.annotation.AnnotationTarget.CLASS) public @interface DeleteColumn {
@@ -171,13 +171,13 @@
@kotlin.annotation.Retention(kotlin.annotation.AnnotationRetention.BINARY) @kotlin.annotation.Target(allowedTargets={}) public @interface ForeignKey {
method public abstract String[] childColumns();
method public abstract boolean deferred() default false;
- method public abstract kotlin.reflect.KClass<? extends java.lang.Object?> entity();
+ method public abstract Class<? extends java.lang.Object?> entity();
method @androidx.room.ForeignKey.Action public abstract int onDelete() default androidx.room.ForeignKey.NO_ACTION;
method @androidx.room.ForeignKey.Action public abstract int onUpdate() default androidx.room.ForeignKey.NO_ACTION;
method public abstract String[] parentColumns();
property public abstract String[] childColumns;
property public abstract boolean deferred;
- property public abstract kotlin.reflect.KClass<? extends java.lang.Object?> entity;
+ property public abstract Class<? extends java.lang.Object?> entity;
property @androidx.room.ForeignKey.Action public abstract int onDelete;
property @androidx.room.ForeignKey.Action public abstract int onUpdate;
property public abstract String[] parentColumns;
@@ -213,7 +213,7 @@
}
@kotlin.annotation.Retention(kotlin.annotation.AnnotationRetention.BINARY) @kotlin.annotation.Target(allowedTargets=kotlin.annotation.AnnotationTarget.CLASS) public @interface Fts4 {
- method public abstract kotlin.reflect.KClass<? extends java.lang.Object?> contentEntity() default Any::class;
+ method public abstract Class<? extends java.lang.Object?> contentEntity() default Any::class;
method public abstract String languageId() default "";
method public abstract androidx.room.FtsOptions.MatchInfo matchInfo() default androidx.room.FtsOptions.MatchInfo.FTS4;
method public abstract String[] notIndexed();
@@ -221,7 +221,7 @@
method public abstract int[] prefix();
method public abstract String tokenizer() default androidx.room.FtsOptions.TOKENIZER_SIMPLE;
method public abstract String[] tokenizerArgs();
- property public abstract kotlin.reflect.KClass<? extends java.lang.Object?> contentEntity;
+ property public abstract Class<? extends java.lang.Object?> contentEntity;
property public abstract String languageId;
property public abstract androidx.room.FtsOptions.MatchInfo matchInfo;
property public abstract String[] notIndexed;
@@ -273,19 +273,19 @@
}
@kotlin.annotation.Retention(kotlin.annotation.AnnotationRetention.BINARY) @kotlin.annotation.Target(allowedTargets=kotlin.annotation.AnnotationTarget.FUNCTION) public @interface Insert {
- method public abstract kotlin.reflect.KClass<? extends java.lang.Object?> entity() default Any::class;
+ method public abstract Class<? extends java.lang.Object?> entity() default Any::class;
method @androidx.room.OnConflictStrategy public abstract int onConflict() default androidx.room.OnConflictStrategy.ABORT;
- property public abstract kotlin.reflect.KClass<? extends java.lang.Object?> entity;
+ property public abstract Class<? extends java.lang.Object?> entity;
property @androidx.room.OnConflictStrategy public abstract int onConflict;
}
@kotlin.annotation.Retention(kotlin.annotation.AnnotationRetention.BINARY) @kotlin.annotation.Target(allowedTargets={}) public @interface Junction {
method public abstract String entityColumn() default "";
method public abstract String parentColumn() default "";
- method public abstract kotlin.reflect.KClass<? extends java.lang.Object?> value();
+ method public abstract Class<? extends java.lang.Object?> value();
property public abstract String entityColumn;
property public abstract String parentColumn;
- property public abstract kotlin.reflect.KClass<? extends java.lang.Object?> value;
+ property public abstract Class<? extends java.lang.Object?> value;
}
@kotlin.annotation.Retention(kotlin.annotation.AnnotationRetention.BINARY) @kotlin.annotation.Target(allowedTargets=kotlin.annotation.AnnotationTarget.TYPE) public @interface MapColumn {
@@ -350,18 +350,18 @@
}
@kotlin.annotation.Retention(kotlin.annotation.AnnotationRetention.BINARY) @kotlin.annotation.Target(allowedTargets=kotlin.annotation.AnnotationTarget.FUNCTION) public @interface RawQuery {
- method public abstract kotlin.reflect.KClass<? extends java.lang.Object?>[] observedEntities();
- property public abstract kotlin.reflect.KClass<? extends java.lang.Object?>[] observedEntities;
+ method public abstract Class<? extends java.lang.Object?>[] observedEntities();
+ property public abstract Class<? extends java.lang.Object?>[] observedEntities;
}
@kotlin.annotation.Retention(kotlin.annotation.AnnotationRetention.BINARY) @kotlin.annotation.Target(allowedTargets={kotlin.annotation.AnnotationTarget.FIELD, kotlin.annotation.AnnotationTarget.FUNCTION}) public @interface Relation {
method public abstract androidx.room.Junction associateBy() default androidx.room.Junction(Any::class);
- method public abstract kotlin.reflect.KClass<? extends java.lang.Object?> entity() default Any::class;
+ method public abstract Class<? extends java.lang.Object?> entity() default Any::class;
method public abstract String entityColumn();
method public abstract String parentColumn();
method public abstract String[] projection();
property public abstract androidx.room.Junction associateBy;
- property public abstract kotlin.reflect.KClass<? extends java.lang.Object?> entity;
+ property public abstract Class<? extends java.lang.Object?> entity;
property public abstract String entityColumn;
property public abstract String parentColumn;
property public abstract String[] projection;
@@ -471,21 +471,21 @@
@kotlin.annotation.Retention(kotlin.annotation.AnnotationRetention.BINARY) @kotlin.annotation.Target(allowedTargets={kotlin.annotation.AnnotationTarget.FUNCTION, kotlin.annotation.AnnotationTarget.VALUE_PARAMETER, kotlin.annotation.AnnotationTarget.FIELD, kotlin.annotation.AnnotationTarget.CLASS}) public @interface TypeConverters {
method public abstract androidx.room.BuiltInTypeConverters builtInTypeConverters() default androidx.room.BuiltInTypeConverters();
- method public abstract kotlin.reflect.KClass<? extends java.lang.Object?>[] value();
+ method public abstract Class<? extends java.lang.Object?>[] value();
property public abstract androidx.room.BuiltInTypeConverters builtInTypeConverters;
- property public abstract kotlin.reflect.KClass<? extends java.lang.Object?>[] value;
+ property public abstract Class<? extends java.lang.Object?>[] value;
}
@kotlin.annotation.Retention(kotlin.annotation.AnnotationRetention.BINARY) @kotlin.annotation.Target(allowedTargets=kotlin.annotation.AnnotationTarget.FUNCTION) public @interface Update {
- method public abstract kotlin.reflect.KClass<? extends java.lang.Object?> entity() default Any::class;
+ method public abstract Class<? extends java.lang.Object?> entity() default Any::class;
method @androidx.room.OnConflictStrategy public abstract int onConflict() default androidx.room.OnConflictStrategy.ABORT;
- property public abstract kotlin.reflect.KClass<? extends java.lang.Object?> entity;
+ property public abstract Class<? extends java.lang.Object?> entity;
property @androidx.room.OnConflictStrategy public abstract int onConflict;
}
@kotlin.annotation.Retention(kotlin.annotation.AnnotationRetention.BINARY) @kotlin.annotation.Target(allowedTargets=kotlin.annotation.AnnotationTarget.FUNCTION) public @interface Upsert {
- method public abstract kotlin.reflect.KClass<? extends java.lang.Object?> entity() default Any::class;
- property public abstract kotlin.reflect.KClass<? extends java.lang.Object?> entity;
+ method public abstract Class<? extends java.lang.Object?> entity() default Any::class;
+ property public abstract Class<? extends java.lang.Object?> entity;
}
}
diff --git a/room/room-common/build.gradle b/room/room-common/build.gradle
index 2e36b7e..1cf5db4 100644
--- a/room/room-common/build.gradle
+++ b/room/room-common/build.gradle
@@ -88,6 +88,5 @@
inceptionYear = "2017"
description = "Android Room-Common"
legacyDisableKotlinStrictApiMode = true
- metalavaK2UastEnabled = false
kotlinTarget = KotlinTarget.KOTLIN_2_0
}
diff --git a/room/room-compiler-processing/build.gradle b/room/room-compiler-processing/build.gradle
index 4cc1d58..c7250a8 100644
--- a/room/room-compiler-processing/build.gradle
+++ b/room/room-compiler-processing/build.gradle
@@ -29,47 +29,6 @@
plugins {
id("AndroidXPlugin")
id("kotlin")
- id("com.gradleup.shadow")
-}
-
-configurations {
- // For shadowed / jarjared deps
- shadowed
- // shadowed deps are compile only deps
- compileOnly.extendsFrom(shadowed)
- // compiler tests don't use shadowed, so include them
- testCompile.extendsFrom(shadowed)
- // for downstream tests
- shadowAndImplementation.extendsFrom(shadow)
- shadowAndImplementation.extendsFrom(implementation)
-}
-
-shadowJar {
- archiveClassifier = ""
- configurations = [project.configurations.shadowed]
- relocate("kotlin.metadata", "androidx.room.jarjarred.kotlin.metadata")
- mergeServiceFiles() // kotlin-metadata-jvm has a service descriptor that needs transformation
- // Exclude Kotlin metadata files from kotlin-metadata-jvm
- exclude 'META-INF/kotlin-metadata-jvm.kotlin_module'
- exclude 'META-INF/kotlin-metadata.kotlin_module'
- exclude 'META-INF/metadata.jvm.kotlin_module'
- exclude 'META-INF/metadata.kotlin_module'
-}
-
-jar {
- archiveClassifier = "before-jarjar"
-}
-
-configurations {
- // replace the standard jar with the one built by 'shadowJar' in both api and runtime variants
- apiElements.outgoing.artifacts.clear()
- apiElements.outgoing.artifact(shadowJar) {
- builtBy shadowJar
- }
- runtimeElements.outgoing.artifacts.clear()
- runtimeElements.outgoing.artifact(shadowJar) {
- builtBy shadowJar
- }
}
dependencies {
@@ -80,9 +39,7 @@
implementation(libs.guava)
implementation(libs.autoCommon)
implementation(libs.autoValueAnnotations)
- shadowed(libs.kotlinMetadataJvm) {
- exclude group: "org.jetbrains.kotlin", module: "kotlin-stdlib"
- }
+ implementation(libs.kotlinMetadataJvm)
implementation(libs.kspApi)
testImplementation("androidx.annotation:annotation:1.8.1")
diff --git a/room/room-compiler-processing/src/main/java/androidx/room/compiler/codegen/XClassName.kt b/room/room-compiler-processing/src/main/java/androidx/room/compiler/codegen/XClassName.kt
index 914b990..d48c5a0 100644
--- a/room/room-compiler-processing/src/main/java/androidx/room/compiler/codegen/XClassName.kt
+++ b/room/room-compiler-processing/src/main/java/androidx/room/compiler/codegen/XClassName.kt
@@ -50,6 +50,7 @@
// But a decision has to be made...
val packageName: String = java.packageName()
val simpleNames: List<String> = java.simpleNames()
+ val simpleName = simpleNames.last()
val canonicalName: String = java.canonicalName()
val reflectionName: String = java.reflectionName()
@@ -82,6 +83,20 @@
nullability = XNullability.NONNULL
)
+ fun peerClass(name: String) =
+ XClassName(
+ java = java.peerClass(name),
+ kotlin = kotlin.peerClass(name),
+ nullability = XNullability.NONNULL
+ )
+
+ fun topLevelClass() =
+ XClassName(
+ java = java.topLevelClassName(),
+ kotlin = kotlin.topLevelClassName(),
+ nullability = XNullability.NONNULL
+ )
+
override fun copy(nullable: Boolean): XClassName {
return XClassName(
java = java,
diff --git a/room/room-compiler-processing/src/main/java/androidx/room/compiler/codegen/XTypeName.kt b/room/room-compiler-processing/src/main/java/androidx/room/compiler/codegen/XTypeName.kt
index 5680e41..1feb79e 100644
--- a/room/room-compiler-processing/src/main/java/androidx/room/compiler/codegen/XTypeName.kt
+++ b/room/room-compiler-processing/src/main/java/androidx/room/compiler/codegen/XTypeName.kt
@@ -199,6 +199,7 @@
* the equivalent Kotlin and Java type names are represented, [IntArray] and `int[]`
* respectively.
*/
+ @JvmStatic
fun getArrayName(componentTypeName: XTypeName): XTypeName {
componentTypeName.java.let {
require(it !is JWildcardTypeName || it.lowerBounds.isEmpty()) {
@@ -243,6 +244,7 @@
*
* In Java: `? super <bound>` In Kotlin `in <bound>
*/
+ @JvmStatic
fun getConsumerSuperName(bound: XTypeName): XTypeName {
return XTypeName(
java = JWildcardTypeName.supertypeOf(bound.java),
@@ -260,6 +262,7 @@
*
* In Java: `? extends <bound>` In Kotlin `out <bound>
*/
+ @JvmStatic
fun getProducerExtendsName(bound: XTypeName): XTypeName {
return XTypeName(
java = JWildcardTypeName.subtypeOf(bound.java),
diff --git a/room/room-compiler/src/main/kotlin/androidx/room/DatabaseProcessingStep.kt b/room/room-compiler/src/main/kotlin/androidx/room/DatabaseProcessingStep.kt
index 0f00fc6..82f9c6d 100644
--- a/room/room-compiler/src/main/kotlin/androidx/room/DatabaseProcessingStep.kt
+++ b/room/room-compiler/src/main/kotlin/androidx/room/DatabaseProcessingStep.kt
@@ -27,7 +27,7 @@
import androidx.room.processor.Context.BooleanProcessorOptions.GENERATE_KOTLIN
import androidx.room.processor.DatabaseProcessor
import androidx.room.processor.ProcessorErrors
-import androidx.room.vo.DaoMethod
+import androidx.room.vo.DaoFunction
import androidx.room.vo.Warning
import androidx.room.writer.AutoMigrationWriter
import androidx.room.writer.DaoWriter
@@ -91,12 +91,12 @@
}
}
- val daoMethodsMap = databases?.flatMap { db -> db.daoMethods.map { it to db } }?.toMap()
- daoMethodsMap?.let {
+ val daoFunctionsMap = databases?.flatMap { db -> db.daoFunctions.map { it to db } }?.toMap()
+ daoFunctionsMap?.let {
prepareDaosForWriting(databases, it.keys.toList())
- it.forEach { (daoMethod, db) ->
+ it.forEach { (daoFunction, db) ->
DaoWriter(
- dao = daoMethod.dao,
+ dao = daoFunction.dao,
dbElement = db.element,
writerContext = TypeWriter.WriterContext.fromProcessingContext(context)
)
@@ -166,31 +166,33 @@
}
}
- /** Traverses all dao methods and assigns them suffix if they are used in multiple databases. */
+ /**
+ * Traverses all dao functions and assigns them suffix if they are used in multiple databases.
+ */
private fun prepareDaosForWriting(
databases: List<androidx.room.vo.Database>,
- daoMethods: List<DaoMethod>
+ daoFunctions: List<DaoFunction>
) {
- daoMethods
+ daoFunctions
.groupBy { it.dao.typeName }
// if used only in 1 database, nothing to do.
.filter { entry -> entry.value.size > 1 }
.forEach { entry ->
entry.value
- .groupBy { daoMethod ->
+ .groupBy { daoFunction ->
// first suffix guess: Database's simple name
- val db = databases.first { db -> db.daoMethods.contains(daoMethod) }
+ val db = databases.first { db -> db.daoFunctions.contains(daoFunction) }
db.typeName.simpleNames.last()
}
- .forEach { (dbName, methods) ->
- if (methods.size == 1) {
+ .forEach { (dbName, functions) ->
+ if (functions.size == 1) {
// good, db names do not clash, use db name as suffix
- methods.first().dao.setSuffix(dbName)
+ functions.first().dao.setSuffix(dbName)
} else {
// ok looks like a dao is used in 2 different databases both of
// which have the same name. enumerate.
- methods.forEachIndexed { index, method ->
- method.dao.setSuffix("${dbName}_$index")
+ functions.forEachIndexed { index, function ->
+ function.dao.setSuffix("${dbName}_$index")
}
}
}
diff --git a/room/room-compiler/src/main/kotlin/androidx/room/processor/DaoProcessor.kt b/room/room-compiler/src/main/kotlin/androidx/room/processor/DaoProcessor.kt
index a52c017..ce81e10 100644
--- a/room/room-compiler/src/main/kotlin/androidx/room/processor/DaoProcessor.kt
+++ b/room/room-compiler/src/main/kotlin/androidx/room/processor/DaoProcessor.kt
@@ -30,8 +30,8 @@
import androidx.room.compiler.processing.XTypeElement
import androidx.room.verifier.DatabaseVerifier
import androidx.room.vo.Dao
-import androidx.room.vo.KotlinBoxedPrimitiveMethodDelegate
-import androidx.room.vo.KotlinDefaultMethodDelegate
+import androidx.room.vo.KotlinBoxedPrimitiveFunctionDelegate
+import androidx.room.vo.KotlinDefaultFunctionDelegate
import androidx.room.vo.Warning
class DaoProcessor(
@@ -60,15 +60,15 @@
return Dao(
element = element,
type = element.type,
- queryMethods = emptyList(),
- rawQueryMethods = emptyList(),
- insertMethods = emptyList(),
- upsertMethods = emptyList(),
- deleteMethods = emptyList(),
- updateMethods = emptyList(),
- transactionMethods = emptyList(),
- kotlinBoxedPrimitiveMethodDelegates = emptyList(),
- kotlinDefaultMethodDelegates = emptyList(),
+ queryFunctions = emptyList(),
+ rawQueryFunctions = emptyList(),
+ insertFunctions = emptyList(),
+ upsertFunctions = emptyList(),
+ deleteFunctions = emptyList(),
+ updateFunctions = emptyList(),
+ transactionFunctions = emptyList(),
+ kotlinBoxedPrimitiveFunctionDelegates = emptyList(),
+ kotlinDefaultFunctionDelegates = emptyList(),
constructorParamType = null
)
}
@@ -84,43 +84,43 @@
)
val declaredType = element.type
- val allMethods = element.getAllMethods()
- val methods =
- allMethods
+ val allFunctions = element.getAllMethods()
+ val functions =
+ allFunctions
.filter { it.isAbstract() && !it.hasKotlinDefaultImpl() }
- .groupBy { method ->
- if (method.isKotlinPropertyMethod()) {
+ .groupBy { function ->
+ if (function.isKotlinPropertyMethod()) {
context.checker.check(
- predicate = method.hasAnnotation(Query::class),
- element = method,
+ predicate = function.hasAnnotation(Query::class),
+ element = function,
errorMsg = ProcessorErrors.INVALID_ANNOTATION_IN_DAO_PROPERTY
)
} else {
context.checker.check(
predicate =
- PROCESSED_ANNOTATIONS.count { method.hasAnnotation(it) } <= 1,
- element = method,
- errorMsg = ProcessorErrors.INVALID_ANNOTATION_COUNT_IN_DAO_METHOD
+ PROCESSED_ANNOTATIONS.count { function.hasAnnotation(it) } <= 1,
+ element = function,
+ errorMsg = ProcessorErrors.INVALID_ANNOTATION_COUNT_IN_DAO_FUNCTION
)
}
- if (method.hasAnnotation(JvmName::class)) {
+ if (function.hasAnnotation(JvmName::class)) {
context.logger.w(
- Warning.JVM_NAME_ON_OVERRIDDEN_METHOD,
- method,
- ProcessorErrors.JVM_NAME_ON_OVERRIDDEN_METHOD
+ Warning.JVM_NAME_ON_OVERRIDDEN_FUNCTION,
+ function,
+ ProcessorErrors.JVM_NAME_ON_OVERRIDDEN_FUNCTION
)
}
- if (method.hasAnnotation(Query::class)) {
+ if (function.hasAnnotation(Query::class)) {
Query::class
- } else if (method.hasAnnotation(Insert::class)) {
+ } else if (function.hasAnnotation(Insert::class)) {
Insert::class
- } else if (method.hasAnnotation(Delete::class)) {
+ } else if (function.hasAnnotation(Delete::class)) {
Delete::class
- } else if (method.hasAnnotation(Update::class)) {
+ } else if (function.hasAnnotation(Update::class)) {
Update::class
- } else if (method.hasAnnotation(RawQuery::class)) {
+ } else if (function.hasAnnotation(RawQuery::class)) {
RawQuery::class
- } else if (method.hasAnnotation(Upsert::class)) {
+ } else if (function.hasAnnotation(Upsert::class)) {
Upsert::class
} else {
Any::class
@@ -137,9 +137,9 @@
dbVerifier
}
- val queryMethods =
- methods[Query::class]?.map {
- QueryMethodProcessor(
+ val queryFunctions =
+ functions[Query::class]?.map {
+ QueryFunctionProcessor(
baseContext = context,
containing = declaredType,
executableElement = it,
@@ -148,9 +148,9 @@
.process()
} ?: emptyList()
- val rawQueryMethods =
- methods[RawQuery::class]?.map {
- RawQueryMethodProcessor(
+ val rawQueryFunctions =
+ functions[RawQuery::class]?.map {
+ RawQueryFunctionProcessor(
baseContext = context,
containing = declaredType,
executableElement = it
@@ -158,9 +158,9 @@
.process()
} ?: emptyList()
- val insertMethods =
- methods[Insert::class]?.map {
- InsertMethodProcessor(
+ val insertFunctions =
+ functions[Insert::class]?.map {
+ InsertFunctionProcessor(
baseContext = context,
containing = declaredType,
executableElement = it
@@ -168,9 +168,9 @@
.process()
} ?: emptyList()
- val deleteMethods =
- methods[Delete::class]?.map {
- DeleteMethodProcessor(
+ val deleteFunctions =
+ functions[Delete::class]?.map {
+ DeleteFunctionProcessor(
baseContext = context,
containing = declaredType,
executableElement = it
@@ -178,9 +178,9 @@
.process()
} ?: emptyList()
- val updateMethods =
- methods[Update::class]?.map {
- UpdateMethodProcessor(
+ val updateFunctions =
+ functions[Update::class]?.map {
+ UpdateFunctionProcessor(
baseContext = context,
containing = declaredType,
executableElement = it
@@ -188,9 +188,9 @@
.process()
} ?: emptyList()
- val upsertMethods =
- methods[Upsert::class]?.map {
- UpsertMethodProcessor(
+ val upsertFunctions =
+ functions[Upsert::class]?.map {
+ UpsertFunctionProcessor(
baseContext = context,
containing = declaredType,
executableElement = it
@@ -198,14 +198,14 @@
.process()
} ?: emptyList()
- val transactionMethods =
- allMethods
+ val transactionFunctions =
+ allFunctions
.filter { member ->
member.hasAnnotation(Transaction::class) &&
PROCESSED_ANNOTATIONS.none { member.hasAnnotation(it) }
}
.map {
- TransactionMethodProcessor(
+ TransactionFunctionProcessor(
baseContext = context,
containingElement = element,
containingType = declaredType,
@@ -214,29 +214,29 @@
.process()
}
- // Only try to find Kotlin boxed bridge methods when the dao extends a class or
- // implements an interface since otherwise there are no bridge method generated by
+ // Only try to find Kotlin boxed bridge functions when the dao extends a class or
+ // implements an interface since otherwise there are no bridge function generated by
// Kotlin.
- val unannotatedMethods = methods[Any::class] ?: emptyList()
- val kotlinBoxedPrimitiveBridgeMethods =
+ val unannotatedFunctions = functions[Any::class] ?: emptyList()
+ val kotlinBoxedPrimitiveBridgeFunctions =
if (element.superClass != null || element.getSuperInterfaceElements().isNotEmpty()) {
- matchKotlinBoxedPrimitiveMethods(
- unannotatedMethods,
- methods.values.flatten() - unannotatedMethods
+ matchKotlinBoxedPrimitiveFunctions(
+ unannotatedFunctions,
+ functions.values.flatten() - unannotatedFunctions
)
} else {
emptyList()
}
- val kotlinDefaultMethodDelegates =
+ val kotlinDefaultFunctionDelegates =
if (element.isInterface()) {
- val allProcessedMethods =
- methods.values.flatten() + transactionMethods.map { it.element }
- allMethods
- .filterNot { allProcessedMethods.contains(it) }
- .mapNotNull { method ->
- if (method.hasKotlinDefaultImpl()) {
- KotlinDefaultMethodDelegate(element = method)
+ val allProcessedFunctions =
+ functions.values.flatten() + transactionFunctions.map { it.element }
+ allFunctions
+ .filterNot { allProcessedFunctions.contains(it) }
+ .mapNotNull { function ->
+ if (function.hasKotlinDefaultImpl()) {
+ KotlinDefaultFunctionDelegate(element = function)
} else {
null
}
@@ -264,24 +264,24 @@
ProcessorErrors.CANNOT_USE_UNBOUND_GENERICS_IN_DAO_CLASSES
)
- val invalidAnnotatedMethods =
- unannotatedMethods - kotlinBoxedPrimitiveBridgeMethods.map { it.element }
- invalidAnnotatedMethods.forEach {
- context.logger.e(it, ProcessorErrors.INVALID_ANNOTATION_COUNT_IN_DAO_METHOD)
+ val invalidAnnotatedFunctions =
+ unannotatedFunctions - kotlinBoxedPrimitiveBridgeFunctions.map { it.element }
+ invalidAnnotatedFunctions.forEach {
+ context.logger.e(it, ProcessorErrors.INVALID_ANNOTATION_COUNT_IN_DAO_FUNCTION)
}
return Dao(
element = element,
type = declaredType,
- queryMethods = queryMethods,
- rawQueryMethods = rawQueryMethods,
- insertMethods = insertMethods,
- deleteMethods = deleteMethods,
- updateMethods = updateMethods,
- upsertMethods = upsertMethods,
- transactionMethods = transactionMethods.toList(),
- kotlinBoxedPrimitiveMethodDelegates = kotlinBoxedPrimitiveBridgeMethods,
- kotlinDefaultMethodDelegates = kotlinDefaultMethodDelegates.toList(),
+ queryFunctions = queryFunctions,
+ rawQueryFunctions = rawQueryFunctions,
+ insertFunctions = insertFunctions,
+ deleteFunctions = deleteFunctions,
+ updateFunctions = updateFunctions,
+ upsertFunctions = upsertFunctions,
+ transactionFunctions = transactionFunctions.toList(),
+ kotlinBoxedPrimitiveFunctionDelegates = kotlinBoxedPrimitiveBridgeFunctions,
+ kotlinDefaultFunctionDelegates = kotlinDefaultFunctionDelegates.toList(),
constructorParamType = constructorParamType
)
}
@@ -299,17 +299,17 @@
}
/**
- * Find Kotlin bridge methods generated for overrides of primitives, see KT-46650. When
- * generating the Java implementation of the DAO, Room needs to also override the bridge method
- * generated by Kotlin for the boxed version, it will contain the same name, return type and
- * parameter, but the generic primitive params will be boxed.
+ * Find Kotlin bridge functions generated for overrides of primitives, see KT-46650. When
+ * generating the Java implementation of the DAO, Room needs to also override the bridge
+ * function generated by Kotlin for the boxed version, it will contain the same name, return
+ * type and parameter, but the generic primitive params will be boxed.
*/
- private fun matchKotlinBoxedPrimitiveMethods(
- unannotatedMethods: List<XMethodElement>,
- annotatedMethods: List<XMethodElement>
+ private fun matchKotlinBoxedPrimitiveFunctions(
+ unannotatedFunctions: List<XMethodElement>,
+ annotatedFunctions: List<XMethodElement>
) =
- unannotatedMethods.mapNotNull { unannotated ->
- annotatedMethods
+ unannotatedFunctions.mapNotNull { unannotated ->
+ annotatedFunctions
.firstOrNull {
if (it.jvmName != unannotated.jvmName) {
return@firstOrNull false
@@ -341,8 +341,8 @@
}
return@firstOrNull true
}
- ?.let { matchingMethod ->
- KotlinBoxedPrimitiveMethodDelegate(unannotated, matchingMethod)
+ ?.let { matchingFunction ->
+ KotlinBoxedPrimitiveFunctionDelegate(unannotated, matchingFunction)
}
}
}
diff --git a/room/room-compiler/src/main/kotlin/androidx/room/processor/DataClassMethodProcessor.kt b/room/room-compiler/src/main/kotlin/androidx/room/processor/DataClassFunctionProcessor.kt
similarity index 83%
rename from room/room-compiler/src/main/kotlin/androidx/room/processor/DataClassMethodProcessor.kt
rename to room/room-compiler/src/main/kotlin/androidx/room/processor/DataClassFunctionProcessor.kt
index 6f295d1e..aa6252b 100644
--- a/room/room-compiler/src/main/kotlin/androidx/room/processor/DataClassMethodProcessor.kt
+++ b/room/room-compiler/src/main/kotlin/androidx/room/processor/DataClassFunctionProcessor.kt
@@ -18,16 +18,16 @@
import androidx.room.compiler.processing.XMethodElement
import androidx.room.compiler.processing.XType
-import androidx.room.vo.DataClassMethod
+import androidx.room.vo.DataClassFunction
/** processes an executable element as member of the owning class */
-class DataClassMethodProcessor(
+class DataClassFunctionProcessor(
private val context: Context,
private val element: XMethodElement,
private val owner: XType
) {
- fun process(): DataClassMethod {
+ fun process(): DataClassFunction {
val asMember = element.asMemberOf(owner)
- return DataClassMethod(element = element, resolvedType = asMember)
+ return DataClassFunction(element = element, resolvedType = asMember)
}
}
diff --git a/room/room-compiler/src/main/kotlin/androidx/room/processor/DataClassProcessor.kt b/room/room-compiler/src/main/kotlin/androidx/room/processor/DataClassProcessor.kt
index efed0d7..a80892c 100644
--- a/room/room-compiler/src/main/kotlin/androidx/room/processor/DataClassProcessor.kt
+++ b/room/room-compiler/src/main/kotlin/androidx/room/processor/DataClassProcessor.kt
@@ -38,7 +38,7 @@
import androidx.room.vo.CallType
import androidx.room.vo.Constructor
import androidx.room.vo.DataClass
-import androidx.room.vo.DataClassMethod
+import androidx.room.vo.DataClassFunction
import androidx.room.vo.EmbeddedField
import androidx.room.vo.Entity
import androidx.room.vo.EntityOrView
@@ -230,7 +230,11 @@
.asSequence()
.filter { !it.isAbstract() && !it.hasAnnotation(Ignore::class) }
.map {
- DataClassMethodProcessor(context = context, element = it, owner = declaredType)
+ DataClassFunctionProcessor(
+ context = context,
+ element = it,
+ owner = declaredType
+ )
.process()
}
.toList()
@@ -748,11 +752,11 @@
return referenceRecursionList.joinToString(" -> ")
}
- private fun assignGetters(fields: List<Field>, getterCandidates: List<DataClassMethod>) {
+ private fun assignGetters(fields: List<Field>, getterCandidates: List<DataClassFunction>) {
fields.forEach { field -> assignGetter(field, getterCandidates) }
}
- private fun assignGetter(field: Field, getterCandidates: List<DataClassMethod>) {
+ private fun assignGetter(field: Field, getterCandidates: List<DataClassFunction>) {
val success =
chooseAssignment(
field = field,
@@ -818,7 +822,7 @@
private fun assignSetters(
fields: List<Field>,
- setterCandidates: List<DataClassMethod>,
+ setterCandidates: List<DataClassFunction>,
constructor: Constructor?
) {
fields.forEach { field -> assignSetter(field, setterCandidates, constructor) }
@@ -826,7 +830,7 @@
private fun assignSetter(
field: Field,
- setterCandidates: List<DataClassMethod>,
+ setterCandidates: List<DataClassFunction>,
constructor: Constructor?
) {
if (constructor != null && constructor.hasField(field)) {
@@ -910,11 +914,11 @@
*/
private fun chooseAssignment(
field: Field,
- candidates: List<DataClassMethod>,
+ candidates: List<DataClassFunction>,
nameVariations: List<String>,
- getType: (DataClassMethod) -> XType,
+ getType: (DataClassFunction) -> XType,
assignFromField: () -> Unit,
- assignFromMethod: (DataClassMethod) -> Unit,
+ assignFromMethod: (DataClassFunction) -> Unit,
reportAmbiguity: (List<String>) -> Unit
): Boolean {
if (field.element.isPublic()) {
@@ -955,9 +959,9 @@
}
private fun verifyAndChooseOneFrom(
- candidates: List<DataClassMethod>?,
+ candidates: List<DataClassFunction>?,
reportAmbiguity: (List<String>) -> Unit
- ): DataClassMethod? {
+ ): DataClassFunction? {
if (candidates == null) {
return null
}
diff --git a/room/room-compiler/src/main/kotlin/androidx/room/processor/DatabaseProcessor.kt b/room/room-compiler/src/main/kotlin/androidx/room/processor/DatabaseProcessor.kt
index 6cf7930..5892c05 100644
--- a/room/room-compiler/src/main/kotlin/androidx/room/processor/DatabaseProcessor.kt
+++ b/room/room-compiler/src/main/kotlin/androidx/room/processor/DatabaseProcessor.kt
@@ -32,7 +32,7 @@
import androidx.room.verifier.DatabaseVerificationErrors
import androidx.room.verifier.DatabaseVerifier
import androidx.room.vo.Dao
-import androidx.room.vo.DaoMethod
+import androidx.room.vo.DaoFunction
import androidx.room.vo.Database
import androidx.room.vo.DatabaseConstructor
import androidx.room.vo.DatabaseView
@@ -87,7 +87,7 @@
validateUniqueTableAndViewNames(element, entities, views)
val declaredType = element.type
- val daoMethods =
+ val daoFunctions =
element
.getAllMethods()
.filter { it.isAbstract() }
@@ -104,25 +104,25 @@
if (daoElement == null) {
context.logger.e(
executable,
- ProcessorErrors.DATABASE_INVALID_DAO_METHOD_RETURN_TYPE
+ ProcessorErrors.DATABASE_INVALID_DAO_FUNCTION_RETURN_TYPE
)
null
} else {
if (executable.hasAnnotation(JvmName::class)) {
context.logger.w(
- Warning.JVM_NAME_ON_OVERRIDDEN_METHOD,
+ Warning.JVM_NAME_ON_OVERRIDDEN_FUNCTION,
executable,
- ProcessorErrors.JVM_NAME_ON_OVERRIDDEN_METHOD
+ ProcessorErrors.JVM_NAME_ON_OVERRIDDEN_FUNCTION
)
}
val dao =
DaoProcessor(context, daoElement, declaredType, dbVerifier).process()
- DaoMethod(executable, dao)
+ DaoFunction(executable, dao)
}
}
.toList()
- validateUniqueDaoClasses(element, daoMethods, entities)
+ validateUniqueDaoClasses(element, daoFunctions, entities)
validateUniqueIndices(element, entities)
val hasForeignKeys = entities.any { it.foreignKeys.isNotEmpty() }
@@ -145,7 +145,7 @@
type = element.type,
entities = entities,
views = views,
- daoMethods = daoMethods,
+ daoFunctions = daoFunctions,
exportSchema = dbAnnotation.value.exportSchema,
enableForeignKeys = hasForeignKeys,
overrideClearAllTables = hasClearAllTables,
@@ -315,23 +315,23 @@
private fun validateUniqueDaoClasses(
dbElement: XTypeElement,
- daoMethods: List<DaoMethod>,
+ daoFunctions: List<DaoFunction>,
entities: List<Entity>
) {
val entityTypeNames = entities.map { it.typeName }.toSet()
- daoMethods
+ daoFunctions
.groupBy { it.dao.typeName }
.forEach {
if (it.value.size > 1) {
val error =
ProcessorErrors.duplicateDao(
dao = it.key.toString(context.codeLanguage),
- methodNames = it.value.map { it.element.name }
+ functionNames = it.value.map { it.element.name }
)
- it.value.forEach { daoMethod ->
+ it.value.forEach { daoFunction ->
context.logger.e(
- daoMethod.element,
- ProcessorErrors.DAO_METHOD_CONFLICTS_WITH_OTHERS
+ daoFunction.element,
+ ProcessorErrors.DAO_FUNCTION_CONFLICTS_WITH_OTHERS
)
}
// also report the full error for the database
@@ -353,15 +353,15 @@
}
}
}
- daoMethods.forEach { daoMethod ->
- daoMethod.dao.deleteOrUpdateShortcutMethods.forEach { method ->
+ daoFunctions.forEach { daoFunction ->
+ daoFunction.dao.mDeleteOrUpdateShortcutFunctions.forEach { method ->
method.entities.forEach {
- check(method.element, daoMethod.dao, it.value.entityTypeName)
+ check(method.element, daoFunction.dao, it.value.entityTypeName)
}
}
- daoMethod.dao.insertOrUpsertShortcutMethods.forEach { method ->
+ daoFunction.dao.mInsertOrUpsertShortcutFunctions.forEach { method ->
method.entities.forEach {
- check(method.element, daoMethod.dao, it.value.entityTypeName)
+ check(method.element, daoFunction.dao, it.value.entityTypeName)
}
}
}
diff --git a/room/room-compiler/src/main/kotlin/androidx/room/processor/DeleteMethodProcessor.kt b/room/room-compiler/src/main/kotlin/androidx/room/processor/DeleteFunctionProcessor.kt
similarity index 80%
rename from room/room-compiler/src/main/kotlin/androidx/room/processor/DeleteMethodProcessor.kt
rename to room/room-compiler/src/main/kotlin/androidx/room/processor/DeleteFunctionProcessor.kt
index 6967b93..0cf83d2 100644
--- a/room/room-compiler/src/main/kotlin/androidx/room/processor/DeleteMethodProcessor.kt
+++ b/room/room-compiler/src/main/kotlin/androidx/room/processor/DeleteFunctionProcessor.kt
@@ -18,26 +18,26 @@
import androidx.room.Delete
import androidx.room.compiler.processing.XMethodElement
import androidx.room.compiler.processing.XType
-import androidx.room.vo.DeleteMethod
+import androidx.room.vo.DeleteFunction
-class DeleteMethodProcessor(
+class DeleteFunctionProcessor(
baseContext: Context,
val containing: XType,
val executableElement: XMethodElement
) {
val context = baseContext.fork(executableElement)
- fun process(): DeleteMethod {
- val delegate = ShortcutMethodProcessor(context, containing, executableElement)
+ fun process(): DeleteFunction {
+ val delegate = ShortcutFunctionProcessor(context, containing, executableElement)
val annotation =
delegate.extractAnnotation(Delete::class, ProcessorErrors.MISSING_DELETE_ANNOTATION)
val returnType = delegate.extractReturnType()
- val methodBinder = delegate.findDeleteOrUpdateMethodBinder(returnType)
+ val functionBinder = delegate.findDeleteOrUpdateFunctionBinder(returnType)
context.checker.check(
- methodBinder.adapter != null,
+ functionBinder.adapter != null,
executableElement,
ProcessorErrors.CANNOT_FIND_DELETE_RESULT_ADAPTER
)
@@ -49,11 +49,11 @@
onValidatePartialEntity = { _, _ -> }
)
- return DeleteMethod(
+ return DeleteFunction(
element = delegate.executableElement,
entities = entities,
parameters = params,
- methodBinder = methodBinder
+ functionBinder = functionBinder
)
}
}
diff --git a/room/room-compiler/src/main/kotlin/androidx/room/processor/MethodProcessorDelegate.kt b/room/room-compiler/src/main/kotlin/androidx/room/processor/FunctionProcessorDelegate.kt
similarity index 72%
rename from room/room-compiler/src/main/kotlin/androidx/room/processor/MethodProcessorDelegate.kt
rename to room/room-compiler/src/main/kotlin/androidx/room/processor/FunctionProcessorDelegate.kt
index da5e301..d7b77ec 100644
--- a/room/room-compiler/src/main/kotlin/androidx/room/processor/MethodProcessorDelegate.kt
+++ b/room/room-compiler/src/main/kotlin/androidx/room/processor/FunctionProcessorDelegate.kt
@@ -36,20 +36,20 @@
import androidx.room.solver.prepared.binder.PreparedQueryResultBinder
import androidx.room.solver.query.result.CoroutineResultBinder
import androidx.room.solver.query.result.QueryResultBinder
-import androidx.room.solver.shortcut.binder.CoroutineDeleteOrUpdateMethodBinder
-import androidx.room.solver.shortcut.binder.CoroutineInsertOrUpsertMethodBinder
-import androidx.room.solver.shortcut.binder.DeleteOrUpdateMethodBinder
-import androidx.room.solver.shortcut.binder.InsertOrUpsertMethodBinder
-import androidx.room.solver.transaction.binder.CoroutineTransactionMethodBinder
-import androidx.room.solver.transaction.binder.InstantTransactionMethodBinder
-import androidx.room.solver.transaction.binder.TransactionMethodBinder
-import androidx.room.solver.transaction.result.TransactionMethodAdapter
+import androidx.room.solver.shortcut.binder.CoroutineDeleteOrUpdateFunctionBinder
+import androidx.room.solver.shortcut.binder.CoroutineInsertOrUpsertFunctionBinder
+import androidx.room.solver.shortcut.binder.DeleteOrUpdateFunctionBinder
+import androidx.room.solver.shortcut.binder.InsertOrUpsertFunctionBinder
+import androidx.room.solver.transaction.binder.CoroutineTransactionFunctionBinder
+import androidx.room.solver.transaction.binder.InstantTransactionFunctionBinder
+import androidx.room.solver.transaction.binder.TransactionFunctionBinder
+import androidx.room.solver.transaction.result.TransactionFunctionAdapter
import androidx.room.vo.QueryParameter
import androidx.room.vo.ShortcutQueryParameter
-import androidx.room.vo.TransactionMethod
+import androidx.room.vo.TransactionFunction
-/** Delegate class with common functionality for DAO method processors. */
-abstract class MethodProcessorDelegate(
+/** Delegate class with common functionality for DAO function processors. */
+abstract class FunctionProcessorDelegate(
val context: Context,
val containing: XType,
val executableElement: XMethodElement
@@ -84,39 +84,39 @@
query: ParsedQuery
): PreparedQueryResultBinder
- abstract fun findInsertMethodBinder(
+ abstract fun findInsertFunctionBinder(
returnType: XType,
params: List<ShortcutQueryParameter>
- ): InsertOrUpsertMethodBinder
+ ): InsertOrUpsertFunctionBinder
- abstract fun findDeleteOrUpdateMethodBinder(returnType: XType): DeleteOrUpdateMethodBinder
+ abstract fun findDeleteOrUpdateFunctionBinder(returnType: XType): DeleteOrUpdateFunctionBinder
- abstract fun findUpsertMethodBinder(
+ abstract fun findUpsertFunctionBinder(
returnType: XType,
params: List<ShortcutQueryParameter>
- ): InsertOrUpsertMethodBinder
+ ): InsertOrUpsertFunctionBinder
- abstract fun findTransactionMethodBinder(
- callType: TransactionMethod.CallType
- ): TransactionMethodBinder
+ abstract fun findTransactionFunctionBinder(
+ callType: TransactionFunction.CallType
+ ): TransactionFunctionBinder
companion object {
fun createFor(
context: Context,
containing: XType,
executableElement: XMethodElement
- ): MethodProcessorDelegate {
+ ): FunctionProcessorDelegate {
val asMember = executableElement.asMemberOf(containing)
return if (asMember.isSuspendFunction()) {
- SuspendMethodProcessorDelegate(context, containing, executableElement, asMember)
+ SuspendFunctionProcessorDelegate(context, containing, executableElement, asMember)
} else {
- DefaultMethodProcessorDelegate(context, containing, executableElement, asMember)
+ DefaultFunctionProcessorDelegate(context, containing, executableElement, asMember)
}
}
}
}
-fun MethodProcessorDelegate.returnsDeferredType(): Boolean {
+fun FunctionProcessorDelegate.returnsDeferredType(): Boolean {
val deferredTypes =
DEFERRED_TYPES.mapNotNull { context.processingEnv.findType(it.canonicalName) }
val returnType = extractReturnType()
@@ -125,13 +125,13 @@
}
}
-/** Default delegate for DAO methods. */
-class DefaultMethodProcessorDelegate(
+/** Default delegate for DAO functions. */
+class DefaultFunctionProcessorDelegate(
context: Context,
containing: XType,
executableElement: XMethodElement,
val executableType: XMethodType
-) : MethodProcessorDelegate(context, containing, executableElement) {
+) : FunctionProcessorDelegate(context, containing, executableElement) {
override fun extractReturnType(): XType {
return executableType.returnType
@@ -148,34 +148,34 @@
override fun findPreparedResultBinder(returnType: XType, query: ParsedQuery) =
context.typeAdapterStore.findPreparedQueryResultBinder(returnType, query)
- override fun findInsertMethodBinder(returnType: XType, params: List<ShortcutQueryParameter>) =
- context.typeAdapterStore.findInsertMethodBinder(returnType, params)
+ override fun findInsertFunctionBinder(returnType: XType, params: List<ShortcutQueryParameter>) =
+ context.typeAdapterStore.findInsertFunctionBinder(returnType, params)
- override fun findDeleteOrUpdateMethodBinder(returnType: XType) =
- context.typeAdapterStore.findDeleteOrUpdateMethodBinder(returnType)
+ override fun findDeleteOrUpdateFunctionBinder(returnType: XType) =
+ context.typeAdapterStore.findDeleteOrUpdateFunctionBinder(returnType)
- override fun findUpsertMethodBinder(returnType: XType, params: List<ShortcutQueryParameter>) =
- context.typeAdapterStore.findUpsertMethodBinder(returnType, params)
+ override fun findUpsertFunctionBinder(returnType: XType, params: List<ShortcutQueryParameter>) =
+ context.typeAdapterStore.findUpsertFunctionBinder(returnType, params)
- override fun findTransactionMethodBinder(callType: TransactionMethod.CallType) =
- InstantTransactionMethodBinder(
+ override fun findTransactionFunctionBinder(callType: TransactionFunction.CallType) =
+ InstantTransactionFunctionBinder(
returnType = executableElement.returnType,
adapter =
- TransactionMethodAdapter(
- methodName = executableElement.name,
+ TransactionFunctionAdapter(
+ functionName = executableElement.name,
jvmMethodName = executableElement.jvmName,
callType = callType
),
)
}
-/** Delegate for DAO methods that are a suspend function. */
-class SuspendMethodProcessorDelegate(
+/** Delegate for DAO functions that are a suspend functions. */
+class SuspendFunctionProcessorDelegate(
context: Context,
containing: XType,
executableElement: XMethodElement,
val executableType: XSuspendMethodType
-) : MethodProcessorDelegate(context, containing, executableElement) {
+) : FunctionProcessorDelegate(context, containing, executableElement) {
private val continuationParam: XVariableElement by lazy {
val continuationType =
@@ -208,33 +208,33 @@
continuationParamName = continuationParam.name
)
- override fun findInsertMethodBinder(returnType: XType, params: List<ShortcutQueryParameter>) =
- CoroutineInsertOrUpsertMethodBinder(
+ override fun findInsertFunctionBinder(returnType: XType, params: List<ShortcutQueryParameter>) =
+ CoroutineInsertOrUpsertFunctionBinder(
typeArg = returnType,
adapter = context.typeAdapterStore.findInsertAdapter(returnType, params),
continuationParamName = continuationParam.name
)
- override fun findUpsertMethodBinder(returnType: XType, params: List<ShortcutQueryParameter>) =
- CoroutineInsertOrUpsertMethodBinder(
+ override fun findUpsertFunctionBinder(returnType: XType, params: List<ShortcutQueryParameter>) =
+ CoroutineInsertOrUpsertFunctionBinder(
typeArg = returnType,
adapter = context.typeAdapterStore.findUpsertAdapter(returnType, params),
continuationParamName = continuationParam.name
)
- override fun findDeleteOrUpdateMethodBinder(returnType: XType) =
- CoroutineDeleteOrUpdateMethodBinder(
+ override fun findDeleteOrUpdateFunctionBinder(returnType: XType) =
+ CoroutineDeleteOrUpdateFunctionBinder(
typeArg = returnType,
adapter = context.typeAdapterStore.findDeleteOrUpdateAdapter(returnType),
continuationParamName = continuationParam.name
)
- override fun findTransactionMethodBinder(callType: TransactionMethod.CallType) =
- CoroutineTransactionMethodBinder(
+ override fun findTransactionFunctionBinder(callType: TransactionFunction.CallType) =
+ CoroutineTransactionFunctionBinder(
returnType = executableElement.returnType,
adapter =
- TransactionMethodAdapter(
- methodName = executableElement.name,
+ TransactionFunctionAdapter(
+ functionName = executableElement.name,
jvmMethodName = executableElement.jvmName,
callType = callType
),
diff --git a/room/room-compiler/src/main/kotlin/androidx/room/processor/InsertMethodProcessor.kt b/room/room-compiler/src/main/kotlin/androidx/room/processor/InsertFunctionProcessor.kt
similarity index 90%
rename from room/room-compiler/src/main/kotlin/androidx/room/processor/InsertMethodProcessor.kt
rename to room/room-compiler/src/main/kotlin/androidx/room/processor/InsertFunctionProcessor.kt
index 3337480..f0b6ace 100644
--- a/room/room-compiler/src/main/kotlin/androidx/room/processor/InsertMethodProcessor.kt
+++ b/room/room-compiler/src/main/kotlin/androidx/room/processor/InsertFunctionProcessor.kt
@@ -22,18 +22,18 @@
import androidx.room.OnConflictStrategy
import androidx.room.compiler.processing.XMethodElement
import androidx.room.compiler.processing.XType
-import androidx.room.vo.InsertMethod
+import androidx.room.vo.InsertFunction
import androidx.room.vo.findFieldByColumnName
-class InsertMethodProcessor(
+class InsertFunctionProcessor(
baseContext: Context,
val containing: XType,
val executableElement: XMethodElement
) {
val context = baseContext.fork(executableElement)
- fun process(): InsertMethod {
- val delegate = ShortcutMethodProcessor(context, containing, executableElement)
+ fun process(): InsertFunction {
+ val delegate = ShortcutFunctionProcessor(context, containing, executableElement)
val annotation =
delegate.extractAnnotation(Insert::class, ProcessorErrors.MISSING_INSERT_ANNOTATION)
@@ -48,7 +48,7 @@
context.checker.notUnbound(
returnType,
executableElement,
- ProcessorErrors.CANNOT_USE_UNBOUND_GENERICS_IN_INSERT_METHODS
+ ProcessorErrors.CANNOT_USE_UNBOUND_GENERICS_IN_INSERT_FUNCTIONS
)
val (entities, params) =
@@ -88,21 +88,21 @@
}
)
- val methodBinder = delegate.findInsertMethodBinder(returnType, params)
+ val functionBinder = delegate.findInsertFunctionBinder(returnType, params)
context.checker.check(
- methodBinder.adapter != null,
+ functionBinder.adapter != null,
executableElement,
ProcessorErrors.CANNOT_FIND_INSERT_RESULT_ADAPTER
)
- return InsertMethod(
+ return InsertFunction(
element = executableElement,
returnType = returnType,
entities = entities,
parameters = params,
onConflict = onConflict,
- methodBinder = methodBinder
+ functionBinder = functionBinder
)
}
}
diff --git a/room/room-compiler/src/main/kotlin/androidx/room/processor/ProcessorErrors.kt b/room/room-compiler/src/main/kotlin/androidx/room/processor/ProcessorErrors.kt
index afaa03d..c2a18e1 100644
--- a/room/room-compiler/src/main/kotlin/androidx/room/processor/ProcessorErrors.kt
+++ b/room/room-compiler/src/main/kotlin/androidx/room/processor/ProcessorErrors.kt
@@ -36,56 +36,59 @@
return this.trimIndent().replace("\n", " ")
}
- val ISSUE_TRACKER_LINK = "https://issuetracker.google.com/issues/new?component=413107"
+ const val ISSUE_TRACKER_LINK = "https://issuetracker.google.com/issues/new?component=413107"
- val MISSING_QUERY_ANNOTATION = "Query methods must be annotated with ${Query::class.java}"
- val MISSING_INSERT_ANNOTATION = "Insert methods must be annotated with ${Insert::class.java}"
- val MISSING_DELETE_ANNOTATION = "Delete methods must be annotated with ${Delete::class.java}"
- val MISSING_UPDATE_ANNOTATION = "Update methods must be annotated with ${Update::class.java}"
- val MISSING_UPSERT_ANNOTATION = "Upsert methods must be annotated with ${Upsert::class.java}"
+ val MISSING_QUERY_ANNOTATION = "Query functions must be annotated with ${Query::class.java}"
+ val MISSING_INSERT_ANNOTATION = "Insert functions must be annotated with ${Insert::class.java}"
+ val MISSING_DELETE_ANNOTATION = "Delete functions must be annotated with ${Delete::class.java}"
+ val MISSING_UPDATE_ANNOTATION = "Update functions must be annotated with ${Update::class.java}"
+ val MISSING_UPSERT_ANNOTATION = "Upsert functions must be annotated with ${Upsert::class.java}"
val MISSING_RAWQUERY_ANNOTATION =
- "RawQuery methods must be annotated with" + " ${RawQuery::class.java}"
- val INVALID_ON_CONFLICT_VALUE = "On conflict value must be one of @OnConflictStrategy values."
- val TRANSACTION_REFERENCE_DOCS =
+ "RawQuery functions must be annotated with" + " ${RawQuery::class.java}"
+ const val INVALID_ON_CONFLICT_VALUE =
+ "On conflict value must be one of @OnConflictStrategy values."
+ const val TRANSACTION_REFERENCE_DOCS =
"https://developer.android.com/reference/androidx/" + "room/Transaction.html"
- val INVALID_ANNOTATION_COUNT_IN_DAO_METHOD =
- "An abstract DAO method must be" +
+ val INVALID_ANNOTATION_COUNT_IN_DAO_FUNCTION =
+ "An abstract DAO function must be" +
" annotated with one and only one of the following annotations: " +
DaoProcessor.PROCESSED_ANNOTATIONS.joinToString(", ") { "@" + it.java.simpleName }
val INVALID_ANNOTATION_IN_DAO_PROPERTY =
"An abstract DAO property must be" + " annotated with @get:${Query::class.java}."
- val CANNOT_RESOLVE_RETURN_TYPE = "Cannot resolve return type for %s"
- val CANNOT_USE_UNBOUND_GENERICS_IN_QUERY_METHODS =
+ const val CANNOT_RESOLVE_RETURN_TYPE = "Cannot resolve return type for %s"
+ const val CANNOT_USE_UNBOUND_GENERICS_IN_QUERY_FUNCTIONS =
"Cannot use unbound generics in query" +
- " methods. It must be bound to a type through base Dao class."
- val CANNOT_USE_UNBOUND_GENERICS_IN_INSERT_METHODS =
+ " functions. It must be bound to a type through base Dao class."
+ const val CANNOT_USE_UNBOUND_GENERICS_IN_INSERT_FUNCTIONS =
"Cannot use unbound generics in" +
- " insert methods. It must be bound to a type through base Dao class."
- val CANNOT_USE_UNBOUND_GENERICS_IN_UPSERT_METHODS =
+ " insert functions. It must be bound to a type through base Dao class."
+ const val CANNOT_USE_UNBOUND_GENERICS_IN_UPSERT_FUNCTIONS =
"Cannot use unbound generics in" +
- " upsert methods. It must be bound to a type through base Dao class."
- val CANNOT_USE_UNBOUND_GENERICS_IN_ENTITY_FIELDS = "Cannot use unbound fields in entities."
- val CANNOT_USE_UNBOUND_GENERICS_IN_DAO_CLASSES =
+ " upsert functions. It must be bound to a type through base Dao class."
+ const val CANNOT_USE_UNBOUND_GENERICS_IN_ENTITY_FIELDS =
+ "Cannot use unbound fields in entities."
+ const val CANNOT_USE_UNBOUND_GENERICS_IN_DAO_CLASSES =
"Cannot use unbound generics in Dao classes." +
" If you are trying to create a base DAO, create a normal class, extend it with type" +
" params then mark the subclass with @Dao."
- val CANNOT_USE_MAP_COLUMN_AND_MAP_INFO_SIMULTANEOUSLY =
+ const val CANNOT_USE_MAP_COLUMN_AND_MAP_INFO_SIMULTANEOUSLY =
"Cannot use @MapColumn and " +
" @MapInfo annotation in the same function. Please prefer using @MapColumn only."
- val CANNOT_FIND_GETTER_FOR_FIELD = "Cannot find getter for field."
- val CANNOT_FIND_SETTER_FOR_FIELD = "Cannot find setter for field."
- val MISSING_PRIMARY_KEY = "An entity must have at least 1 field annotated with @PrimaryKey"
- val AUTO_INCREMENTED_PRIMARY_KEY_IS_NOT_INT =
+ const val CANNOT_FIND_GETTER_FOR_FIELD = "Cannot find getter for field."
+ const val CANNOT_FIND_SETTER_FOR_FIELD = "Cannot find setter for field."
+ const val MISSING_PRIMARY_KEY =
+ "An entity must have at least 1 field annotated with @PrimaryKey"
+ const val AUTO_INCREMENTED_PRIMARY_KEY_IS_NOT_INT =
"If a primary key is annotated with" +
" autoGenerate, its type must be int, Integer, long or Long."
- val AUTO_INCREMENT_EMBEDDED_HAS_MULTIPLE_FIELDS =
+ const val AUTO_INCREMENT_EMBEDDED_HAS_MULTIPLE_FIELDS =
"When @PrimaryKey annotation is used on a" +
" field annotated with @Embedded, the embedded class should have only 1 field."
- val INVALID_INDEX_ORDERS_SIZE =
+ const val INVALID_INDEX_ORDERS_SIZE =
"The number of entries in @Index#orders() should be " +
"equal to the amount of columns defined in the @Index value."
- val DO_NOT_USE_GENERIC_IMMUTABLE_MULTIMAP =
+ const val DO_NOT_USE_GENERIC_IMMUTABLE_MULTIMAP =
"Do not use ImmutableMultimap as a type (as with" +
" Multimap itself). Instead use the subtypes such as ImmutableSetMultimap or " +
"ImmutableListMultimap."
@@ -104,9 +107,9 @@
" Available column names:${allColumns.joinToString(", ")}"
}
- val DAO_MUST_BE_AN_ABSTRACT_CLASS_OR_AN_INTERFACE =
+ const val DAO_MUST_BE_AN_ABSTRACT_CLASS_OR_AN_INTERFACE =
"Dao class must be an abstract class or" + " an interface"
- val DAO_MUST_BE_ANNOTATED_WITH_DAO = "Dao class must be annotated with @Dao"
+ const val DAO_MUST_BE_ANNOTATED_WITH_DAO = "Dao class must be annotated with @Dao"
fun daoMustHaveMatchingConstructor(daoName: String, dbName: String): String {
return """
@@ -116,81 +119,82 @@
.trim()
}
- val ENTITY_MUST_BE_ANNOTATED_WITH_ENTITY = "Entity class must be annotated with @Entity"
- val DATABASE_ANNOTATION_MUST_HAVE_LIST_OF_ENTITIES =
+ const val ENTITY_MUST_BE_ANNOTATED_WITH_ENTITY = "Entity class must be annotated with @Entity"
+ const val DATABASE_ANNOTATION_MUST_HAVE_LIST_OF_ENTITIES =
"@Database annotation must specify list" + " of entities"
- val COLUMN_NAME_CANNOT_BE_EMPTY =
+ const val COLUMN_NAME_CANNOT_BE_EMPTY =
"Column name cannot be blank. If you don't want to set it" +
", just remove the @ColumnInfo annotation or use @ColumnInfo.INHERIT_FIELD_NAME."
- val ENTITY_TABLE_NAME_CANNOT_BE_EMPTY =
+ const val ENTITY_TABLE_NAME_CANNOT_BE_EMPTY =
"Entity table name cannot be blank. If you don't want" +
" to set it, just remove the tableName property."
- val ENTITY_TABLE_NAME_CANNOT_START_WITH_SQLITE =
+ const val ENTITY_TABLE_NAME_CANNOT_START_WITH_SQLITE =
"Entity table name cannot start with \"sqlite_\"."
- val VIEW_MUST_BE_ANNOTATED_WITH_DATABASE_VIEW =
+ const val VIEW_MUST_BE_ANNOTATED_WITH_DATABASE_VIEW =
"View class must be annotated with " + "@DatabaseView"
- val VIEW_NAME_CANNOT_BE_EMPTY =
+ const val VIEW_NAME_CANNOT_BE_EMPTY =
"View name cannot be blank. If you don't want" +
" to set it, just remove the viewName property."
- val VIEW_NAME_CANNOT_START_WITH_SQLITE = "View name cannot start with \"sqlite_\"."
- val VIEW_QUERY_MUST_BE_SELECT = "Query for @DatabaseView must be a SELECT."
- val VIEW_QUERY_CANNOT_TAKE_ARGUMENTS = "Query for @DatabaseView cannot take any arguments."
+ const val VIEW_NAME_CANNOT_START_WITH_SQLITE = "View name cannot start with \"sqlite_\"."
+ const val VIEW_QUERY_MUST_BE_SELECT = "Query for @DatabaseView must be a SELECT."
+ const val VIEW_QUERY_CANNOT_TAKE_ARGUMENTS =
+ "Query for @DatabaseView cannot take any arguments."
fun viewCircularReferenceDetected(views: List<String>): String {
return "Circular reference detected among views: ${views.joinToString(", ")}"
}
- val CANNOT_BIND_QUERY_PARAMETER_INTO_STMT =
- "Query method parameters should either be a" +
+ const val CANNOT_BIND_QUERY_PARAMETER_INTO_STMT =
+ "Query function parameters should either be a" +
" type that can be converted into a database column or a List / Array that contains" +
" such type. You can consider adding a Type Adapter for this."
- val QUERY_PARAMETERS_CANNOT_START_WITH_UNDERSCORE =
- "Query/Insert method parameters cannot " + "start with underscore (_)."
+ const val QUERY_PARAMETERS_CANNOT_START_WITH_UNDERSCORE =
+ "Query/Insert function parameters cannot " + "start with underscore (_)."
fun cannotFindQueryResultAdapter(returnTypeName: String) =
- "Not sure how to convert the query result to this method's return type ($returnTypeName)."
+ "Not sure how to convert the query result to this function's return type ($returnTypeName)."
fun classMustImplementEqualsAndHashCode(keyType: String) =
"The key" +
- " of the provided method's multimap return type must implement equals() and " +
+ " of the provided function's multimap return type must implement equals() and " +
"hashCode(). Key type is: $keyType."
- val INSERT_DOES_NOT_HAVE_ANY_PARAMETERS_TO_INSERT =
- "Method annotated with" + " @Insert but does not have any parameters to insert."
+ const val INSERT_DOES_NOT_HAVE_ANY_PARAMETERS_TO_INSERT =
+ "Function annotated with" + " @Insert but does not have any parameters to insert."
- val UPSERT_DOES_NOT_HAVE_ANY_PARAMETERS_TO_UPSERT =
- "Method annotated with" + " @Upsert but does not have any parameters to insert or update."
+ const val UPSERT_DOES_NOT_HAVE_ANY_PARAMETERS_TO_UPSERT =
+ "Function annotated with" + " @Upsert but does not have any parameters to insert or update."
- val DELETE_MISSING_PARAMS =
- "Method annotated with" + " @Delete but does not have any parameters to delete."
+ const val DELETE_MISSING_PARAMS =
+ "Function annotated with" + " @Delete but does not have any parameters to delete."
fun cannotMapSpecifiedColumn(column: String, columnsInQuery: List<String>, annotation: String) =
"Column specified in the provided @$annotation annotation must be present in the query. " +
"Provided: $column. Columns found: ${columnsInQuery.joinToString(", ")}"
- val MAP_INFO_MUST_HAVE_AT_LEAST_ONE_COLUMN_PROVIDED =
+ const val MAP_INFO_MUST_HAVE_AT_LEAST_ONE_COLUMN_PROVIDED =
"To use the @MapInfo annotation, you " +
"must provide either the key column name, value column name, or both."
fun mayNeedMapColumn(columnArg: String): String {
return """
Looks like you may need to use @MapColumn to clarify the 'columnName' needed for
- type argument(s) in the return type of a method. Type argument that needs
+ type argument(s) in the return type of a function. Type argument that needs
@MapColumn: $columnArg
"""
.trim()
}
- val CANNOT_FIND_DELETE_RESULT_ADAPTER =
- "Not sure how to handle delete method's " +
+ const val CANNOT_FIND_DELETE_RESULT_ADAPTER =
+ "Not sure how to handle delete function's " +
"return type. Currently the supported return types are void, int or Int."
- val CANNOT_FIND_UPDATE_RESULT_ADAPTER =
- "Not sure how to handle update method's " +
+ const val CANNOT_FIND_UPDATE_RESULT_ADAPTER =
+ "Not sure how to handle update function's " +
"return type. Currently the supported return types are void, int or Int."
fun suspendReturnsDeferredType(returnTypeName: String) =
@@ -198,105 +202,107 @@
"modifier must not return a deferred/async type ($returnTypeName). Most probably this " +
"is an error. Consider changing the return type or removing the suspend modifier."
- val CANNOT_FIND_INSERT_RESULT_ADAPTER = "Not sure how to handle insert method's return type."
+ const val CANNOT_FIND_INSERT_RESULT_ADAPTER =
+ "Not sure how to handle insert function's return type."
- val CANNOT_FIND_UPSERT_RESULT_ADAPTER = "Not sure how to handle upsert method's return type."
+ const val CANNOT_FIND_UPSERT_RESULT_ADAPTER =
+ "Not sure how to handle upsert function's return type."
- val INSERT_MULTI_PARAM_SINGLE_RETURN_MISMATCH =
- "Insert method accepts multiple parameters " +
+ const val INSERT_MULTI_PARAM_SINGLE_RETURN_MISMATCH =
+ "Insert function accepts multiple parameters " +
"but the return type is a single element. Try using a multiple element return type."
- val UPSERT_MULTI_PARAM_SINGLE_RETURN_MISMATCH =
- "Upsert method accepts multiple parameters " +
+ const val UPSERT_MULTI_PARAM_SINGLE_RETURN_MISMATCH =
+ "Upsert function accepts multiple parameters " +
"but the return type is a single element. Try using a multiple element return type."
- val INSERT_SINGLE_PARAM_MULTI_RETURN_MISMATCH =
- "Insert method accepts a single parameter " +
+ const val INSERT_SINGLE_PARAM_MULTI_RETURN_MISMATCH =
+ "Insert function accepts a single parameter " +
"but the return type is a collection of elements. Try using a single element return type."
- val UPSERT_SINGLE_PARAM_MULTI_RETURN_MISMATCH =
- "Upsert method accepts a single parameter " +
+ const val UPSERT_SINGLE_PARAM_MULTI_RETURN_MISMATCH =
+ "Upsert function accepts a single parameter " +
"but the return type is a collection of elements. Try using a single element return type."
- val UPDATE_MISSING_PARAMS =
- "Method annotated with" + " @Update but does not have any parameters to update."
+ const val UPDATE_MISSING_PARAMS =
+ "Function annotated with" + " @Update but does not have any parameters to update."
- val TRANSACTION_METHOD_MODIFIERS =
- "Method annotated with @Transaction must not be " +
- "private, final, or abstract. It can be abstract only if the method is also" +
+ const val TRANSACTION_FUNCTION_MODIFIERS =
+ "Function annotated with @Transaction must not be " +
+ "private, final, or abstract. It can be abstract only if the function is also" +
" annotated with @Query."
- fun nullableParamInShortcutMethod(param: String) =
- "Methods annotated with [@Insert, " +
+ fun nullableParamInShortcutFunction(param: String) =
+ "Functions annotated with [@Insert, " +
"@Upsert, @Update, @Delete] shouldn't declare nullable parameters ($param)."
- fun transactionMethodAsync(returnTypeName: String) =
- "Method annotated with @Transaction must" +
+ fun transactionFunctionAsync(returnTypeName: String) =
+ "Function annotated with @Transaction must" +
" not return deferred/async return type $returnTypeName. Since transactions are" +
- " thread confined and Room cannot guarantee that all queries in the method" +
+ " thread confined and Room cannot guarantee that all queries in the function" +
" implementation are performed on the same thread, only synchronous @Transaction" +
- " implemented methods are allowed. If a transaction is started and a change of thread" +
+ " implemented functions are allowed. If a transaction is started and a change of thread" +
" is done and waited upon then a database deadlock can occur if the additional thread" +
" attempts to perform a query. This restrictions prevents such situation from" +
" occurring."
- val TRANSACTION_MISSING_ON_RELATION =
+ const val TRANSACTION_MISSING_ON_RELATION =
"The return value includes a data class with a @Relation." +
- " It is usually desired to annotate this method with @Transaction to avoid" +
+ " It is usually desired to annotate this function with @Transaction to avoid" +
" possibility of inconsistent results between the data class and its relations. See " +
TRANSACTION_REFERENCE_DOCS +
" for details."
- val CANNOT_FIND_ENTITY_FOR_SHORTCUT_QUERY_PARAMETER =
+ const val CANNOT_FIND_ENTITY_FOR_SHORTCUT_QUERY_PARAMETER =
"Type of the parameter must be a class " +
"annotated with @Entity or a collection/array of it."
val DB_MUST_EXTEND_ROOM_DB =
"Classes annotated with @Database should extend " + ROOM_DB.canonicalName
- val OBSERVABLE_QUERY_NOTHING_TO_OBSERVE =
+ const val OBSERVABLE_QUERY_NOTHING_TO_OBSERVE =
"Observable query return type (LiveData, Flowable" +
", DataSource, DataSourceFactory etc) can only be used with SELECT queries that" +
" directly or indirectly (via @Relation, for example) access at least one table. For" +
" @RawQuery, you should specify the list of tables to be observed via the" +
" observedEntities field."
- val RECURSIVE_REFERENCE_DETECTED =
+ const val RECURSIVE_REFERENCE_DETECTED =
"Recursive referencing through @Embedded and/or @Relation " + "detected: %s"
- private val TOO_MANY_MATCHING_GETTERS =
+ private const val TOO_MANY_MATCHING_GETTERS =
"Ambiguous getter for %s. All of the following " +
"match: %s. You can @Ignore the ones that you don't want to match."
- fun tooManyMatchingGetters(field: Field, methodNames: List<String>): String {
- return TOO_MANY_MATCHING_GETTERS.format(field, methodNames.joinToString(", "))
+ fun tooManyMatchingGetters(field: Field, functionNames: List<String>): String {
+ return TOO_MANY_MATCHING_GETTERS.format(field, functionNames.joinToString(", "))
}
- private val TOO_MANY_MATCHING_SETTERS =
+ private const val TOO_MANY_MATCHING_SETTERS =
"Ambiguous setter for %s. All of the following " +
"match: %s. You can @Ignore the ones that you don't want to match."
- fun tooManyMatchingSetter(field: Field, methodNames: List<String>): String {
- return TOO_MANY_MATCHING_SETTERS.format(field, methodNames.joinToString(", "))
+ fun tooManyMatchingSetter(field: Field, functionNames: List<String>): String {
+ return TOO_MANY_MATCHING_SETTERS.format(field, functionNames.joinToString(", "))
}
- val CANNOT_FIND_COLUMN_TYPE_ADAPTER =
+ const val CANNOT_FIND_COLUMN_TYPE_ADAPTER =
"Cannot figure out how to save this field into" +
" database. You can consider adding a type converter for it."
- val VALUE_CLASS_ONLY_SUPPORTED_IN_KSP =
+ const val VALUE_CLASS_ONLY_SUPPORTED_IN_KSP =
"Kotlin value classes are only supported " +
"in Room using KSP and generating Kotlin (room.generateKotlin=true)."
- val CANNOT_FIND_STMT_BINDER = "Cannot figure out how to bind this field into a statement."
+ const val CANNOT_FIND_STMT_BINDER = "Cannot figure out how to bind this field into a statement."
- val CANNOT_FIND_STMT_READER = "Cannot figure out how to read this field from a statement."
+ const val CANNOT_FIND_STMT_READER = "Cannot figure out how to read this field from a statement."
const val DEFAULT_VALUE_NULLABILITY = "Use of NULL as the default value of a non-null field"
- private val MISSING_PARAMETER_FOR_BIND =
+ private const val MISSING_PARAMETER_FOR_BIND =
"Each bind variable in the query must have a" +
- " matching method parameter. Cannot find method parameters for %s."
+ " matching function parameter. Cannot find function parameters for %s."
fun missingParameterForBindVariable(bindVarName: List<String>): String {
return MISSING_PARAMETER_FOR_BIND.format(bindVarName.joinToString(", "))
@@ -307,30 +313,30 @@
"Found $mapValueTypeName."
}
- private val UNUSED_QUERY_METHOD_PARAMETER = "Unused parameter%s: %s"
+ private const val UNUSED_QUERY_FUNCTION_PARAMETER = "Unused parameter%s: %s"
- fun unusedQueryMethodParameter(unusedParams: List<String>): String {
- return UNUSED_QUERY_METHOD_PARAMETER.format(
+ fun unusedQueryFunctionParameter(unusedParams: List<String>): String {
+ return UNUSED_QUERY_FUNCTION_PARAMETER.format(
if (unusedParams.size > 1) "s" else "",
unusedParams.joinToString(",")
)
}
- private val DUPLICATE_TABLES_OR_VIEWS =
+ private const val DUPLICATE_TABLES_OR_VIEWS =
"The name \"%s\" is used by multiple entities or views: %s"
fun duplicateTableNames(tableName: String, entityNames: List<String>): String {
return DUPLICATE_TABLES_OR_VIEWS.format(tableName, entityNames.joinToString(", "))
}
- val DAO_METHOD_CONFLICTS_WITH_OTHERS = "Dao method has conflicts."
+ const val DAO_FUNCTION_CONFLICTS_WITH_OTHERS = "Dao function has conflicts."
- fun duplicateDao(dao: String, methodNames: List<String>): String {
+ fun duplicateDao(dao: String, functionNames: List<String>): String {
return """
- All of these functions [${methodNames.joinToString(", ")}] return the same DAO
+ All of these functions [${functionNames.joinToString(", ")}] return the same DAO
class [$dao].
- A database can use a DAO only once so you should remove ${methodNames.size - 1} of
- these conflicting DAO methods. If you are implementing any of these to fulfill an
+ A database can use a DAO only once so you should remove ${functionNames.size - 1} of
+ these conflicting DAO functions. If you are implementing any of these to fulfill an
interface, don't make it abstract, instead, implement the code that calls the
other one.
"""
@@ -369,7 +375,7 @@
The query returns some columns [${unusedColumns.joinToString(", ")}] which are not
used by $dataClassNames. You can use @ColumnInfo annotation on the fields to specify
the mapping.
- You can annotate the method with @RewriteQueriesToDropUnusedColumns to direct Room
+ You can annotate the function with @RewriteQueriesToDropUnusedColumns to direct Room
to rewrite your query to avoid fetching unused columns.
"""
.trim()
@@ -389,28 +395,28 @@
return """
$unusedColumnsWarning
${unusedFieldsWarning.joinToString(separator = " ")}
- You can suppress this warning by annotating the method with
+ You can suppress this warning by annotating the function with
@SuppressWarnings(RoomWarnings.QUERY_MISMATCH).
Columns returned by the query: ${allColumns.joinToString(", ")}.
"""
.trim()
}
- val TYPE_CONVERTER_UNBOUND_GENERIC = "Cannot use unbound generics in Type Converters."
- val TYPE_CONVERTER_BAD_RETURN_TYPE = "Invalid return type for a type converter."
- val TYPE_CONVERTER_MUST_RECEIVE_1_PARAM = "Type converters must receive 1 parameter."
- val TYPE_CONVERTER_EMPTY_CLASS =
- "Class is referenced as a converter but it does not have any" + " converter methods."
- val TYPE_CONVERTER_MISSING_NOARG_CONSTRUCTOR =
+ const val TYPE_CONVERTER_UNBOUND_GENERIC = "Cannot use unbound generics in Type Converters."
+ const val TYPE_CONVERTER_BAD_RETURN_TYPE = "Invalid return type for a type converter."
+ const val TYPE_CONVERTER_MUST_RECEIVE_1_PARAM = "Type converters must receive 1 parameter."
+ const val TYPE_CONVERTER_EMPTY_CLASS =
+ "Class is referenced as a converter but it does not have any" + " converter functions."
+ const val TYPE_CONVERTER_MISSING_NOARG_CONSTRUCTOR =
"Classes that are used as TypeConverters must" +
" have no-argument public constructors. Use a ProvidedTypeConverter annotation if you" +
" need to take control over creating an instance of a TypeConverter."
- val TYPE_CONVERTER_MUST_BE_PUBLIC = "Type converters must be public."
- val INNER_CLASS_TYPE_CONVERTER_MUST_BE_STATIC =
+ const val TYPE_CONVERTER_MUST_BE_PUBLIC = "Type converters must be public."
+ const val INNER_CLASS_TYPE_CONVERTER_MUST_BE_STATIC =
"An inner class TypeConverter must be " + "static."
fun duplicateTypeConverters(converters: List<CustomTypeConverter>): String {
- return "Multiple methods define the same conversion. Conflicts with these:" +
+ return "Multiple functions define the same conversion. Conflicts with these:" +
" ${converters.joinToString(", ") { it.toString() }}"
}
@@ -419,7 +425,7 @@
}
// TODO must print field paths.
- val DATA_CLASS_FIELD_HAS_DUPLICATE_COLUMN_NAME = "Field has non-unique column name."
+ const val DATA_CLASS_FIELD_HAS_DUPLICATE_COLUMN_NAME = "Field has non-unique column name."
fun dataClassDuplicateFieldNames(columnName: String, fieldPaths: List<String>): String {
return "Multiple fields have the same columnName: $columnName." +
@@ -431,7 +437,7 @@
entityQName
}
- val INDEX_COLUMNS_CANNOT_BE_EMPTY = "List of columns in an index cannot be empty"
+ const val INDEX_COLUMNS_CANNOT_BE_EMPTY = "List of columns in an index cannot be empty"
fun indexColumnDoesNotExist(columnName: String, allColumns: List<String>): String {
return "$columnName referenced in the index does not exist in the Entity." +
@@ -478,7 +484,7 @@
" Alternatively, you can set inheritSuperIndices to true in the @Entity annotation."
}
- val NOT_ENTITY_OR_VIEW = "The class must be either @Entity or @DatabaseView."
+ const val NOT_ENTITY_OR_VIEW = "The class must be either @Entity or @DatabaseView."
fun relationCannotFindEntityField(
entityName: String,
@@ -522,7 +528,7 @@
"full table scan when resolving the relationship, it is highly advised to " +
"create an index that covers this column."
- val RELATION_IN_ENTITY = "Entities cannot have relations."
+ const val RELATION_IN_ENTITY = "Entities cannot have relations."
fun relationAffinityMismatch(
parentColumn: String,
@@ -585,13 +591,13 @@
.trim()
}
- val MISSING_SCHEMA_EXPORT_DIRECTORY =
+ const val MISSING_SCHEMA_EXPORT_DIRECTORY =
"Schema export directory was not provided to the" +
" annotation processor so Room cannot export the schema. You can either provide" +
" `room.schemaLocation` annotation processor argument by applying the Room Gradle plugin" +
" (id 'androidx.room') OR set exportSchema to false."
- val INVALID_FOREIGN_KEY_ACTION =
+ const val INVALID_FOREIGN_KEY_ACTION =
"Invalid foreign key action. It must be one of the constants" +
" defined in ForeignKey.Action"
@@ -603,7 +609,7 @@
.trim()
}
- val FOREIGN_KEY_CANNOT_FIND_PARENT = "Cannot find parent entity class."
+ const val FOREIGN_KEY_CANNOT_FIND_PARENT = "Cannot find parent entity class."
fun foreignKeyChildColumnDoesNotExist(columnName: String, allColumns: List<String>): String {
return "($columnName) referenced in the foreign key does not exist in the Entity." +
@@ -619,9 +625,11 @@
" ${allColumns.joinToString(",")}"
}
- val FOREIGN_KEY_EMPTY_CHILD_COLUMN_LIST = "Must specify at least 1 column name for the child"
+ const val FOREIGN_KEY_EMPTY_CHILD_COLUMN_LIST =
+ "Must specify at least 1 column name for the child"
- val FOREIGN_KEY_EMPTY_PARENT_COLUMN_LIST = "Must specify at least 1 column name for the parent"
+ const val FOREIGN_KEY_EMPTY_PARENT_COLUMN_LIST =
+ "Must specify at least 1 column name for the parent"
fun foreignKeyColumnNumberMismatch(
childColumns: List<String>,
@@ -687,33 +695,33 @@
.trim()
}
- val MISSING_ROOM_GUAVA_ARTIFACT =
+ const val MISSING_ROOM_GUAVA_ARTIFACT =
"To use Guava features, you must add `guava`" +
" artifact from Room as a dependency. androidx.room:room-guava:<version>"
- val MISSING_ROOM_RXJAVA2_ARTIFACT =
+ const val MISSING_ROOM_RXJAVA2_ARTIFACT =
"To use RxJava2 features, you must add `rxjava2`" +
" artifact from Room as a dependency. androidx.room:room-rxjava2:<version>"
- val MISSING_ROOM_RXJAVA3_ARTIFACT =
+ const val MISSING_ROOM_RXJAVA3_ARTIFACT =
"To use RxJava3 features, you must add `rxjava3`" +
" artifact from Room as a dependency. androidx.room:room-rxjava3:<version>"
- val MISSING_ROOM_PAGING_ARTIFACT =
+ const val MISSING_ROOM_PAGING_ARTIFACT =
"To use PagingSource, you must add `room-paging`" +
" artifact from Room as a dependency. androidx.room:room-paging:<version>"
- val MISSING_ROOM_PAGING_GUAVA_ARTIFACT =
+ const val MISSING_ROOM_PAGING_GUAVA_ARTIFACT =
"To use ListenableFuturePagingSource, you must " +
"add `room-paging-guava` artifact from Room as a dependency. " +
"androidx.room:room-paging-guava:<version>"
- val MISSING_ROOM_PAGING_RXJAVA2_ARTIFACT =
+ const val MISSING_ROOM_PAGING_RXJAVA2_ARTIFACT =
"To use RxPagingSource, you must " +
"add `room-paging-rxjava2` artifact from Room as a dependency. " +
"androidx.room:room-paging-rxjava2:<version>"
- val MISSING_ROOM_PAGING_RXJAVA3_ARTIFACT =
+ const val MISSING_ROOM_PAGING_RXJAVA3_ARTIFACT =
"To use RxPagingSource, you must " +
"add `room-paging-rxjava3` artifact from Room as a dependency. " +
"androidx.room:room-paging-rxjava3:<version>"
@@ -753,12 +761,13 @@
"""
.trim()
- val PAGING_SPECIFY_DATA_SOURCE_TYPE = "For now, Room only supports PositionalDataSource class."
+ const val PAGING_SPECIFY_DATA_SOURCE_TYPE =
+ "For now, Room only supports PositionalDataSource class."
- val PAGING_SPECIFY_PAGING_SOURCE_TYPE =
+ const val PAGING_SPECIFY_PAGING_SOURCE_TYPE =
"For now, Room only supports PagingSource with Key of" + " type Int."
- val PAGING_SPECIFY_PAGING_SOURCE_VALUE_TYPE =
+ const val PAGING_SPECIFY_PAGING_SOURCE_VALUE_TYPE =
"For now, Room only supports PagingSource with" + " Value that is not of Collection type."
fun primaryKeyNull(field: String): String {
@@ -768,13 +777,14 @@
"https://www.sqlite.org/lang_createtable.html"
}
- val INVALID_COLUMN_NAME =
+ const val INVALID_COLUMN_NAME =
"Invalid column name. Room does not allow using ` or \" in column" + " names"
- val INVALID_TABLE_NAME = "Invalid table name. Room does not allow using ` or \" in table names"
+ const val INVALID_TABLE_NAME =
+ "Invalid table name. Room does not allow using ` or \" in table names"
- val RAW_QUERY_BAD_PARAMS =
- "RawQuery methods should have 1 and only 1 parameter with type" + " SupportSQLiteQuery"
+ const val RAW_QUERY_BAD_PARAMS =
+ "RawQuery functions should have 1 and only 1 parameter with type" + " SupportSQLiteQuery"
fun parameterCannotBeNullable(parameterName: String) =
"""
@@ -782,7 +792,7 @@
"""
.trimIndent()
- val RAW_QUERY_BAD_RETURN_TYPE = "RawQuery methods must return a non-void type."
+ const val RAW_QUERY_BAD_RETURN_TYPE = "RawQuery functions must return a non-void type."
fun rawQueryBadEntity(typeName: String): String {
return """
@@ -798,43 +808,45 @@
"@RawQuery does not allow passing a string anymore." +
" Please use ${RoomTypeNames.RAW_QUERY.canonicalName}."
- val MISSING_COPY_ANNOTATIONS =
+ const val MISSING_COPY_ANNOTATIONS =
"Annotated property getter is missing " + "@AutoValue.CopyAnnotations."
fun invalidAnnotationTarget(annotationName: String, elementKindName: String): String {
return "@$annotationName is not allowed in this $elementKindName."
}
- val INDICES_IN_FTS_ENTITY = "Indices not allowed in FTS Entity."
+ const val INDICES_IN_FTS_ENTITY = "Indices not allowed in FTS Entity."
- val FOREIGN_KEYS_IN_FTS_ENTITY = "Foreign Keys not allowed in FTS Entity."
+ const val FOREIGN_KEYS_IN_FTS_ENTITY = "Foreign Keys not allowed in FTS Entity."
- val MISSING_PRIMARY_KEYS_ANNOTATION_IN_ROW_ID =
+ const val MISSING_PRIMARY_KEYS_ANNOTATION_IN_ROW_ID =
"The field with column name 'rowid' in " +
"an FTS entity must be annotated with @PrimaryKey."
- val TOO_MANY_PRIMARY_KEYS_IN_FTS_ENTITY = "An FTS entity can only have a single primary key."
+ const val TOO_MANY_PRIMARY_KEYS_IN_FTS_ENTITY =
+ "An FTS entity can only have a single primary key."
- val INVALID_FTS_ENTITY_PRIMARY_KEY_NAME =
+ const val INVALID_FTS_ENTITY_PRIMARY_KEY_NAME =
"The single primary key field in an FTS entity " +
"must either be named 'rowid' or must be annotated with @ColumnInfo(name = \"rowid\")"
- val INVALID_FTS_ENTITY_PRIMARY_KEY_AFFINITY =
+ const val INVALID_FTS_ENTITY_PRIMARY_KEY_AFFINITY =
"The single @PrimaryKey annotated field in an " + "FTS entity must be of INTEGER affinity."
fun missingLanguageIdField(columnName: String) =
- "The specified 'languageid' column: " + "\"$columnName\", was not found."
+ "The specified 'languageid' column: \"$columnName\", was not found."
- val INVALID_FTS_ENTITY_LANGUAGE_ID_AFFINITY =
+ const val INVALID_FTS_ENTITY_LANGUAGE_ID_AFFINITY =
"The 'languageid' field must be of INTEGER " + "affinity."
fun missingNotIndexedField(missingNotIndexedColumns: List<String>) =
"Non-existent columns are specified to be not indexed in notIndexed: " +
missingNotIndexedColumns.joinToString(",")
- val INVALID_FTS_ENTITY_PREFIX_SIZES = "Prefix sizes to index must non-zero positive values."
+ const val INVALID_FTS_ENTITY_PREFIX_SIZES =
+ "Prefix sizes to index must non-zero positive values."
- val FTS_EXTERNAL_CONTENT_CANNOT_FIND_ENTITY = "Cannot find external content entity class."
+ const val FTS_EXTERNAL_CONTENT_CANNOT_FIND_ENTITY = "Cannot find external content entity class."
fun externalContentNotAnEntity(className: String) =
"External content entity referenced in " +
@@ -855,10 +867,10 @@
"$entityName that matches with this partial entity field. If you don't wish to use " +
"the field then you can annotate it with @Ignore."
- val INVALID_TARGET_ENTITY_IN_SHORTCUT_METHOD =
+ const val INVALID_TARGET_ENTITY_IN_SHORTCUT_FUNCTION =
"Target entity declared in @Insert, @Update " + "or @Delete must be annotated with @Entity."
- val INVALID_RELATION_IN_PARTIAL_ENTITY = "Partial entities cannot have relations."
+ const val INVALID_RELATION_IN_PARTIAL_ENTITY = "Partial entities cannot have relations."
fun invalidQueryForSingleColumnArray(returnType: String) =
"If a DAO function has a " +
@@ -911,20 +923,20 @@
fun cannotFindPreparedQueryResultAdapter(returnType: String, type: QueryType) =
StringBuilder()
.apply {
- append("Not sure how to handle query method's return type ($returnType). ")
+ append("Not sure how to handle query function's return type ($returnType). ")
if (type == QueryType.INSERT) {
append(
- "INSERT query methods must either return void " +
+ "INSERT query functions must either return void " +
"or long (the rowid of the inserted row)."
)
} else if (type == QueryType.UPDATE) {
append(
- "UPDATE query methods must either return void " +
+ "UPDATE query functions must either return void " +
"or int (the number of updated rows)."
)
} else if (type == QueryType.DELETE) {
append(
- "DELETE query methods must either return void " +
+ "DELETE query functions must either return void " +
"or int (the number of deleted rows)."
)
}
@@ -968,8 +980,8 @@
"""
.trim()
- val DATABASE_INVALID_DAO_METHOD_RETURN_TYPE =
- "Abstract database methods must return a @Dao " + "annotated class or interface."
+ const val DATABASE_INVALID_DAO_FUNCTION_RETURN_TYPE =
+ "Abstract database functions must return a @Dao " + "annotated class or interface."
fun invalidEntityTypeInDatabaseAnnotation(typeName: String): String {
return "Invalid Entity type: $typeName. An entity in the database must be a class."
@@ -985,22 +997,22 @@
"an @AutoMigration annotation."
}
- val EMBEDDED_TYPES_MUST_BE_A_CLASS_OR_INTERFACE =
+ const val EMBEDDED_TYPES_MUST_BE_A_CLASS_OR_INTERFACE =
"The type of an Embedded field must be a " + "class or an interface."
- val RELATION_TYPE_MUST_BE_A_CLASS_OR_INTERFACE =
+ const val RELATION_TYPE_MUST_BE_A_CLASS_OR_INTERFACE =
"Entity type in a Relation must be a class " + "or an interface."
- fun shortcutMethodArgumentMustBeAClass(typeName: String): String {
+ fun shortcutFunctionArgumentMustBeAClass(typeName: String): String {
return "Invalid query argument: $typeName. It must be a class or an interface."
}
- val AUTOMIGRATION_SPEC_MUST_BE_CLASS = "The AutoMigration spec " + "type must be a class."
+ const val AUTOMIGRATION_SPEC_MUST_BE_CLASS = "The AutoMigration spec " + "type must be a class."
fun autoMigrationElementMustImplementSpec(spec: String): String {
- return "The AutoMigration spec " + "$spec must implement the AutoMigrationSpec interface."
+ return "The AutoMigration spec $spec must implement the AutoMigrationSpec interface."
}
- // TODO: (b/180389433) If the files don't exist the getSchemaFile() method should return
+ // TODO: (b/180389433) If the files don't exist the getSchemaFile() function should return
// null and before calling process
fun autoMigrationToVersionMustBeGreaterThanFrom(to: Int, from: Int) =
if (from > to) {
@@ -1147,10 +1159,10 @@
return "Conflicting @RenameColumn annotations found: [$annotations]"
}
- val AUTO_MIGRATION_FOUND_BUT_EXPORT_SCHEMA_OFF =
+ const val AUTO_MIGRATION_FOUND_BUT_EXPORT_SCHEMA_OFF =
"Cannot create auto migrations when " + "exportSchema is false."
- val AUTO_MIGRATION_SCHEMA_IN_FOLDER_NULL =
+ const val AUTO_MIGRATION_SCHEMA_IN_FOLDER_NULL =
"Schema import directory was not provided to the" +
" annotation processor so Room cannot read older schemas. To generate auto migrations," +
" you must provide `room.schemaLocation` annotation processor arguments by applying the" +
@@ -1162,15 +1174,15 @@
" a different name."
}
- val INNER_CLASS_AUTOMIGRATION_SPEC_MUST_BE_STATIC =
+ const val INNER_CLASS_AUTOMIGRATION_SPEC_MUST_BE_STATIC =
"An inner class AutoMigrationSpec must be" + " static."
- val AUTOMIGRATION_SPEC_MISSING_NOARG_CONSTRUCTOR =
+ const val AUTOMIGRATION_SPEC_MISSING_NOARG_CONSTRUCTOR =
"Classes that are used as " +
"AutoMigrationSpec " +
"implementations must have no-argument public constructors."
- val JVM_NAME_ON_OVERRIDDEN_METHOD =
+ const val JVM_NAME_ON_OVERRIDDEN_FUNCTION =
"Using @JvmName annotation on a function or accessor " +
"that will be overridden by Room is not supported. If this is important for your use " +
"case, please file a bug at $ISSUE_TRACKER_LINK with details."
@@ -1198,7 +1210,7 @@
return "The column '$columnName' $locationDesc is ambiguous and cannot be properly " +
"resolved. Please alias the column and $recommendation. Otherwise there is a risk of " +
"the query returning invalid values. You can suppress this warning by annotating " +
- "the method with @SuppressWarnings(RoomWarnings.AMBIGUOUS_COLUMN_IN_RESULT)."
+ "the function with @SuppressWarnings(RoomWarnings.AMBIGUOUS_COLUMN_IN_RESULT)."
}
enum class AmbiguousColumnLocation {
@@ -1207,25 +1219,25 @@
ENTITY,
}
- val NONNULL_VOID =
+ const val NONNULL_VOID =
"Invalid non-null declaration of 'Void', should be nullable. The 'Void' " +
"class represents a placeholder type that is uninstantiable and 'null' is always returned."
- fun nullableCollectionOrArrayReturnTypeInDaoMethod(
+ fun nullableCollectionOrArrayReturnTypeInDaoFunction(
typeName: String,
returnType: String
): String {
- return "The nullable `$returnType` ($typeName) return type in a DAO method is " +
+ return "The nullable `$returnType` ($typeName) return type in a DAO function is " +
"meaningless because Room will instead return an empty `$returnType` if no rows are " +
"returned from the query."
}
- fun nullableComponentInDaoMethodReturnType(typeName: String): String {
- return "The DAO method return type ($typeName) with the nullable type argument " +
+ fun nullableComponentInDaoFunctionReturnType(typeName: String): String {
+ return "The DAO function return type ($typeName) with the nullable type argument " +
"is meaningless because for now Room will never put a null value in a result."
}
- val EXPORTING_SCHEMA_TO_RESOURCES =
+ const val EXPORTING_SCHEMA_TO_RESOURCES =
"Schema export is set to be outputted as a resource" +
" (i.e. room.exportSchemaResource is set to true), this means Room will write the current" +
" schema version file into the produced JAR. Such flag must only be used for generating" +
@@ -1233,42 +1245,42 @@
" the schema file will end up in the final artifact which is typically not desired. This" +
" warning serves as a reminder to use room.exportSchemaResource cautiously."
- val INVALID_GRADLE_PLUGIN_AND_SCHEMA_LOCATION_OPTION =
+ const val INVALID_GRADLE_PLUGIN_AND_SCHEMA_LOCATION_OPTION =
"The Room Gradle plugin " +
"(id 'androidx.room') cannot be used with an explicit use of the annotation processor" +
"option `room.schemaLocation`, please remove the configuration of the option and " +
"configure the schema location via the plugin project extension: " +
"`room { schemaDirectory(...) }`."
- val INVALID_DATABASE_VERSION = "Database version must be greater than 0"
+ const val INVALID_DATABASE_VERSION = "Database version must be greater than 0"
- val JAVA_CODEGEN_ON_NON_ANDROID_TARGET =
+ const val JAVA_CODEGEN_ON_NON_ANDROID_TARGET =
"Cannot generate Java targeting a non-Android " +
"platform. To generate Java, you must only have Android as a target platform. " +
"To process a non-Android target platform, you must enable Kotlin code " +
"generation in KSP."
- val INVALID_BLOCKING_DAO_FUNCTION_NON_ANDROID =
+ const val INVALID_BLOCKING_DAO_FUNCTION_NON_ANDROID =
"Only suspend functions are allowed in DAOs" +
" declared in source sets targeting non-Android platforms."
val INVALID_KOTLIN_CODE_GEN_IN_JAVAC =
"${Context.BooleanProcessorOptions.GENERATE_KOTLIN.argName} can only be enabled in KSP."
- val RAW_QUERY_NOT_SUPPORTED_ON_NON_ANDROID =
+ const val RAW_QUERY_NOT_SUPPORTED_ON_NON_ANDROID =
"@RawQuery annotated DAO functions are currently not supported in source sets targeting " +
"non-Android platforms."
- val MISSING_CONSTRUCTED_BY_ANNOTATION =
+ const val MISSING_CONSTRUCTED_BY_ANNOTATION =
"The @Database class must be annotated with @ConstructedBy since the source is targeting " +
"non-Android platforms."
- val INVALID_CONSTRUCTED_BY_CLASS = "The @ConstructedBy 'value' must be a valid class."
+ const val INVALID_CONSTRUCTED_BY_CLASS = "The @ConstructedBy 'value' must be a valid class."
- val INVALID_CONSTRUCTED_BY_NOT_OBJECT =
+ const val INVALID_CONSTRUCTED_BY_NOT_OBJECT =
"The @ConstructedBy definition must be an 'object' declaration."
- val INVALID_CONSTRUCTED_BY_NOT_EXPECT =
+ const val INVALID_CONSTRUCTED_BY_NOT_EXPECT =
"The @ConstructedBy definition must be an 'expect' declaration."
fun invalidConstructedBySuperInterface(expected: String) =
diff --git a/room/room-compiler/src/main/kotlin/androidx/room/processor/QueryMethodProcessor.kt b/room/room-compiler/src/main/kotlin/androidx/room/processor/QueryFunctionProcessor.kt
similarity index 88%
rename from room/room-compiler/src/main/kotlin/androidx/room/processor/QueryMethodProcessor.kt
rename to room/room-compiler/src/main/kotlin/androidx/room/processor/QueryFunctionProcessor.kt
index f01ca3d..1304860 100644
--- a/room/room-compiler/src/main/kotlin/androidx/room/processor/QueryMethodProcessor.kt
+++ b/room/room-compiler/src/main/kotlin/androidx/room/processor/QueryFunctionProcessor.kt
@@ -33,13 +33,13 @@
import androidx.room.verifier.DatabaseVerificationErrors
import androidx.room.verifier.DatabaseVerifier
import androidx.room.vo.MapInfo
-import androidx.room.vo.QueryMethod
+import androidx.room.vo.QueryFunction
import androidx.room.vo.QueryParameter
-import androidx.room.vo.ReadQueryMethod
+import androidx.room.vo.ReadQueryFunction
import androidx.room.vo.Warning
-import androidx.room.vo.WriteQueryMethod
+import androidx.room.vo.WriteQueryFunction
-class QueryMethodProcessor(
+class QueryFunctionProcessor(
baseContext: Context,
val containing: XType,
val executableElement: XMethodElement,
@@ -48,11 +48,11 @@
val context = baseContext.fork(executableElement)
/**
- * The processing of the method might happen in multiple steps if we decide to rewrite the query
- * after the first processing. To allow it while respecting the Context, it is implemented as a
- * sub procedure in [InternalQueryProcessor].
+ * The processing of the function might happen in multiple steps if we decide to rewrite the
+ * query after the first processing. To allow it while respecting the Context, it is implemented
+ * as a sub procedure in [InternalQueryProcessor].
*/
- fun process(): QueryMethod {
+ fun process(): QueryFunction {
val annotation = executableElement.getAnnotation(Query::class)?.value
context.checker.check(
annotation != null,
@@ -76,7 +76,7 @@
}
// check if want to swap the query for a better one
val finalResult =
- if (initialResult is ReadQueryMethod) {
+ if (initialResult is ReadQueryFunction) {
val resultAdapter = initialResult.queryResultBinder.adapter
val originalQuery = initialResult.query
val finalQuery =
@@ -112,8 +112,8 @@
val containing: XType,
val dbVerifier: DatabaseVerifier? = null
) {
- fun processQuery(input: String?): QueryMethod {
- val delegate = MethodProcessorDelegate.createFor(context, containing, executableElement)
+ fun processQuery(input: String?): QueryFunction {
+ val delegate = FunctionProcessorDelegate.createFor(context, containing, executableElement)
val returnType = delegate.extractReturnType()
val returnsDeferredType = delegate.returnsDeferredType()
@@ -156,23 +156,23 @@
context.checker.notUnbound(
returnType,
executableElement,
- ProcessorErrors.CANNOT_USE_UNBOUND_GENERICS_IN_QUERY_METHODS
+ ProcessorErrors.CANNOT_USE_UNBOUND_GENERICS_IN_QUERY_FUNCTIONS
)
val isPreparedQuery = PREPARED_TYPES.contains(query.type)
- val queryMethod =
+ val queryFunction =
if (isPreparedQuery) {
- getPreparedQueryMethod(delegate, returnType, query)
+ getPreparedQueryFunction(delegate, returnType, query)
} else {
- getQueryMethod(delegate, returnType, query)
+ getQueryFunction(delegate, returnType, query)
}
- return processQueryMethod(queryMethod)
+ return processQueryFunction(queryFunction)
}
- private fun processQueryMethod(queryMethod: QueryMethod): QueryMethod {
+ private fun processQueryFunction(queryFunction: QueryFunction): QueryFunction {
val missing =
- queryMethod.sectionToParamMapping.filter { it.second == null }.map { it.first.text }
+ queryFunction.sectionToParamMapping.filter { it.second == null }.map { it.first.text }
if (missing.isNotEmpty()) {
context.logger.e(
executableElement,
@@ -181,14 +181,19 @@
}
val unused =
- queryMethod.parameters
- .filterNot { param -> queryMethod.sectionToParamMapping.any { it.second == param } }
+ queryFunction.parameters
+ .filterNot { param ->
+ queryFunction.sectionToParamMapping.any { it.second == param }
+ }
.map(QueryParameter::sqlName)
if (unused.isNotEmpty()) {
- context.logger.e(executableElement, ProcessorErrors.unusedQueryMethodParameter(unused))
+ context.logger.e(
+ executableElement,
+ ProcessorErrors.unusedQueryFunctionParameter(unused)
+ )
}
- return queryMethod
+ return queryFunction
}
private fun validateQuery(query: ParsedQuery) {
@@ -205,11 +210,11 @@
}
}
- private fun getPreparedQueryMethod(
- delegate: MethodProcessorDelegate,
+ private fun getPreparedQueryFunction(
+ delegate: FunctionProcessorDelegate,
returnType: XType,
query: ParsedQuery
- ): WriteQueryMethod {
+ ): WriteQueryFunction {
val resultBinder = delegate.findPreparedResultBinder(returnType, query)
context.checker.check(
resultBinder.adapter != null,
@@ -221,7 +226,7 @@
)
val parameters = delegate.extractQueryParams(query)
- return WriteQueryMethod(
+ return WriteQueryFunction(
element = executableElement,
query = query,
returnType = returnType,
@@ -231,11 +236,11 @@
}
@Suppress("DEPRECATION") // Due to MapInfo usage
- private fun getQueryMethod(
- delegate: MethodProcessorDelegate,
+ private fun getQueryFunction(
+ delegate: FunctionProcessorDelegate,
returnType: XType,
query: ParsedQuery
- ): QueryMethod {
+ ): QueryFunction {
val resultBinder =
delegate.findResultBinder(returnType, query) {
delegate.executableElement.getAnnotation(androidx.room.MapInfo::class)?.let {
@@ -303,7 +308,7 @@
val parameters = delegate.extractQueryParams(query)
- return ReadQueryMethod(
+ return ReadQueryFunction(
element = executableElement,
query = query,
returnType = returnType,
diff --git a/room/room-compiler/src/main/kotlin/androidx/room/processor/RawQueryMethodProcessor.kt b/room/room-compiler/src/main/kotlin/androidx/room/processor/RawQueryFunctionProcessor.kt
similarity index 93%
rename from room/room-compiler/src/main/kotlin/androidx/room/processor/RawQueryMethodProcessor.kt
rename to room/room-compiler/src/main/kotlin/androidx/room/processor/RawQueryFunctionProcessor.kt
index 158cb27..6b7ecef 100644
--- a/room/room-compiler/src/main/kotlin/androidx/room/processor/RawQueryMethodProcessor.kt
+++ b/room/room-compiler/src/main/kotlin/androidx/room/processor/RawQueryFunctionProcessor.kt
@@ -28,17 +28,17 @@
import androidx.room.parser.SqlParser
import androidx.room.processor.ProcessorErrors.RAW_QUERY_STRING_PARAMETER_REMOVED
import androidx.room.vo.MapInfo
-import androidx.room.vo.RawQueryMethod
+import androidx.room.vo.RawQueryFunction
-class RawQueryMethodProcessor(
+class RawQueryFunctionProcessor(
baseContext: Context,
val containing: XType,
val executableElement: XMethodElement
) {
val context = baseContext.fork(executableElement)
- fun process(): RawQueryMethod {
- val delegate = MethodProcessorDelegate.createFor(context, containing, executableElement)
+ fun process(): RawQueryFunction {
+ val delegate = FunctionProcessorDelegate.createFor(context, containing, executableElement)
val returnType = delegate.extractReturnType()
context.checker.check(
@@ -50,7 +50,7 @@
context.checker.notUnbound(
returnType,
executableElement,
- ProcessorErrors.CANNOT_USE_UNBOUND_GENERICS_IN_QUERY_METHODS
+ ProcessorErrors.CANNOT_USE_UNBOUND_GENERICS_IN_QUERY_FUNCTIONS
)
val returnsDeferredType = delegate.returnsDeferredType()
@@ -91,8 +91,8 @@
val runtimeQueryParam = findRuntimeQueryParameter(delegate.extractParams())
val inTransaction = executableElement.hasAnnotation(Transaction::class)
- val rawQueryMethod =
- RawQueryMethod(
+ val rawQueryFunction =
+ RawQueryFunction(
element = executableElement,
observedTableNames = observedTableNames,
returnType = returnType,
@@ -102,11 +102,11 @@
)
// TODO: Lift this restriction, to allow for INSERT, UPDATE and DELETE raw statements.
context.checker.check(
- rawQueryMethod.returnsValue,
+ rawQueryFunction.returnsValue,
executableElement,
ProcessorErrors.RAW_QUERY_BAD_RETURN_TYPE
)
- return rawQueryMethod
+ return rawQueryFunction
}
private fun processObservedTables(): Set<String> {
@@ -151,7 +151,7 @@
private fun findRuntimeQueryParameter(
extractParams: List<XVariableElement>
- ): RawQueryMethod.RuntimeQueryParameter? {
+ ): RawQueryFunction.RuntimeQueryParameter? {
if (extractParams.size == 1 && !executableElement.isVarArgs()) {
val param = extractParams.first().asMemberOf(containing)
val processingEnv = context.processingEnv
@@ -167,7 +167,7 @@
processingEnv.findType(RoomTypeNames.RAW_QUERY)?.let { rawQueryType ->
if (rawQueryType.isAssignableFrom(param)) {
- return RawQueryMethod.RuntimeQueryParameter(
+ return RawQueryFunction.RuntimeQueryParameter(
paramName = extractParams[0].name,
typeName = rawQueryType.asTypeName()
)
@@ -176,7 +176,7 @@
processingEnv.findType(SupportDbTypeNames.QUERY)?.let { supportQueryType ->
if (supportQueryType.isAssignableFrom(param)) {
- return RawQueryMethod.RuntimeQueryParameter(
+ return RawQueryFunction.RuntimeQueryParameter(
paramName = extractParams[0].name,
typeName = supportQueryType.asTypeName()
)
diff --git a/room/room-compiler/src/main/kotlin/androidx/room/processor/ShortcutMethodProcessor.kt b/room/room-compiler/src/main/kotlin/androidx/room/processor/ShortcutFunctionProcessor.kt
similarity index 92%
rename from room/room-compiler/src/main/kotlin/androidx/room/processor/ShortcutMethodProcessor.kt
rename to room/room-compiler/src/main/kotlin/androidx/room/processor/ShortcutFunctionProcessor.kt
index 6507652..2291a2c 100644
--- a/room/room-compiler/src/main/kotlin/androidx/room/processor/ShortcutMethodProcessor.kt
+++ b/room/room-compiler/src/main/kotlin/androidx/room/processor/ShortcutFunctionProcessor.kt
@@ -27,14 +27,15 @@
import androidx.room.vo.findFieldByColumnName
import kotlin.reflect.KClass
-/** Common functionality for shortcut method processors */
-class ShortcutMethodProcessor(
+/** Common functionality for shortcut function processors */
+class ShortcutFunctionProcessor(
baseContext: Context,
val containing: XType,
val executableElement: XMethodElement
) {
val context = baseContext.fork(executableElement)
- private val delegate = MethodProcessorDelegate.createFor(context, containing, executableElement)
+ private val delegate =
+ FunctionProcessorDelegate.createFor(context, containing, executableElement)
fun <T : Annotation> extractAnnotation(klass: KClass<T>, errorMsg: String): XAnnotationBox<T>? {
val annotation = executableElement.getAnnotation(klass)
@@ -87,7 +88,7 @@
if (targetTypeElement == null) {
context.logger.e(
executableElement,
- ProcessorErrors.INVALID_TARGET_ENTITY_IN_SHORTCUT_METHOD
+ ProcessorErrors.INVALID_TARGET_ENTITY_IN_SHORTCUT_FUNCTION
)
null
} else {
@@ -96,7 +97,7 @@
onInvalid = {
context.logger.e(
executableElement,
- ProcessorErrors.INVALID_TARGET_ENTITY_IN_SHORTCUT_METHOD
+ ProcessorErrors.INVALID_TARGET_ENTITY_IN_SHORTCUT_FUNCTION
)
return emptyMap<String, ShortcutEntity>() to emptyList()
}
@@ -138,7 +139,7 @@
if (pojoTypeElement == null) {
context.logger.e(
targetEntity.element,
- ProcessorErrors.shortcutMethodArgumentMustBeAClass(
+ ProcessorErrors.shortcutFunctionArgumentMustBeAClass(
typeName =
param.pojoType.asTypeName().toString(context.codeLanguage)
)
@@ -229,12 +230,12 @@
null
}
- fun findInsertMethodBinder(returnType: XType, params: List<ShortcutQueryParameter>) =
- delegate.findInsertMethodBinder(returnType, params)
+ fun findInsertFunctionBinder(returnType: XType, params: List<ShortcutQueryParameter>) =
+ delegate.findInsertFunctionBinder(returnType, params)
- fun findUpsertMethodBinder(returnType: XType, params: List<ShortcutQueryParameter>) =
- delegate.findUpsertMethodBinder(returnType, params)
+ fun findUpsertFunctionBinder(returnType: XType, params: List<ShortcutQueryParameter>) =
+ delegate.findUpsertFunctionBinder(returnType, params)
- fun findDeleteOrUpdateMethodBinder(returnType: XType) =
- delegate.findDeleteOrUpdateMethodBinder(returnType)
+ fun findDeleteOrUpdateFunctionBinder(returnType: XType) =
+ delegate.findDeleteOrUpdateFunctionBinder(returnType)
}
diff --git a/room/room-compiler/src/main/kotlin/androidx/room/processor/ShortcutParameterProcessor.kt b/room/room-compiler/src/main/kotlin/androidx/room/processor/ShortcutParameterProcessor.kt
index 9b3dfdf..765526f 100644
--- a/room/room-compiler/src/main/kotlin/androidx/room/processor/ShortcutParameterProcessor.kt
+++ b/room/room-compiler/src/main/kotlin/androidx/room/processor/ShortcutParameterProcessor.kt
@@ -36,7 +36,7 @@
context.logger.e(
element = element,
msg =
- ProcessorErrors.nullableParamInShortcutMethod(
+ ProcessorErrors.nullableParamInShortcutFunction(
asMember.asTypeName().toString(context.codeLanguage)
)
)
diff --git a/room/room-compiler/src/main/kotlin/androidx/room/processor/TransactionMethodProcessor.kt b/room/room-compiler/src/main/kotlin/androidx/room/processor/TransactionFunctionProcessor.kt
similarity index 83%
rename from room/room-compiler/src/main/kotlin/androidx/room/processor/TransactionMethodProcessor.kt
rename to room/room-compiler/src/main/kotlin/androidx/room/processor/TransactionFunctionProcessor.kt
index 8667172..3994d4f 100644
--- a/room/room-compiler/src/main/kotlin/androidx/room/processor/TransactionMethodProcessor.kt
+++ b/room/room-compiler/src/main/kotlin/androidx/room/processor/TransactionFunctionProcessor.kt
@@ -21,9 +21,9 @@
import androidx.room.compiler.processing.XType
import androidx.room.compiler.processing.XTypeElement
import androidx.room.ext.DEFERRED_TYPES
-import androidx.room.vo.TransactionMethod
+import androidx.room.vo.TransactionFunction
-class TransactionMethodProcessor(
+class TransactionFunctionProcessor(
baseContext: Context,
val containingElement: XTypeElement,
val containingType: XType,
@@ -32,14 +32,15 @@
val context = baseContext.fork(executableElement)
- fun process(): TransactionMethod {
- val delegate = MethodProcessorDelegate.createFor(context, containingType, executableElement)
+ fun process(): TransactionFunction {
+ val delegate =
+ FunctionProcessorDelegate.createFor(context, containingType, executableElement)
val hasKotlinDefaultImpl = executableElement.hasKotlinDefaultImpl()
context.checker.check(
executableElement.isOverrideableIgnoringContainer() &&
(!executableElement.isAbstract() || hasKotlinDefaultImpl),
executableElement,
- ProcessorErrors.TRANSACTION_METHOD_MODIFIERS
+ ProcessorErrors.TRANSACTION_FUNCTION_MODIFIERS
)
val returnType = delegate.extractReturnType()
@@ -54,7 +55,7 @@
}
if (deferredReturnTypeName != null) {
context.logger.e(
- ProcessorErrors.transactionMethodAsync(
+ ProcessorErrors.transactionFunctionAsync(
deferredReturnTypeName.toString(context.codeLanguage)
),
executableElement
@@ -76,10 +77,10 @@
val callType =
when {
containingElement.isInterface() && executableElement.isJavaDefault() ->
- TransactionMethod.CallType.DEFAULT_JAVA8
+ TransactionFunction.CallType.DEFAULT_JAVA8
containingElement.isInterface() && hasKotlinDefaultImpl ->
- TransactionMethod.CallType.DEFAULT_KOTLIN
- else -> TransactionMethod.CallType.CONCRETE
+ TransactionFunction.CallType.DEFAULT_KOTLIN
+ else -> TransactionFunction.CallType.CONCRETE
}
val parameters = delegate.extractParams()
@@ -93,12 +94,12 @@
}
}
- return TransactionMethod(
+ return TransactionFunction(
element = executableElement,
returnType = returnType,
parameterNames = processedParamNames,
callType = callType,
- methodBinder = delegate.findTransactionMethodBinder(callType)
+ functionBinder = delegate.findTransactionFunctionBinder(callType)
)
}
}
diff --git a/room/room-compiler/src/main/kotlin/androidx/room/processor/UpdateMethodProcessor.kt b/room/room-compiler/src/main/kotlin/androidx/room/processor/UpdateFunctionProcessor.kt
similarity index 87%
rename from room/room-compiler/src/main/kotlin/androidx/room/processor/UpdateMethodProcessor.kt
rename to room/room-compiler/src/main/kotlin/androidx/room/processor/UpdateFunctionProcessor.kt
index 15c1dd8..704b25d 100644
--- a/room/room-compiler/src/main/kotlin/androidx/room/processor/UpdateMethodProcessor.kt
+++ b/room/room-compiler/src/main/kotlin/androidx/room/processor/UpdateFunctionProcessor.kt
@@ -20,18 +20,18 @@
import androidx.room.Update
import androidx.room.compiler.processing.XMethodElement
import androidx.room.compiler.processing.XType
-import androidx.room.vo.UpdateMethod
+import androidx.room.vo.UpdateFunction
import androidx.room.vo.findFieldByColumnName
-class UpdateMethodProcessor(
+class UpdateFunctionProcessor(
baseContext: Context,
val containing: XType,
val executableElement: XMethodElement
) {
val context = baseContext.fork(executableElement)
- fun process(): UpdateMethod {
- val delegate = ShortcutMethodProcessor(context, containing, executableElement)
+ fun process(): UpdateFunction {
+ val delegate = ShortcutFunctionProcessor(context, containing, executableElement)
val annotation =
delegate.extractAnnotation(Update::class, ProcessorErrors.MISSING_UPDATE_ANNOTATION)
@@ -63,19 +63,19 @@
)
val returnType = delegate.extractReturnType()
- val methodBinder = delegate.findDeleteOrUpdateMethodBinder(returnType)
+ val functionBinder = delegate.findDeleteOrUpdateFunctionBinder(returnType)
context.checker.check(
- methodBinder.adapter != null,
+ functionBinder.adapter != null,
executableElement,
ProcessorErrors.CANNOT_FIND_UPDATE_RESULT_ADAPTER
)
- return UpdateMethod(
+ return UpdateFunction(
element = delegate.executableElement,
entities = entities,
onConflictStrategy = onConflict,
- methodBinder = methodBinder,
+ functionBinder = functionBinder,
parameters = params
)
}
diff --git a/room/room-compiler/src/main/kotlin/androidx/room/processor/UpsertMethodProcessor.kt b/room/room-compiler/src/main/kotlin/androidx/room/processor/UpsertFunctionProcessor.kt
similarity index 89%
rename from room/room-compiler/src/main/kotlin/androidx/room/processor/UpsertMethodProcessor.kt
rename to room/room-compiler/src/main/kotlin/androidx/room/processor/UpsertFunctionProcessor.kt
index b65836c..cf4eff5 100644
--- a/room/room-compiler/src/main/kotlin/androidx/room/processor/UpsertMethodProcessor.kt
+++ b/room/room-compiler/src/main/kotlin/androidx/room/processor/UpsertFunctionProcessor.kt
@@ -19,18 +19,18 @@
import androidx.room.Upsert
import androidx.room.compiler.processing.XMethodElement
import androidx.room.compiler.processing.XType
-import androidx.room.vo.UpsertMethod
+import androidx.room.vo.UpsertFunction
import androidx.room.vo.findFieldByColumnName
-class UpsertMethodProcessor(
+class UpsertFunctionProcessor(
baseContext: Context,
val containing: XType,
val executableElement: XMethodElement
) {
val context = baseContext.fork(executableElement)
- fun process(): UpsertMethod {
- val delegate = ShortcutMethodProcessor(context, containing, executableElement)
+ fun process(): UpsertFunction {
+ val delegate = ShortcutFunctionProcessor(context, containing, executableElement)
val annotation =
delegate.extractAnnotation(Upsert::class, ProcessorErrors.MISSING_UPSERT_ANNOTATION)
@@ -39,7 +39,7 @@
context.checker.notUnbound(
returnType,
executableElement,
- ProcessorErrors.CANNOT_USE_UNBOUND_GENERICS_IN_UPSERT_METHODS
+ ProcessorErrors.CANNOT_USE_UNBOUND_GENERICS_IN_UPSERT_FUNCTIONS
)
val (entities, params) =
@@ -79,20 +79,20 @@
}
)
- val methodBinder = delegate.findUpsertMethodBinder(returnType, params)
+ val functionBinder = delegate.findUpsertFunctionBinder(returnType, params)
context.checker.check(
- methodBinder.adapter != null,
+ functionBinder.adapter != null,
executableElement,
ProcessorErrors.CANNOT_FIND_UPSERT_RESULT_ADAPTER
)
- return UpsertMethod(
+ return UpsertFunction(
element = executableElement,
returnType = returnType,
entities = entities,
parameters = params,
- methodBinder = methodBinder
+ functionBinder = functionBinder
)
}
}
diff --git a/room/room-compiler/src/main/kotlin/androidx/room/solver/KotlinBoxedPrimitiveMethodDelegateBinder.kt b/room/room-compiler/src/main/kotlin/androidx/room/solver/KotlinBoxedPrimitiveFunctionDelegateBinder.kt
similarity index 86%
rename from room/room-compiler/src/main/kotlin/androidx/room/solver/KotlinBoxedPrimitiveMethodDelegateBinder.kt
rename to room/room-compiler/src/main/kotlin/androidx/room/solver/KotlinBoxedPrimitiveFunctionDelegateBinder.kt
index 32c2d77..07817be 100644
--- a/room/room-compiler/src/main/kotlin/androidx/room/solver/KotlinBoxedPrimitiveMethodDelegateBinder.kt
+++ b/room/room-compiler/src/main/kotlin/androidx/room/solver/KotlinBoxedPrimitiveFunctionDelegateBinder.kt
@@ -22,18 +22,18 @@
import androidx.room.compiler.codegen.unbox
import androidx.room.compiler.processing.XType
import androidx.room.compiler.processing.isVoid
-import androidx.room.vo.KotlinBoxedPrimitiveMethodDelegate
+import androidx.room.vo.KotlinBoxedPrimitiveFunctionDelegate
/**
- * Method binder that delegates to a sibling DAO function in a Kotlin interface or abstract class
+ * Function binder that delegates to a sibling DAO function in a Kotlin interface or abstract class
* and specifically to a sibling function with unboxed primitive parameters.
*
- * @see [KotlinBoxedPrimitiveMethodDelegate]
+ * @see [KotlinBoxedPrimitiveFunctionDelegate]
*/
-object KotlinBoxedPrimitiveMethodDelegateBinder {
+object KotlinBoxedPrimitiveFunctionDelegateBinder {
fun execute(
- methodName: String,
+ functionName: String,
returnType: XType,
parameters: List<Pair<XTypeName, String>>,
scope: CodeGenScope
@@ -45,7 +45,7 @@
append("return ")
}
append("%L(")
- params.add(methodName)
+ params.add(functionName)
parameters.forEachIndexed { i, (typeName, name) ->
if (typeName.isPrimitive) {
append("(%T) %L")
diff --git a/room/room-compiler/src/main/kotlin/androidx/room/solver/KotlinDefaultMethodDelegateBinder.kt b/room/room-compiler/src/main/kotlin/androidx/room/solver/KotlinDefaultFunctionDelegateBinder.kt
similarity index 85%
rename from room/room-compiler/src/main/kotlin/androidx/room/solver/KotlinDefaultMethodDelegateBinder.kt
rename to room/room-compiler/src/main/kotlin/androidx/room/solver/KotlinDefaultFunctionDelegateBinder.kt
index a83c58f..a1beae3 100644
--- a/room/room-compiler/src/main/kotlin/androidx/room/solver/KotlinDefaultMethodDelegateBinder.kt
+++ b/room/room-compiler/src/main/kotlin/androidx/room/solver/KotlinDefaultFunctionDelegateBinder.kt
@@ -22,19 +22,19 @@
import androidx.room.compiler.processing.XType
import androidx.room.compiler.processing.isVoid
import androidx.room.ext.DEFAULT_IMPLS_CLASS_NAME
-import androidx.room.vo.KotlinDefaultMethodDelegate
+import androidx.room.vo.KotlinDefaultFunctionDelegate
/**
- * Method binder that delegates to concrete DAO function in a Kotlin interface, specifically to a
+ * Function binder that delegates to concrete DAO function in a Kotlin interface, specifically to a
* function where the implementation is in the DefaultImpl Kotlin generated class.
*
- * @see [KotlinDefaultMethodDelegate]
+ * @see [KotlinDefaultFunctionDelegate]
*/
-object KotlinDefaultMethodDelegateBinder {
+object KotlinDefaultFunctionDelegateBinder {
fun executeAndReturn(
daoName: XClassName,
daoImplName: XClassName,
- methodName: String,
+ functionName: String,
returnType: XType,
parameterNames: List<String>,
scope: CodeGenScope
@@ -48,7 +48,7 @@
append("%T.%L.%L(%T.this")
params.add(daoName)
params.add(DEFAULT_IMPLS_CLASS_NAME)
- params.add(methodName)
+ params.add(functionName)
params.add(daoImplName)
parameterNames.forEach {
append(", %L")
diff --git a/room/room-compiler/src/main/kotlin/androidx/room/solver/TypeAdapterStore.kt b/room/room-compiler/src/main/kotlin/androidx/room/solver/TypeAdapterStore.kt
index b2a9f1a..1c364db 100644
--- a/room/room-compiler/src/main/kotlin/androidx/room/solver/TypeAdapterStore.kt
+++ b/room/room-compiler/src/main/kotlin/androidx/room/solver/TypeAdapterStore.kt
@@ -90,18 +90,18 @@
import androidx.room.solver.query.result.SingleColumnRowAdapter
import androidx.room.solver.query.result.SingleItemQueryResultAdapter
import androidx.room.solver.query.result.SingleNamedColumnRowAdapter
-import androidx.room.solver.shortcut.binder.DeleteOrUpdateMethodBinder
-import androidx.room.solver.shortcut.binder.InsertOrUpsertMethodBinder
-import androidx.room.solver.shortcut.binderprovider.DeleteOrUpdateMethodBinderProvider
-import androidx.room.solver.shortcut.binderprovider.GuavaListenableFutureDeleteOrUpdateMethodBinderProvider
-import androidx.room.solver.shortcut.binderprovider.GuavaListenableFutureInsertOrUpsertMethodBinderProvider
-import androidx.room.solver.shortcut.binderprovider.InsertOrUpsertMethodBinderProvider
-import androidx.room.solver.shortcut.binderprovider.InstantDeleteOrUpdateMethodBinderProvider
-import androidx.room.solver.shortcut.binderprovider.InstantInsertOrUpsertMethodBinderProvider
-import androidx.room.solver.shortcut.binderprovider.RxCallableDeleteOrUpdateMethodBinderProvider
-import androidx.room.solver.shortcut.binderprovider.RxCallableInsertOrUpsertMethodBinderProvider
-import androidx.room.solver.shortcut.result.DeleteOrUpdateMethodAdapter
-import androidx.room.solver.shortcut.result.InsertOrUpsertMethodAdapter
+import androidx.room.solver.shortcut.binder.DeleteOrUpdateFunctionBinder
+import androidx.room.solver.shortcut.binder.InsertOrUpsertFunctionBinder
+import androidx.room.solver.shortcut.binderprovider.DeleteOrUpdateFunctionBinderProvider
+import androidx.room.solver.shortcut.binderprovider.GuavaListenableFutureDeleteOrUpdateFunctionBinderProvider
+import androidx.room.solver.shortcut.binderprovider.GuavaListenableFutureInsertOrUpsertFunctionBinderProvider
+import androidx.room.solver.shortcut.binderprovider.InsertOrUpsertFunctionBinderProvider
+import androidx.room.solver.shortcut.binderprovider.InstantDeleteOrUpdateFunctionBinderProvider
+import androidx.room.solver.shortcut.binderprovider.InstantInsertOrUpsertFunctionBinderProvider
+import androidx.room.solver.shortcut.binderprovider.RxCallableDeleteOrUpdateFunctionBinderProvider
+import androidx.room.solver.shortcut.binderprovider.RxCallableInsertOrUpsertFunctionBinderProvider
+import androidx.room.solver.shortcut.result.DeleteOrUpdateFunctionAdapter
+import androidx.room.solver.shortcut.result.InsertOrUpsertFunctionAdapter
import androidx.room.solver.types.BoxedBooleanToBoxedIntConverter
import androidx.room.solver.types.BoxedPrimitiveColumnTypeAdapter
import androidx.room.solver.types.ByteArrayColumnTypeAdapter
@@ -229,18 +229,18 @@
add(InstantPreparedQueryResultBinderProvider(context))
}
- private val insertOrUpsertBinderProviders: List<InsertOrUpsertMethodBinderProvider> =
- mutableListOf<InsertOrUpsertMethodBinderProvider>().apply {
- addAll(RxCallableInsertOrUpsertMethodBinderProvider.getAll(context))
- add(GuavaListenableFutureInsertOrUpsertMethodBinderProvider(context))
- add(InstantInsertOrUpsertMethodBinderProvider(context))
+ private val insertOrUpsertBinderProviders: List<InsertOrUpsertFunctionBinderProvider> =
+ mutableListOf<InsertOrUpsertFunctionBinderProvider>().apply {
+ addAll(RxCallableInsertOrUpsertFunctionBinderProvider.getAll(context))
+ add(GuavaListenableFutureInsertOrUpsertFunctionBinderProvider(context))
+ add(InstantInsertOrUpsertFunctionBinderProvider(context))
}
- private val deleteOrUpdateBinderProvider: List<DeleteOrUpdateMethodBinderProvider> =
- mutableListOf<DeleteOrUpdateMethodBinderProvider>().apply {
- addAll(RxCallableDeleteOrUpdateMethodBinderProvider.getAll(context))
- add(GuavaListenableFutureDeleteOrUpdateMethodBinderProvider(context))
- add(InstantDeleteOrUpdateMethodBinderProvider(context))
+ private val deleteOrUpdateBinderProvider: List<DeleteOrUpdateFunctionBinderProvider> =
+ mutableListOf<DeleteOrUpdateFunctionBinderProvider>().apply {
+ addAll(RxCallableDeleteOrUpdateFunctionBinderProvider.getAll(context))
+ add(GuavaListenableFutureDeleteOrUpdateFunctionBinderProvider(context))
+ add(InstantDeleteOrUpdateFunctionBinderProvider(context))
}
/** Searches 1 way to bind a value into a statement. */
@@ -419,23 +419,23 @@
}
}
- fun findDeleteOrUpdateMethodBinder(typeMirror: XType): DeleteOrUpdateMethodBinder {
+ fun findDeleteOrUpdateFunctionBinder(typeMirror: XType): DeleteOrUpdateFunctionBinder {
return deleteOrUpdateBinderProvider.first { it.matches(typeMirror) }.provide(typeMirror)
}
- fun findInsertMethodBinder(
+ fun findInsertFunctionBinder(
typeMirror: XType,
params: List<ShortcutQueryParameter>
- ): InsertOrUpsertMethodBinder {
+ ): InsertOrUpsertFunctionBinder {
return insertOrUpsertBinderProviders
.first { it.matches(typeMirror) }
.provide(typeMirror, params, false)
}
- fun findUpsertMethodBinder(
+ fun findUpsertFunctionBinder(
typeMirror: XType,
params: List<ShortcutQueryParameter>
- ): InsertOrUpsertMethodBinder {
+ ): InsertOrUpsertFunctionBinder {
return insertOrUpsertBinderProviders
.first { it.matches(typeMirror) }
.provide(typeMirror, params, true)
@@ -471,22 +471,22 @@
fun findPreparedQueryResultAdapter(typeMirror: XType, query: ParsedQuery) =
PreparedQueryResultAdapter.create(typeMirror, query.type)
- fun findDeleteOrUpdateAdapter(typeMirror: XType): DeleteOrUpdateMethodAdapter? {
- return DeleteOrUpdateMethodAdapter.create(typeMirror)
+ fun findDeleteOrUpdateAdapter(typeMirror: XType): DeleteOrUpdateFunctionAdapter? {
+ return DeleteOrUpdateFunctionAdapter.create(typeMirror)
}
fun findInsertAdapter(
typeMirror: XType,
params: List<ShortcutQueryParameter>
- ): InsertOrUpsertMethodAdapter? {
- return InsertOrUpsertMethodAdapter.createInsert(context, typeMirror, params)
+ ): InsertOrUpsertFunctionAdapter? {
+ return InsertOrUpsertFunctionAdapter.createInsert(context, typeMirror, params)
}
fun findUpsertAdapter(
typeMirror: XType,
params: List<ShortcutQueryParameter>
- ): InsertOrUpsertMethodAdapter? {
- return InsertOrUpsertMethodAdapter.createUpsert(context, typeMirror, params)
+ ): InsertOrUpsertFunctionAdapter? {
+ return InsertOrUpsertFunctionAdapter.createUpsert(context, typeMirror, params)
}
fun findQueryResultAdapter(
@@ -772,7 +772,7 @@
if (collectionType.nullability != XNullability.NONNULL) {
context.logger.w(
Warning.UNNECESSARY_NULLABILITY_IN_DAO_RETURN_TYPE,
- ProcessorErrors.nullableCollectionOrArrayReturnTypeInDaoMethod(
+ ProcessorErrors.nullableCollectionOrArrayReturnTypeInDaoFunction(
searchingType.asTypeName().toString(context.codeLanguage),
typeKeyword
)
@@ -783,7 +783,7 @@
if (arrayComponentType != null && arrayComponentType.nullability != XNullability.NONNULL) {
context.logger.w(
Warning.UNNECESSARY_NULLABILITY_IN_DAO_RETURN_TYPE,
- ProcessorErrors.nullableComponentInDaoMethodReturnType(
+ ProcessorErrors.nullableComponentInDaoFunctionReturnType(
searchingType.asTypeName().toString(context.codeLanguage)
)
)
@@ -794,7 +794,7 @@
if (typeArg.nullability != XNullability.NONNULL) {
context.logger.w(
Warning.UNNECESSARY_NULLABILITY_IN_DAO_RETURN_TYPE,
- ProcessorErrors.nullableComponentInDaoMethodReturnType(
+ ProcessorErrors.nullableComponentInDaoFunctionReturnType(
searchingType.asTypeName().toString(context.codeLanguage)
)
)
diff --git a/room/room-compiler/src/main/kotlin/androidx/room/solver/shortcut/binder/CoroutineDeleteOrUpdateMethodBinder.kt b/room/room-compiler/src/main/kotlin/androidx/room/solver/shortcut/binder/CoroutineDeleteOrUpdateFunctionBinder.kt
similarity index 91%
rename from room/room-compiler/src/main/kotlin/androidx/room/solver/shortcut/binder/CoroutineDeleteOrUpdateMethodBinder.kt
rename to room/room-compiler/src/main/kotlin/androidx/room/solver/shortcut/binder/CoroutineDeleteOrUpdateFunctionBinder.kt
index 348f3a1..4799df2 100644
--- a/room/room-compiler/src/main/kotlin/androidx/room/solver/shortcut/binder/CoroutineDeleteOrUpdateMethodBinder.kt
+++ b/room/room-compiler/src/main/kotlin/androidx/room/solver/shortcut/binder/CoroutineDeleteOrUpdateFunctionBinder.kt
@@ -26,15 +26,15 @@
import androidx.room.ext.RoomMemberNames.DB_UTIL_PERFORM_SUSPENDING
import androidx.room.ext.SQLiteDriverTypeNames
import androidx.room.solver.CodeGenScope
-import androidx.room.solver.shortcut.result.DeleteOrUpdateMethodAdapter
+import androidx.room.solver.shortcut.result.DeleteOrUpdateFunctionAdapter
import androidx.room.vo.ShortcutQueryParameter
/** Binder for suspending delete and update methods. */
-class CoroutineDeleteOrUpdateMethodBinder(
+class CoroutineDeleteOrUpdateFunctionBinder(
val typeArg: XType,
- adapter: DeleteOrUpdateMethodAdapter?,
+ adapter: DeleteOrUpdateFunctionAdapter?,
private val continuationParamName: String
-) : DeleteOrUpdateMethodBinder(adapter) {
+) : DeleteOrUpdateFunctionBinder(adapter) {
override fun convertAndReturn(
parameters: List<ShortcutQueryParameter>,
@@ -62,7 +62,7 @@
javaLambdaSyntaxAvailable = scope.javaLambdaSyntaxAvailable
) {
override fun XCodeBlock.Builder.body(scope: CodeGenScope) {
- adapter.generateMethodBody(
+ adapter.generateFunctionBody(
scope = scope,
parameters = parameters,
adapters = adapters,
diff --git a/room/room-compiler/src/main/kotlin/androidx/room/solver/shortcut/binder/CoroutineInsertOrUpsertMethodBinder.kt b/room/room-compiler/src/main/kotlin/androidx/room/solver/shortcut/binder/CoroutineInsertOrUpsertFunctionBinder.kt
similarity index 91%
rename from room/room-compiler/src/main/kotlin/androidx/room/solver/shortcut/binder/CoroutineInsertOrUpsertMethodBinder.kt
rename to room/room-compiler/src/main/kotlin/androidx/room/solver/shortcut/binder/CoroutineInsertOrUpsertFunctionBinder.kt
index e8043e3..dae6d52b 100644
--- a/room/room-compiler/src/main/kotlin/androidx/room/solver/shortcut/binder/CoroutineInsertOrUpsertMethodBinder.kt
+++ b/room/room-compiler/src/main/kotlin/androidx/room/solver/shortcut/binder/CoroutineInsertOrUpsertFunctionBinder.kt
@@ -25,15 +25,15 @@
import androidx.room.ext.RoomMemberNames.DB_UTIL_PERFORM_SUSPENDING
import androidx.room.ext.SQLiteDriverTypeNames
import androidx.room.solver.CodeGenScope
-import androidx.room.solver.shortcut.result.InsertOrUpsertMethodAdapter
+import androidx.room.solver.shortcut.result.InsertOrUpsertFunctionAdapter
import androidx.room.vo.ShortcutQueryParameter
/** Binder for suspending insert or upsert methods. */
-class CoroutineInsertOrUpsertMethodBinder(
+class CoroutineInsertOrUpsertFunctionBinder(
val typeArg: XType,
- adapter: InsertOrUpsertMethodAdapter?,
+ adapter: InsertOrUpsertFunctionAdapter?,
private val continuationParamName: String
-) : InsertOrUpsertMethodBinder(adapter) {
+) : InsertOrUpsertFunctionBinder(adapter) {
override fun convertAndReturn(
parameters: List<ShortcutQueryParameter>,
@@ -61,7 +61,7 @@
javaLambdaSyntaxAvailable = scope.javaLambdaSyntaxAvailable
) {
override fun XCodeBlock.Builder.body(scope: CodeGenScope) {
- adapter.generateMethodBody(
+ adapter.generateFunctionBody(
scope = scope,
parameters = parameters,
adapters = adapters,
diff --git a/room/room-compiler/src/main/kotlin/androidx/room/solver/shortcut/binder/DeleteOrUpdateMethodBinder.kt b/room/room-compiler/src/main/kotlin/androidx/room/solver/shortcut/binder/DeleteOrUpdateFunctionBinder.kt
similarity index 72%
rename from room/room-compiler/src/main/kotlin/androidx/room/solver/shortcut/binder/DeleteOrUpdateMethodBinder.kt
rename to room/room-compiler/src/main/kotlin/androidx/room/solver/shortcut/binder/DeleteOrUpdateFunctionBinder.kt
index 25342d5..525256e 100644
--- a/room/room-compiler/src/main/kotlin/androidx/room/solver/shortcut/binder/DeleteOrUpdateMethodBinder.kt
+++ b/room/room-compiler/src/main/kotlin/androidx/room/solver/shortcut/binder/DeleteOrUpdateFunctionBinder.kt
@@ -19,17 +19,18 @@
import androidx.room.compiler.codegen.XPropertySpec
import androidx.room.compiler.codegen.XTypeSpec
import androidx.room.solver.CodeGenScope
-import androidx.room.solver.shortcut.result.DeleteOrUpdateMethodAdapter
+import androidx.room.solver.shortcut.result.DeleteOrUpdateFunctionAdapter
import androidx.room.vo.ShortcutQueryParameter
/**
- * Connects the delete or update method, the database and the [DeleteOrUpdateMethodAdapter].
+ * Connects the delete or update method, the database and the [DeleteOrUpdateFunctionAdapter].
*
- * The default implementation is [InstantDeleteOrUpdateMethodBinder] that executes the delete/update
- * synchronously. If the delete/update is deferred, rather than synchronously, alternatives
- * implementations can be implemented using this interface (e.g. RxJava, coroutines etc).
+ * The default implementation is [InstantDeleteOrUpdateFunctionBinder] that executes the
+ * delete/update synchronously. If the delete/update is deferred, rather than synchronously,
+ * alternatives implementations can be implemented using this interface (e.g. RxJava, coroutines
+ * etc).
*/
-abstract class DeleteOrUpdateMethodBinder(val adapter: DeleteOrUpdateMethodAdapter?) {
+abstract class DeleteOrUpdateFunctionBinder(val adapter: DeleteOrUpdateFunctionAdapter?) {
/**
* Received the delete/update method parameters, the adapters and generates the code that runs
diff --git a/room/room-compiler/src/main/kotlin/androidx/room/solver/shortcut/binder/InsertOrUpsertMethodBinder.kt b/room/room-compiler/src/main/kotlin/androidx/room/solver/shortcut/binder/InsertOrUpsertFunctionBinder.kt
similarity index 85%
rename from room/room-compiler/src/main/kotlin/androidx/room/solver/shortcut/binder/InsertOrUpsertMethodBinder.kt
rename to room/room-compiler/src/main/kotlin/androidx/room/solver/shortcut/binder/InsertOrUpsertFunctionBinder.kt
index 67fb0fd..fb180a4 100644
--- a/room/room-compiler/src/main/kotlin/androidx/room/solver/shortcut/binder/InsertOrUpsertMethodBinder.kt
+++ b/room/room-compiler/src/main/kotlin/androidx/room/solver/shortcut/binder/InsertOrUpsertFunctionBinder.kt
@@ -18,11 +18,11 @@
import androidx.room.compiler.codegen.XPropertySpec
import androidx.room.solver.CodeGenScope
-import androidx.room.solver.shortcut.result.InsertOrUpsertMethodAdapter
+import androidx.room.solver.shortcut.result.InsertOrUpsertFunctionAdapter
import androidx.room.vo.ShortcutQueryParameter
-/** Connects the insert and upsert method, the database and the [InsertOrUpsertMethodAdapter]. */
-abstract class InsertOrUpsertMethodBinder(val adapter: InsertOrUpsertMethodAdapter?) {
+/** Connects the insert and upsert method, the database and the [InsertOrUpsertFunctionAdapter]. */
+abstract class InsertOrUpsertFunctionBinder(val adapter: InsertOrUpsertFunctionAdapter?) {
/**
* Received an insert or upsert method parameters, their adapters and generations the code that
diff --git a/room/room-compiler/src/main/kotlin/androidx/room/solver/shortcut/binder/InstantDeleteOrUpdateMethodBinder.kt b/room/room-compiler/src/main/kotlin/androidx/room/solver/shortcut/binder/InstantDeleteOrUpdateFunctionBinder.kt
similarity index 92%
rename from room/room-compiler/src/main/kotlin/androidx/room/solver/shortcut/binder/InstantDeleteOrUpdateMethodBinder.kt
rename to room/room-compiler/src/main/kotlin/androidx/room/solver/shortcut/binder/InstantDeleteOrUpdateFunctionBinder.kt
index 34e4967..6dcbdb3 100644
--- a/room/room-compiler/src/main/kotlin/androidx/room/solver/shortcut/binder/InstantDeleteOrUpdateMethodBinder.kt
+++ b/room/room-compiler/src/main/kotlin/androidx/room/solver/shortcut/binder/InstantDeleteOrUpdateFunctionBinder.kt
@@ -27,12 +27,12 @@
import androidx.room.ext.SQLiteDriverTypeNames
import androidx.room.ext.isNotVoid
import androidx.room.solver.CodeGenScope
-import androidx.room.solver.shortcut.result.DeleteOrUpdateMethodAdapter
+import androidx.room.solver.shortcut.result.DeleteOrUpdateFunctionAdapter
import androidx.room.vo.ShortcutQueryParameter
/** Binder that knows how to write instant (blocking) delete and update methods. */
-class InstantDeleteOrUpdateMethodBinder(adapter: DeleteOrUpdateMethodAdapter?) :
- DeleteOrUpdateMethodBinder(adapter) {
+class InstantDeleteOrUpdateFunctionBinder(adapter: DeleteOrUpdateFunctionAdapter?) :
+ DeleteOrUpdateFunctionBinder(adapter) {
override fun convertAndReturn(
parameters: List<ShortcutQueryParameter>,
@@ -59,7 +59,7 @@
javaLambdaSyntaxAvailable = scope.javaLambdaSyntaxAvailable
) {
override fun XCodeBlock.Builder.body(scope: CodeGenScope) {
- adapter.generateMethodBody(
+ adapter.generateFunctionBody(
scope = scope,
parameters = parameters,
adapters = adapters,
diff --git a/room/room-compiler/src/main/kotlin/androidx/room/solver/shortcut/binder/InstantInsertOrUpsertMethodBinder.kt b/room/room-compiler/src/main/kotlin/androidx/room/solver/shortcut/binder/InstantInsertOrUpsertFunctionBinder.kt
similarity index 91%
rename from room/room-compiler/src/main/kotlin/androidx/room/solver/shortcut/binder/InstantInsertOrUpsertMethodBinder.kt
rename to room/room-compiler/src/main/kotlin/androidx/room/solver/shortcut/binder/InstantInsertOrUpsertFunctionBinder.kt
index 322e206..a740eeb 100644
--- a/room/room-compiler/src/main/kotlin/androidx/room/solver/shortcut/binder/InstantInsertOrUpsertMethodBinder.kt
+++ b/room/room-compiler/src/main/kotlin/androidx/room/solver/shortcut/binder/InstantInsertOrUpsertFunctionBinder.kt
@@ -26,12 +26,12 @@
import androidx.room.ext.SQLiteDriverTypeNames
import androidx.room.ext.isNotVoid
import androidx.room.solver.CodeGenScope
-import androidx.room.solver.shortcut.result.InsertOrUpsertMethodAdapter
+import androidx.room.solver.shortcut.result.InsertOrUpsertFunctionAdapter
import androidx.room.vo.ShortcutQueryParameter
/** Binder that knows how to write instant (blocking) insert or upsert methods. */
-class InstantInsertOrUpsertMethodBinder(adapter: InsertOrUpsertMethodAdapter?) :
- InsertOrUpsertMethodBinder(adapter) {
+class InstantInsertOrUpsertFunctionBinder(adapter: InsertOrUpsertFunctionAdapter?) :
+ InsertOrUpsertFunctionBinder(adapter) {
override fun convertAndReturn(
parameters: List<ShortcutQueryParameter>,
@@ -58,7 +58,7 @@
javaLambdaSyntaxAvailable = scope.javaLambdaSyntaxAvailable
) {
override fun XCodeBlock.Builder.body(scope: CodeGenScope) {
- adapter.generateMethodBody(
+ adapter.generateFunctionBody(
scope = scope,
parameters = parameters,
adapters = adapters,
diff --git a/room/room-compiler/src/main/kotlin/androidx/room/solver/shortcut/binder/LambdaDeleteOrUpdateMethodBinder.kt b/room/room-compiler/src/main/kotlin/androidx/room/solver/shortcut/binder/LambdaDeleteOrUpdateFunctionBinder.kt
similarity index 91%
rename from room/room-compiler/src/main/kotlin/androidx/room/solver/shortcut/binder/LambdaDeleteOrUpdateMethodBinder.kt
rename to room/room-compiler/src/main/kotlin/androidx/room/solver/shortcut/binder/LambdaDeleteOrUpdateFunctionBinder.kt
index 3cdca44..1d01edb 100644
--- a/room/room-compiler/src/main/kotlin/androidx/room/solver/shortcut/binder/LambdaDeleteOrUpdateMethodBinder.kt
+++ b/room/room-compiler/src/main/kotlin/androidx/room/solver/shortcut/binder/LambdaDeleteOrUpdateFunctionBinder.kt
@@ -25,7 +25,7 @@
import androidx.room.ext.LambdaSpec
import androidx.room.ext.SQLiteDriverTypeNames
import androidx.room.solver.CodeGenScope
-import androidx.room.solver.shortcut.result.DeleteOrUpdateMethodAdapter
+import androidx.room.solver.shortcut.result.DeleteOrUpdateFunctionAdapter
import androidx.room.vo.ShortcutQueryParameter
/**
@@ -34,11 +34,11 @@
* This binder generates code that invokes [functionName] with a lambda whose body will delegate to
* the given [adapter].
*/
-class LambdaDeleteOrUpdateMethodBinder(
+class LambdaDeleteOrUpdateFunctionBinder(
val typeArg: XType,
val functionName: XMemberName,
- adapter: DeleteOrUpdateMethodAdapter?
-) : DeleteOrUpdateMethodBinder(adapter) {
+ adapter: DeleteOrUpdateFunctionAdapter?
+) : DeleteOrUpdateFunctionBinder(adapter) {
override fun convertAndReturn(
parameters: List<ShortcutQueryParameter>,
adapters: Map<String, Pair<XPropertySpec, XTypeSpec>>,
@@ -64,7 +64,7 @@
javaLambdaSyntaxAvailable = scope.javaLambdaSyntaxAvailable
) {
override fun XCodeBlock.Builder.body(scope: CodeGenScope) {
- adapter.generateMethodBody(
+ adapter.generateFunctionBody(
scope = scope,
parameters = parameters,
adapters = adapters,
diff --git a/room/room-compiler/src/main/kotlin/androidx/room/solver/shortcut/binder/LambdaInsertOrUpsertMethodBinder.kt b/room/room-compiler/src/main/kotlin/androidx/room/solver/shortcut/binder/LambdaInsertOrUpsertFunctionBinder.kt
similarity index 91%
rename from room/room-compiler/src/main/kotlin/androidx/room/solver/shortcut/binder/LambdaInsertOrUpsertMethodBinder.kt
rename to room/room-compiler/src/main/kotlin/androidx/room/solver/shortcut/binder/LambdaInsertOrUpsertFunctionBinder.kt
index af0a2ea..2619f3d 100644
--- a/room/room-compiler/src/main/kotlin/androidx/room/solver/shortcut/binder/LambdaInsertOrUpsertMethodBinder.kt
+++ b/room/room-compiler/src/main/kotlin/androidx/room/solver/shortcut/binder/LambdaInsertOrUpsertFunctionBinder.kt
@@ -24,7 +24,7 @@
import androidx.room.ext.LambdaSpec
import androidx.room.ext.SQLiteDriverTypeNames
import androidx.room.solver.CodeGenScope
-import androidx.room.solver.shortcut.result.InsertOrUpsertMethodAdapter
+import androidx.room.solver.shortcut.result.InsertOrUpsertFunctionAdapter
import androidx.room.vo.ShortcutQueryParameter
/**
@@ -33,11 +33,11 @@
* This binder generates code that invokes [functionName] with a lambda whose body will delegate to
* the given [adapter].
*/
-class LambdaInsertOrUpsertMethodBinder(
+class LambdaInsertOrUpsertFunctionBinder(
val typeArg: XType,
val functionName: XMemberName,
- adapter: InsertOrUpsertMethodAdapter?
-) : InsertOrUpsertMethodBinder(adapter) {
+ adapter: InsertOrUpsertFunctionAdapter?
+) : InsertOrUpsertFunctionBinder(adapter) {
override fun convertAndReturn(
parameters: List<ShortcutQueryParameter>,
@@ -64,7 +64,7 @@
javaLambdaSyntaxAvailable = scope.javaLambdaSyntaxAvailable
) {
override fun XCodeBlock.Builder.body(scope: CodeGenScope) {
- adapter.generateMethodBody(
+ adapter.generateFunctionBody(
scope = scope,
parameters = parameters,
adapters = adapters,
diff --git a/room/room-compiler/src/main/kotlin/androidx/room/solver/shortcut/binderprovider/DeleteOrUpdateMethodBinderProvider.kt b/room/room-compiler/src/main/kotlin/androidx/room/solver/shortcut/binderprovider/DeleteOrUpdateFunctionBinderProvider.kt
similarity index 70%
rename from room/room-compiler/src/main/kotlin/androidx/room/solver/shortcut/binderprovider/DeleteOrUpdateMethodBinderProvider.kt
rename to room/room-compiler/src/main/kotlin/androidx/room/solver/shortcut/binderprovider/DeleteOrUpdateFunctionBinderProvider.kt
index bf22009..d6d5215 100644
--- a/room/room-compiler/src/main/kotlin/androidx/room/solver/shortcut/binderprovider/DeleteOrUpdateMethodBinderProvider.kt
+++ b/room/room-compiler/src/main/kotlin/androidx/room/solver/shortcut/binderprovider/DeleteOrUpdateFunctionBinderProvider.kt
@@ -17,15 +17,15 @@
package androidx.room.solver.shortcut.binderprovider
import androidx.room.compiler.processing.XType
-import androidx.room.solver.shortcut.binder.DeleteOrUpdateMethodBinder
-import androidx.room.solver.shortcut.result.DeleteOrUpdateMethodAdapter
+import androidx.room.solver.shortcut.binder.DeleteOrUpdateFunctionBinder
+import androidx.room.solver.shortcut.result.DeleteOrUpdateFunctionAdapter
/** Provider for delete or update binders */
-interface DeleteOrUpdateMethodBinderProvider {
+interface DeleteOrUpdateFunctionBinderProvider {
- /** Check whether the [XType] can be handled by the [DeleteOrUpdateMethodBinder] */
+ /** Check whether the [XType] can be handled by the [DeleteOrUpdateFunctionBinder] */
fun matches(declared: XType): Boolean
- /** Provider of [DeleteOrUpdateMethodAdapter], based on the [XType] */
- fun provide(declared: XType): DeleteOrUpdateMethodBinder
+ /** Provider of [DeleteOrUpdateFunctionAdapter], based on the [XType] */
+ fun provide(declared: XType): DeleteOrUpdateFunctionBinder
}
diff --git a/room/room-compiler/src/main/kotlin/androidx/room/solver/shortcut/binderprovider/GuavaListenableFutureDeleteOrUpdateMethodBinderProvider.kt b/room/room-compiler/src/main/kotlin/androidx/room/solver/shortcut/binderprovider/GuavaListenableFutureDeleteOrUpdateFunctionBinderProvider.kt
similarity index 85%
rename from room/room-compiler/src/main/kotlin/androidx/room/solver/shortcut/binderprovider/GuavaListenableFutureDeleteOrUpdateMethodBinderProvider.kt
rename to room/room-compiler/src/main/kotlin/androidx/room/solver/shortcut/binderprovider/GuavaListenableFutureDeleteOrUpdateFunctionBinderProvider.kt
index bca756c..88e0680 100644
--- a/room/room-compiler/src/main/kotlin/androidx/room/solver/shortcut/binderprovider/GuavaListenableFutureDeleteOrUpdateMethodBinderProvider.kt
+++ b/room/room-compiler/src/main/kotlin/androidx/room/solver/shortcut/binderprovider/GuavaListenableFutureDeleteOrUpdateFunctionBinderProvider.kt
@@ -24,12 +24,12 @@
import androidx.room.ext.RoomGuavaTypeNames.GUAVA_ROOM_MARKER
import androidx.room.processor.Context
import androidx.room.processor.ProcessorErrors
-import androidx.room.solver.shortcut.binder.DeleteOrUpdateMethodBinder
-import androidx.room.solver.shortcut.binder.LambdaDeleteOrUpdateMethodBinder
+import androidx.room.solver.shortcut.binder.DeleteOrUpdateFunctionBinder
+import androidx.room.solver.shortcut.binder.LambdaDeleteOrUpdateFunctionBinder
/** Provider for Guava ListenableFuture binders. */
-class GuavaListenableFutureDeleteOrUpdateMethodBinderProvider(val context: Context) :
- DeleteOrUpdateMethodBinderProvider {
+class GuavaListenableFutureDeleteOrUpdateFunctionBinderProvider(val context: Context) :
+ DeleteOrUpdateFunctionBinderProvider {
private val hasGuavaRoom by lazy {
context.processingEnv.getElementsFromPackage(GUAVA_ROOM_MARKER.packageName).isNotEmpty()
@@ -39,7 +39,7 @@
declared.typeArguments.size == 1 &&
declared.rawType.asTypeName() == GuavaUtilConcurrentTypeNames.LISTENABLE_FUTURE
- override fun provide(declared: XType): DeleteOrUpdateMethodBinder {
+ override fun provide(declared: XType): DeleteOrUpdateFunctionBinder {
if (!hasGuavaRoom) {
context.logger.e(ProcessorErrors.MISSING_ROOM_GUAVA_ARTIFACT)
}
@@ -49,7 +49,7 @@
context.logger.e(ProcessorErrors.NONNULL_VOID)
}
- return LambdaDeleteOrUpdateMethodBinder(
+ return LambdaDeleteOrUpdateFunctionBinder(
typeArg = typeArg,
functionName = GUAVA_ROOM_CREATE_LISTENABLE_FUTURE,
adapter = context.typeAdapterStore.findDeleteOrUpdateAdapter(typeArg)
diff --git a/room/room-compiler/src/main/kotlin/androidx/room/solver/shortcut/binderprovider/GuavaListenableFutureInsertOrUpsertMethodBinderProvider.kt b/room/room-compiler/src/main/kotlin/androidx/room/solver/shortcut/binderprovider/GuavaListenableFutureInsertOrUpsertFunctionBinderProvider.kt
similarity index 88%
rename from room/room-compiler/src/main/kotlin/androidx/room/solver/shortcut/binderprovider/GuavaListenableFutureInsertOrUpsertMethodBinderProvider.kt
rename to room/room-compiler/src/main/kotlin/androidx/room/solver/shortcut/binderprovider/GuavaListenableFutureInsertOrUpsertFunctionBinderProvider.kt
index 0153c10..3a67fa9 100644
--- a/room/room-compiler/src/main/kotlin/androidx/room/solver/shortcut/binderprovider/GuavaListenableFutureInsertOrUpsertMethodBinderProvider.kt
+++ b/room/room-compiler/src/main/kotlin/androidx/room/solver/shortcut/binderprovider/GuavaListenableFutureInsertOrUpsertFunctionBinderProvider.kt
@@ -24,13 +24,13 @@
import androidx.room.ext.RoomGuavaTypeNames.GUAVA_ROOM_MARKER
import androidx.room.processor.Context
import androidx.room.processor.ProcessorErrors
-import androidx.room.solver.shortcut.binder.InsertOrUpsertMethodBinder
-import androidx.room.solver.shortcut.binder.LambdaInsertOrUpsertMethodBinder
+import androidx.room.solver.shortcut.binder.InsertOrUpsertFunctionBinder
+import androidx.room.solver.shortcut.binder.LambdaInsertOrUpsertFunctionBinder
import androidx.room.vo.ShortcutQueryParameter
/** Provider for Guava ListenableFuture binders. */
-class GuavaListenableFutureInsertOrUpsertMethodBinderProvider(private val context: Context) :
- InsertOrUpsertMethodBinderProvider {
+class GuavaListenableFutureInsertOrUpsertFunctionBinderProvider(private val context: Context) :
+ InsertOrUpsertFunctionBinderProvider {
private val hasGuavaRoom by lazy {
context.processingEnv.findTypeElement(GUAVA_ROOM_MARKER.canonicalName) != null
@@ -44,7 +44,7 @@
declared: XType,
params: List<ShortcutQueryParameter>,
forUpsert: Boolean
- ): InsertOrUpsertMethodBinder {
+ ): InsertOrUpsertFunctionBinder {
if (!hasGuavaRoom) {
context.logger.e(ProcessorErrors.MISSING_ROOM_GUAVA_ARTIFACT)
}
@@ -54,7 +54,7 @@
context.logger.e(ProcessorErrors.NONNULL_VOID)
}
- return LambdaInsertOrUpsertMethodBinder(
+ return LambdaInsertOrUpsertFunctionBinder(
typeArg = typeArg,
functionName = GUAVA_ROOM_CREATE_LISTENABLE_FUTURE,
adapter =
diff --git a/room/room-compiler/src/main/kotlin/androidx/room/solver/shortcut/binderprovider/InsertOrUpsertMethodBinderProvider.kt b/room/room-compiler/src/main/kotlin/androidx/room/solver/shortcut/binderprovider/InsertOrUpsertFunctionBinderProvider.kt
similarity index 73%
rename from room/room-compiler/src/main/kotlin/androidx/room/solver/shortcut/binderprovider/InsertOrUpsertMethodBinderProvider.kt
rename to room/room-compiler/src/main/kotlin/androidx/room/solver/shortcut/binderprovider/InsertOrUpsertFunctionBinderProvider.kt
index 57e8bba..dac8c97 100644
--- a/room/room-compiler/src/main/kotlin/androidx/room/solver/shortcut/binderprovider/InsertOrUpsertMethodBinderProvider.kt
+++ b/room/room-compiler/src/main/kotlin/androidx/room/solver/shortcut/binderprovider/InsertOrUpsertFunctionBinderProvider.kt
@@ -17,19 +17,21 @@
package androidx.room.solver.shortcut.binderprovider
import androidx.room.compiler.processing.XType
-import androidx.room.solver.shortcut.binder.InsertOrUpsertMethodBinder
+import androidx.room.solver.shortcut.binder.InsertOrUpsertFunctionBinder
import androidx.room.vo.ShortcutQueryParameter
-/** Provider for insert and upsert method binders. */
-interface InsertOrUpsertMethodBinderProvider {
+/** Provider for insert and upsert function binders. */
+interface InsertOrUpsertFunctionBinderProvider {
- /** Check whether the [XType] can be handled by the [InsertOrUpsertMethodBinder] */
+ /** Check whether the [XType] can be handled by the [InsertOrUpsertFunctionBinder] */
fun matches(declared: XType): Boolean
- /** Provider of [InsertOrUpsertMethodBinder], based on the [XType] and the list of parameters */
+ /**
+ * Provider of [InsertOrUpsertFunctionBinder], based on the [XType] and the list of parameters
+ */
fun provide(
declared: XType,
params: List<ShortcutQueryParameter>,
forUpsert: Boolean
- ): InsertOrUpsertMethodBinder
+ ): InsertOrUpsertFunctionBinder
}
diff --git a/room/room-compiler/src/main/kotlin/androidx/room/solver/shortcut/binderprovider/InstantDeleteOrUpdateMethodBinderProvider.kt b/room/room-compiler/src/main/kotlin/androidx/room/solver/shortcut/binderprovider/InstantDeleteOrUpdateFunctionBinderProvider.kt
similarity index 69%
rename from room/room-compiler/src/main/kotlin/androidx/room/solver/shortcut/binderprovider/InstantDeleteOrUpdateMethodBinderProvider.kt
rename to room/room-compiler/src/main/kotlin/androidx/room/solver/shortcut/binderprovider/InstantDeleteOrUpdateFunctionBinderProvider.kt
index 3e8ef08..8abbd94 100644
--- a/room/room-compiler/src/main/kotlin/androidx/room/solver/shortcut/binderprovider/InstantDeleteOrUpdateMethodBinderProvider.kt
+++ b/room/room-compiler/src/main/kotlin/androidx/room/solver/shortcut/binderprovider/InstantDeleteOrUpdateFunctionBinderProvider.kt
@@ -18,17 +18,17 @@
import androidx.room.compiler.processing.XType
import androidx.room.processor.Context
-import androidx.room.solver.shortcut.binder.DeleteOrUpdateMethodBinder
-import androidx.room.solver.shortcut.binder.InstantDeleteOrUpdateMethodBinder
+import androidx.room.solver.shortcut.binder.DeleteOrUpdateFunctionBinder
+import androidx.room.solver.shortcut.binder.InstantDeleteOrUpdateFunctionBinder
-/** Provider for instant (blocking) delete or update method binder */
-class InstantDeleteOrUpdateMethodBinderProvider(private val context: Context) :
- DeleteOrUpdateMethodBinderProvider {
+/** Provider for instant (blocking) delete or update function binder */
+class InstantDeleteOrUpdateFunctionBinderProvider(private val context: Context) :
+ DeleteOrUpdateFunctionBinderProvider {
override fun matches(declared: XType) = true
- override fun provide(declared: XType): DeleteOrUpdateMethodBinder {
+ override fun provide(declared: XType): DeleteOrUpdateFunctionBinder {
val adapter = context.typeAdapterStore.findDeleteOrUpdateAdapter(declared)
- return InstantDeleteOrUpdateMethodBinder(adapter)
+ return InstantDeleteOrUpdateFunctionBinder(adapter)
}
}
diff --git a/room/room-compiler/src/main/kotlin/androidx/room/solver/shortcut/binderprovider/InstantInsertOrUpsertMethodBinder.kt b/room/room-compiler/src/main/kotlin/androidx/room/solver/shortcut/binderprovider/InstantInsertOrUpsertFunctionBinder.kt
similarity index 77%
rename from room/room-compiler/src/main/kotlin/androidx/room/solver/shortcut/binderprovider/InstantInsertOrUpsertMethodBinder.kt
rename to room/room-compiler/src/main/kotlin/androidx/room/solver/shortcut/binderprovider/InstantInsertOrUpsertFunctionBinder.kt
index e902119..99fcd51 100644
--- a/room/room-compiler/src/main/kotlin/androidx/room/solver/shortcut/binderprovider/InstantInsertOrUpsertMethodBinder.kt
+++ b/room/room-compiler/src/main/kotlin/androidx/room/solver/shortcut/binderprovider/InstantInsertOrUpsertFunctionBinder.kt
@@ -18,13 +18,13 @@
import androidx.room.compiler.processing.XType
import androidx.room.processor.Context
-import androidx.room.solver.shortcut.binder.InsertOrUpsertMethodBinder
-import androidx.room.solver.shortcut.binder.InstantInsertOrUpsertMethodBinder
+import androidx.room.solver.shortcut.binder.InsertOrUpsertFunctionBinder
+import androidx.room.solver.shortcut.binder.InstantInsertOrUpsertFunctionBinder
import androidx.room.vo.ShortcutQueryParameter
-/** Provider for instant (blocking) insert or upsert method binder. */
-class InstantInsertOrUpsertMethodBinderProvider(private val context: Context) :
- InsertOrUpsertMethodBinderProvider {
+/** Provider for instant (blocking) insert or upsert function binders. */
+class InstantInsertOrUpsertFunctionBinderProvider(private val context: Context) :
+ InsertOrUpsertFunctionBinderProvider {
override fun matches(declared: XType) = true
@@ -32,8 +32,8 @@
declared: XType,
params: List<ShortcutQueryParameter>,
forUpsert: Boolean
- ): InsertOrUpsertMethodBinder {
- return InstantInsertOrUpsertMethodBinder(
+ ): InsertOrUpsertFunctionBinder {
+ return InstantInsertOrUpsertFunctionBinder(
if (forUpsert) {
context.typeAdapterStore.findUpsertAdapter(declared, params)
} else {
diff --git a/room/room-compiler/src/main/kotlin/androidx/room/solver/shortcut/binderprovider/RxCallableDeleteOrUpdateMethodBinderProvider.kt b/room/room-compiler/src/main/kotlin/androidx/room/solver/shortcut/binderprovider/RxCallableDeleteOrUpdateFunctionBinderProvider.kt
similarity index 70%
rename from room/room-compiler/src/main/kotlin/androidx/room/solver/shortcut/binderprovider/RxCallableDeleteOrUpdateMethodBinderProvider.kt
rename to room/room-compiler/src/main/kotlin/androidx/room/solver/shortcut/binderprovider/RxCallableDeleteOrUpdateFunctionBinderProvider.kt
index 535e608..d152405 100644
--- a/room/room-compiler/src/main/kotlin/androidx/room/solver/shortcut/binderprovider/RxCallableDeleteOrUpdateMethodBinderProvider.kt
+++ b/room/room-compiler/src/main/kotlin/androidx/room/solver/shortcut/binderprovider/RxCallableDeleteOrUpdateFunctionBinderProvider.kt
@@ -21,13 +21,13 @@
import androidx.room.ext.KotlinTypeNames
import androidx.room.processor.Context
import androidx.room.solver.RxType
-import androidx.room.solver.shortcut.binder.DeleteOrUpdateMethodBinder
-import androidx.room.solver.shortcut.binder.LambdaDeleteOrUpdateMethodBinder
+import androidx.room.solver.shortcut.binder.DeleteOrUpdateFunctionBinder
+import androidx.room.solver.shortcut.binder.LambdaDeleteOrUpdateFunctionBinder
/** Provider for Rx Callable binders. */
-open class RxCallableDeleteOrUpdateMethodBinderProvider
+open class RxCallableDeleteOrUpdateFunctionBinderProvider
internal constructor(val context: Context, private val rxType: RxType) :
- DeleteOrUpdateMethodBinderProvider {
+ DeleteOrUpdateFunctionBinderProvider {
/**
* [Single] and [Maybe] are generics but [Completable] is not so each implementation of this
@@ -42,10 +42,10 @@
return declared.rawType.asTypeName() == rxType.className
}
- override fun provide(declared: XType): DeleteOrUpdateMethodBinder {
+ override fun provide(declared: XType): DeleteOrUpdateFunctionBinder {
val typeArg = extractTypeArg(declared)
val adapter = context.typeAdapterStore.findDeleteOrUpdateAdapter(typeArg)
- return LambdaDeleteOrUpdateMethodBinder(
+ return LambdaDeleteOrUpdateFunctionBinder(
typeArg = typeArg,
functionName = rxType.factoryMethodName,
adapter = adapter
@@ -55,18 +55,18 @@
companion object {
fun getAll(context: Context) =
listOf(
- RxSingleOrMaybeDeleteOrUpdateMethodBinderProvider(context, RxType.RX2_SINGLE),
- RxSingleOrMaybeDeleteOrUpdateMethodBinderProvider(context, RxType.RX2_MAYBE),
- RxCompletableDeleteOrUpdateMethodBinderProvider(context, RxType.RX2_COMPLETABLE),
- RxSingleOrMaybeDeleteOrUpdateMethodBinderProvider(context, RxType.RX3_SINGLE),
- RxSingleOrMaybeDeleteOrUpdateMethodBinderProvider(context, RxType.RX3_MAYBE),
- RxCompletableDeleteOrUpdateMethodBinderProvider(context, RxType.RX3_COMPLETABLE)
+ RxSingleOrMaybeDeleteOrUpdateFunctionBinderProvider(context, RxType.RX2_SINGLE),
+ RxSingleOrMaybeDeleteOrUpdateFunctionBinderProvider(context, RxType.RX2_MAYBE),
+ RxCompletableDeleteOrUpdateFunctionBinderProvider(context, RxType.RX2_COMPLETABLE),
+ RxSingleOrMaybeDeleteOrUpdateFunctionBinderProvider(context, RxType.RX3_SINGLE),
+ RxSingleOrMaybeDeleteOrUpdateFunctionBinderProvider(context, RxType.RX3_MAYBE),
+ RxCompletableDeleteOrUpdateFunctionBinderProvider(context, RxType.RX3_COMPLETABLE)
)
}
}
-private class RxCompletableDeleteOrUpdateMethodBinderProvider(context: Context, rxType: RxType) :
- RxCallableDeleteOrUpdateMethodBinderProvider(context, rxType) {
+private class RxCompletableDeleteOrUpdateFunctionBinderProvider(context: Context, rxType: RxType) :
+ RxCallableDeleteOrUpdateFunctionBinderProvider(context, rxType) {
private val completableType: XRawType? by lazy {
context.processingEnv.findType(rxType.className.canonicalName)?.rawType
@@ -87,8 +87,10 @@
}
}
-private class RxSingleOrMaybeDeleteOrUpdateMethodBinderProvider(context: Context, rxType: RxType) :
- RxCallableDeleteOrUpdateMethodBinderProvider(context, rxType) {
+private class RxSingleOrMaybeDeleteOrUpdateFunctionBinderProvider(
+ context: Context,
+ rxType: RxType
+) : RxCallableDeleteOrUpdateFunctionBinderProvider(context, rxType) {
/** Since Maybe can have null values, the lambda returned must allow for null values. */
override fun extractTypeArg(declared: XType): XType =
diff --git a/room/room-compiler/src/main/kotlin/androidx/room/solver/shortcut/binderprovider/RxCallableInsertOrUpsertMethodBinderProvider.kt b/room/room-compiler/src/main/kotlin/androidx/room/solver/shortcut/binderprovider/RxCallableInsertOrUpsertFunctionBinderProvider.kt
similarity index 73%
rename from room/room-compiler/src/main/kotlin/androidx/room/solver/shortcut/binderprovider/RxCallableInsertOrUpsertMethodBinderProvider.kt
rename to room/room-compiler/src/main/kotlin/androidx/room/solver/shortcut/binderprovider/RxCallableInsertOrUpsertFunctionBinderProvider.kt
index 9b0223d..ef89ede 100644
--- a/room/room-compiler/src/main/kotlin/androidx/room/solver/shortcut/binderprovider/RxCallableInsertOrUpsertMethodBinderProvider.kt
+++ b/room/room-compiler/src/main/kotlin/androidx/room/solver/shortcut/binderprovider/RxCallableInsertOrUpsertFunctionBinderProvider.kt
@@ -21,14 +21,14 @@
import androidx.room.ext.KotlinTypeNames
import androidx.room.processor.Context
import androidx.room.solver.RxType
-import androidx.room.solver.shortcut.binder.InsertOrUpsertMethodBinder
-import androidx.room.solver.shortcut.binder.LambdaInsertOrUpsertMethodBinder
+import androidx.room.solver.shortcut.binder.InsertOrUpsertFunctionBinder
+import androidx.room.solver.shortcut.binder.LambdaInsertOrUpsertFunctionBinder
import androidx.room.vo.ShortcutQueryParameter
/** Provider for Rx Callable binders. */
-open class RxCallableInsertOrUpsertMethodBinderProvider
+open class RxCallableInsertOrUpsertFunctionBinderProvider
internal constructor(val context: Context, private val rxType: RxType) :
- InsertOrUpsertMethodBinderProvider {
+ InsertOrUpsertFunctionBinderProvider {
/**
* [Single] and [Maybe] are generics but [Completable] is not so each implementation of this
@@ -47,7 +47,7 @@
declared: XType,
params: List<ShortcutQueryParameter>,
forUpsert: Boolean
- ): InsertOrUpsertMethodBinder {
+ ): InsertOrUpsertFunctionBinder {
val typeArg = extractTypeArg(declared)
val adapter =
if (forUpsert) {
@@ -55,7 +55,7 @@
} else {
context.typeAdapterStore.findInsertAdapter(typeArg, params)
}
- return LambdaInsertOrUpsertMethodBinder(
+ return LambdaInsertOrUpsertFunctionBinder(
typeArg = typeArg,
functionName = rxType.factoryMethodName,
adapter = adapter
@@ -65,18 +65,18 @@
companion object {
fun getAll(context: Context) =
listOf(
- RxSingleOrMaybeInsertOrUpsertMethodBinderProvider(context, RxType.RX2_SINGLE),
- RxSingleOrMaybeInsertOrUpsertMethodBinderProvider(context, RxType.RX2_MAYBE),
- RxCompletableInsertOrUpsertMethodBinderProvider(context, RxType.RX2_COMPLETABLE),
- RxSingleOrMaybeInsertOrUpsertMethodBinderProvider(context, RxType.RX3_SINGLE),
- RxSingleOrMaybeInsertOrUpsertMethodBinderProvider(context, RxType.RX3_MAYBE),
- RxCompletableInsertOrUpsertMethodBinderProvider(context, RxType.RX3_COMPLETABLE)
+ RxSingleOrMaybeInsertOrUpsertFunctionBinderProvider(context, RxType.RX2_SINGLE),
+ RxSingleOrMaybeInsertOrUpsertFunctionBinderProvider(context, RxType.RX2_MAYBE),
+ RxCompletableInsertOrUpsertFunctionBinderProvider(context, RxType.RX2_COMPLETABLE),
+ RxSingleOrMaybeInsertOrUpsertFunctionBinderProvider(context, RxType.RX3_SINGLE),
+ RxSingleOrMaybeInsertOrUpsertFunctionBinderProvider(context, RxType.RX3_MAYBE),
+ RxCompletableInsertOrUpsertFunctionBinderProvider(context, RxType.RX3_COMPLETABLE)
)
}
}
-private class RxCompletableInsertOrUpsertMethodBinderProvider(context: Context, rxType: RxType) :
- RxCallableInsertOrUpsertMethodBinderProvider(context, rxType) {
+private class RxCompletableInsertOrUpsertFunctionBinderProvider(context: Context, rxType: RxType) :
+ RxCallableInsertOrUpsertFunctionBinderProvider(context, rxType) {
private val completableType: XRawType? by lazy {
context.processingEnv.findType(rxType.className.canonicalName)?.rawType
@@ -97,8 +97,10 @@
}
}
-private class RxSingleOrMaybeInsertOrUpsertMethodBinderProvider(context: Context, rxType: RxType) :
- RxCallableInsertOrUpsertMethodBinderProvider(context, rxType) {
+private class RxSingleOrMaybeInsertOrUpsertFunctionBinderProvider(
+ context: Context,
+ rxType: RxType
+) : RxCallableInsertOrUpsertFunctionBinderProvider(context, rxType) {
/** Since Maybe can have null values, the lambda returned must allow for null values. */
override fun extractTypeArg(declared: XType): XType =
diff --git a/room/room-compiler/src/main/kotlin/androidx/room/solver/shortcut/result/DeleteOrUpdateMethodAdapter.kt b/room/room-compiler/src/main/kotlin/androidx/room/solver/shortcut/result/DeleteOrUpdateFunctionAdapter.kt
similarity index 90%
rename from room/room-compiler/src/main/kotlin/androidx/room/solver/shortcut/result/DeleteOrUpdateMethodAdapter.kt
rename to room/room-compiler/src/main/kotlin/androidx/room/solver/shortcut/result/DeleteOrUpdateFunctionAdapter.kt
index 512d877..e89ebbd 100644
--- a/room/room-compiler/src/main/kotlin/androidx/room/solver/shortcut/result/DeleteOrUpdateMethodAdapter.kt
+++ b/room/room-compiler/src/main/kotlin/androidx/room/solver/shortcut/result/DeleteOrUpdateFunctionAdapter.kt
@@ -32,12 +32,12 @@
import androidx.room.solver.CodeGenScope
import androidx.room.vo.ShortcutQueryParameter
-/** Class that knows how to generate a delete or update method body. */
-class DeleteOrUpdateMethodAdapter private constructor(val returnType: XType) {
+/** Class that knows how to generate a delete or update function body. */
+class DeleteOrUpdateFunctionAdapter private constructor(val returnType: XType) {
companion object {
- fun create(returnType: XType): DeleteOrUpdateMethodAdapter? {
+ fun create(returnType: XType): DeleteOrUpdateFunctionAdapter? {
if (isDeleteOrUpdateValid(returnType)) {
- return DeleteOrUpdateMethodAdapter(returnType)
+ return DeleteOrUpdateFunctionAdapter(returnType)
}
return null
}
@@ -50,7 +50,7 @@
}
}
- fun generateMethodBody(
+ fun generateFunctionBody(
scope: CodeGenScope,
parameters: List<ShortcutQueryParameter>,
adapters: Map<String, Pair<XPropertySpec, Any>>,
@@ -81,7 +81,7 @@
"%L%L.%L(%L, %L)",
if (resultVar == null) "" else "$resultVar += ",
adapter.name,
- param.handleMethodName,
+ param.handleFunctionName,
connectionVar,
param.name
)
diff --git a/room/room-compiler/src/main/kotlin/androidx/room/solver/shortcut/result/InsertOrUpsertMethodAdapter.kt b/room/room-compiler/src/main/kotlin/androidx/room/solver/shortcut/result/InsertOrUpsertFunctionAdapter.kt
similarity index 83%
rename from room/room-compiler/src/main/kotlin/androidx/room/solver/shortcut/result/InsertOrUpsertMethodAdapter.kt
rename to room/room-compiler/src/main/kotlin/androidx/room/solver/shortcut/result/InsertOrUpsertFunctionAdapter.kt
index c6b9dbd..22d0950e 100644
--- a/room/room-compiler/src/main/kotlin/androidx/room/solver/shortcut/result/InsertOrUpsertMethodAdapter.kt
+++ b/room/room-compiler/src/main/kotlin/androidx/room/solver/shortcut/result/InsertOrUpsertFunctionAdapter.kt
@@ -37,20 +37,20 @@
import androidx.room.solver.CodeGenScope
import androidx.room.vo.ShortcutQueryParameter
-class InsertOrUpsertMethodAdapter private constructor(private val methodInfo: MethodInfo) {
- internal val returnType = methodInfo.returnType
+class InsertOrUpsertFunctionAdapter private constructor(private val functionInfo: FunctionInfo) {
+ internal val returnType = functionInfo.returnType
companion object {
fun createInsert(
context: Context,
returnType: XType,
params: List<ShortcutQueryParameter>
- ): InsertOrUpsertMethodAdapter? {
- return createMethod(
+ ): InsertOrUpsertFunctionAdapter? {
+ return createFunction(
context = context,
returnType = returnType,
params = params,
- methodInfoClass = ::InsertMethodInfo,
+ functionInfoClass = ::InsertFunctionInfo,
multiParamSingleReturnError =
ProcessorErrors.INSERT_MULTI_PARAM_SINGLE_RETURN_MISMATCH,
singleParamMultiReturnError =
@@ -62,12 +62,12 @@
context: Context,
returnType: XType,
params: List<ShortcutQueryParameter>
- ): InsertOrUpsertMethodAdapter? {
- return createMethod(
+ ): InsertOrUpsertFunctionAdapter? {
+ return createFunction(
context = context,
returnType = returnType,
params = params,
- methodInfoClass = ::UpsertMethodInfo,
+ functionInfoClass = ::UpsertFunctionInfo,
multiParamSingleReturnError =
ProcessorErrors.UPSERT_MULTI_PARAM_SINGLE_RETURN_MISMATCH,
singleParamMultiReturnError =
@@ -75,27 +75,27 @@
)
}
- private fun createMethod(
+ private fun createFunction(
context: Context,
returnType: XType,
params: List<ShortcutQueryParameter>,
- methodInfoClass: (returnInfo: ReturnInfo, returnType: XType) -> MethodInfo,
+ functionInfoClass: (returnInfo: ReturnInfo, returnType: XType) -> FunctionInfo,
multiParamSingleReturnError: String,
singleParamMultiReturnError: String
- ): InsertOrUpsertMethodAdapter? {
- val methodReturnType = getReturnType(returnType)
+ ): InsertOrUpsertFunctionAdapter? {
+ val functionReturnType = getReturnType(returnType)
if (
- methodReturnType != null &&
+ functionReturnType != null &&
isReturnValid(
context,
- methodReturnType,
+ functionReturnType,
params,
multiParamSingleReturnError,
singleParamMultiReturnError
)
) {
- val methodInfo = methodInfoClass(methodReturnType, returnType)
- return InsertOrUpsertMethodAdapter(methodInfo = methodInfo)
+ val functionInfo = functionInfoClass(functionReturnType, returnType)
+ return InsertOrUpsertFunctionAdapter(functionInfo = functionInfo)
}
return null
}
@@ -175,7 +175,7 @@
}
}
- fun generateMethodBody(
+ fun generateFunctionBody(
scope: CodeGenScope,
connectionVar: String,
parameters: List<ShortcutQueryParameter>,
@@ -198,19 +198,19 @@
XCodeBlock.of(
"%L.%L(%L, %L)",
upsertAdapter.name,
- methodInfo.methodName,
+ functionInfo.functionName,
connectionVar,
param.name
)
.let {
if (
scope.language == CodeLanguage.KOTLIN &&
- methodInfo.returnInfo == ReturnInfo.ID_ARRAY_BOX &&
- methodInfo.returnType.asTypeName() ==
- methodInfo.returnInfo.typeName
+ functionInfo.returnInfo == ReturnInfo.ID_ARRAY_BOX &&
+ functionInfo.returnType.asTypeName() ==
+ functionInfo.returnInfo.typeName
) {
XCodeBlock.ofCast(
- typeName = methodInfo.returnInfo.typeName,
+ typeName = functionInfo.returnInfo.typeName,
expressionBlock = it
)
} else {
@@ -219,7 +219,7 @@
}
when (scope.language) {
CodeLanguage.JAVA -> {
- when (methodInfo.returnInfo) {
+ when (functionInfo.returnInfo) {
ReturnInfo.VOID,
ReturnInfo.VOID_OBJECT -> {
if (param == parameters.last()) {
@@ -262,21 +262,21 @@
}
}
- sealed class MethodInfo(val returnInfo: ReturnInfo, val returnType: XType) {
- abstract val methodName: String
+ sealed class FunctionInfo(val returnInfo: ReturnInfo, val returnType: XType) {
+ abstract val functionName: String
}
- class InsertMethodInfo(returnInfo: ReturnInfo, returnType: XType) :
- MethodInfo(returnInfo, returnType) {
- override val methodName: String = "insert${returnInfo.methodSuffix}"
+ class InsertFunctionInfo(returnInfo: ReturnInfo, returnType: XType) :
+ FunctionInfo(returnInfo, returnType) {
+ override val functionName: String = "insert${returnInfo.functionSuffix}"
}
- class UpsertMethodInfo(returnInfo: ReturnInfo, returnType: XType) :
- MethodInfo(returnInfo, returnType) {
- override val methodName: String = "upsert${returnInfo.methodSuffix}"
+ class UpsertFunctionInfo(returnInfo: ReturnInfo, returnType: XType) :
+ FunctionInfo(returnInfo, returnType) {
+ override val functionName: String = "upsert${returnInfo.functionSuffix}"
}
- enum class ReturnInfo(val methodSuffix: String, val typeName: XTypeName) {
+ enum class ReturnInfo(val functionSuffix: String, val typeName: XTypeName) {
VOID("", XTypeName.UNIT_VOID), // return void
VOID_OBJECT("", CommonTypeNames.VOID), // return Void
UNIT("", XTypeName.UNIT_VOID), // return kotlin.Unit.INSTANCE
diff --git a/room/room-compiler/src/main/kotlin/androidx/room/solver/transaction/binder/CoroutineTransactionMethodBinder.kt b/room/room-compiler/src/main/kotlin/androidx/room/solver/transaction/binder/CoroutineTransactionFunctionBinder.kt
similarity index 94%
rename from room/room-compiler/src/main/kotlin/androidx/room/solver/transaction/binder/CoroutineTransactionMethodBinder.kt
rename to room/room-compiler/src/main/kotlin/androidx/room/solver/transaction/binder/CoroutineTransactionFunctionBinder.kt
index f1ae556..b999825 100644
--- a/room/room-compiler/src/main/kotlin/androidx/room/solver/transaction/binder/CoroutineTransactionMethodBinder.kt
+++ b/room/room-compiler/src/main/kotlin/androidx/room/solver/transaction/binder/CoroutineTransactionFunctionBinder.kt
@@ -27,14 +27,14 @@
import androidx.room.ext.LambdaSpec
import androidx.room.ext.RoomMemberNames.DB_UTIL_PERFORM_IN_TRANSACTION_SUSPENDING
import androidx.room.solver.CodeGenScope
-import androidx.room.solver.transaction.result.TransactionMethodAdapter
+import androidx.room.solver.transaction.result.TransactionFunctionAdapter
/** Binder that knows how to write suspending transaction wrapper methods. */
-class CoroutineTransactionMethodBinder(
+class CoroutineTransactionFunctionBinder(
private val returnType: XType,
- adapter: TransactionMethodAdapter,
+ adapter: TransactionFunctionAdapter,
private val continuationParamName: String
-) : TransactionMethodBinder(adapter) {
+) : TransactionFunctionBinder(adapter) {
override fun executeAndReturn(
parameterNames: List<String>,
daoName: XClassName,
diff --git a/room/room-compiler/src/main/kotlin/androidx/room/solver/transaction/binder/InstantTransactionMethodBinder.kt b/room/room-compiler/src/main/kotlin/androidx/room/solver/transaction/binder/InstantTransactionFunctionBinder.kt
similarity index 95%
rename from room/room-compiler/src/main/kotlin/androidx/room/solver/transaction/binder/InstantTransactionMethodBinder.kt
rename to room/room-compiler/src/main/kotlin/androidx/room/solver/transaction/binder/InstantTransactionFunctionBinder.kt
index e2e6208..ff0b66e 100644
--- a/room/room-compiler/src/main/kotlin/androidx/room/solver/transaction/binder/InstantTransactionMethodBinder.kt
+++ b/room/room-compiler/src/main/kotlin/androidx/room/solver/transaction/binder/InstantTransactionFunctionBinder.kt
@@ -30,13 +30,13 @@
import androidx.room.ext.RoomMemberNames.DB_UTIL_PERFORM_BLOCKING
import androidx.room.ext.SQLiteDriverTypeNames
import androidx.room.solver.CodeGenScope
-import androidx.room.solver.transaction.result.TransactionMethodAdapter
+import androidx.room.solver.transaction.result.TransactionFunctionAdapter
/** Binder that knows how to write instant (blocking) transaction wrapper methods. */
-class InstantTransactionMethodBinder(
+class InstantTransactionFunctionBinder(
private val returnType: XType,
- adapter: TransactionMethodAdapter,
-) : TransactionMethodBinder(adapter) {
+ adapter: TransactionFunctionAdapter,
+) : TransactionFunctionBinder(adapter) {
override fun executeAndReturn(
parameterNames: List<String>,
daoName: XClassName,
diff --git a/room/room-compiler/src/main/kotlin/androidx/room/solver/transaction/binder/TransactionMethodBinder.kt b/room/room-compiler/src/main/kotlin/androidx/room/solver/transaction/binder/TransactionFunctionBinder.kt
similarity index 65%
rename from room/room-compiler/src/main/kotlin/androidx/room/solver/transaction/binder/TransactionMethodBinder.kt
rename to room/room-compiler/src/main/kotlin/androidx/room/solver/transaction/binder/TransactionFunctionBinder.kt
index 6665400..7705da5 100644
--- a/room/room-compiler/src/main/kotlin/androidx/room/solver/transaction/binder/TransactionMethodBinder.kt
+++ b/room/room-compiler/src/main/kotlin/androidx/room/solver/transaction/binder/TransactionFunctionBinder.kt
@@ -19,20 +19,20 @@
import androidx.room.compiler.codegen.XClassName
import androidx.room.compiler.codegen.XPropertySpec
import androidx.room.solver.CodeGenScope
-import androidx.room.solver.transaction.result.TransactionMethodAdapter
+import androidx.room.solver.transaction.result.TransactionFunctionAdapter
/**
- * Connects a transaction method, database and a [TransactionMethodAdapter].
+ * Connects a transaction function, database and a [TransactionFunctionAdapter].
*
- * The default implementation is [InstantTransactionMethodBinder] that executes the transaction
+ * The default implementation is [InstantTransactionFunctionBinder] that executes the transaction
* synchronously. Other deferred transactions are unsupported expect for coroutines, for such
- * binding then [CoroutineTransactionMethodBinder] is used.
+ * binding then [CoroutineTransactionFunctionBinder] is used.
*/
-abstract class TransactionMethodBinder(val adapter: TransactionMethodAdapter) {
+abstract class TransactionFunctionBinder(val adapter: TransactionFunctionAdapter) {
/**
- * Receives the method's return type, parameters along with the Dao class names to generate the
- * transaction wrapper body that delegates to the non-abstract or default dao method.
+ * Receives the function's return type, parameters along with the Dao class names to generate
+ * the transaction wrapper body that delegates to the non-abstract or default dao function.
*/
abstract fun executeAndReturn(
parameterNames: List<String>,
diff --git a/room/room-compiler/src/main/kotlin/androidx/room/solver/transaction/result/TransactionMethodAdapter.kt b/room/room-compiler/src/main/kotlin/androidx/room/solver/transaction/result/TransactionFunctionAdapter.kt
similarity index 83%
rename from room/room-compiler/src/main/kotlin/androidx/room/solver/transaction/result/TransactionMethodAdapter.kt
rename to room/room-compiler/src/main/kotlin/androidx/room/solver/transaction/result/TransactionFunctionAdapter.kt
index 3811e48..8ccbca2 100644
--- a/room/room-compiler/src/main/kotlin/androidx/room/solver/transaction/result/TransactionMethodAdapter.kt
+++ b/room/room-compiler/src/main/kotlin/androidx/room/solver/transaction/result/TransactionFunctionAdapter.kt
@@ -21,16 +21,16 @@
import androidx.room.compiler.codegen.XCodeBlock
import androidx.room.ext.DEFAULT_IMPLS_CLASS_NAME
import androidx.room.solver.CodeGenScope
-import androidx.room.vo.TransactionMethod
+import androidx.room.vo.TransactionFunction
/**
- * Class that knows how to generate the transaction method delegate code. Callers should take care
+ * Class that knows how to generate the transaction function delegate code. Callers should take care
* of using the invocation code in a statement or in another block (such as a lambda).
*/
-class TransactionMethodAdapter(
- private val methodName: String,
+class TransactionFunctionAdapter(
+ private val functionName: String,
private val jvmMethodName: String,
- private val callType: TransactionMethod.CallType
+ private val callType: TransactionFunction.CallType
) {
fun createDelegateToSuperCode(
parameterNames: List<String>,
@@ -51,7 +51,7 @@
if (
scope.language == CodeLanguage.JAVA &&
- callType == TransactionMethod.CallType.DEFAULT_KOTLIN &&
+ callType == TransactionFunction.CallType.DEFAULT_KOTLIN &&
parameterNames.isNotEmpty()
) {
// An invoke to DefaultImpls has an extra 1st param so we need a comma if there
@@ -76,13 +76,13 @@
daoImplName: XClassName,
): XCodeBlock =
when (callType) {
- TransactionMethod.CallType.CONCRETE -> {
+ TransactionFunction.CallType.CONCRETE -> {
XCodeBlock.of("%T.super.%N(", daoImplName, jvmMethodName)
}
- TransactionMethod.CallType.DEFAULT_JAVA8 -> {
+ TransactionFunction.CallType.DEFAULT_JAVA8 -> {
XCodeBlock.of("%T.super.%N(", daoName, jvmMethodName)
}
- TransactionMethod.CallType.DEFAULT_KOTLIN -> {
+ TransactionFunction.CallType.DEFAULT_KOTLIN -> {
XCodeBlock.of(
"%T.%N.%N(%T.this",
daoName,
@@ -95,5 +95,5 @@
private fun CodeGenScope.getKotlinInvokeExpr(
daoImplName: XClassName,
- ): XCodeBlock = XCodeBlock.of("super@%T.%N(", daoImplName, methodName)
+ ): XCodeBlock = XCodeBlock.of("super@%T.%N(", daoImplName, functionName)
}
diff --git a/room/room-compiler/src/main/kotlin/androidx/room/vo/Dao.kt b/room/room-compiler/src/main/kotlin/androidx/room/vo/Dao.kt
index 0f0d8b6..e24f25b 100644
--- a/room/room-compiler/src/main/kotlin/androidx/room/vo/Dao.kt
+++ b/room/room-compiler/src/main/kotlin/androidx/room/vo/Dao.kt
@@ -24,15 +24,15 @@
data class Dao(
val element: XTypeElement,
val type: XType,
- val queryMethods: List<QueryMethod>,
- val rawQueryMethods: List<RawQueryMethod>,
- val insertMethods: List<InsertMethod>,
- val deleteMethods: List<DeleteMethod>,
- val updateMethods: List<UpdateMethod>,
- val upsertMethods: List<UpsertMethod>,
- val transactionMethods: List<TransactionMethod>,
- val kotlinBoxedPrimitiveMethodDelegates: List<KotlinBoxedPrimitiveMethodDelegate>,
- val kotlinDefaultMethodDelegates: List<KotlinDefaultMethodDelegate>,
+ val queryFunctions: List<QueryFunction>,
+ val rawQueryFunctions: List<RawQueryFunction>,
+ val insertFunctions: List<InsertFunction>,
+ val deleteFunctions: List<DeleteFunction>,
+ val updateFunctions: List<UpdateFunction>,
+ val upsertFunctions: List<UpsertFunction>,
+ val transactionFunctions: List<TransactionFunction>,
+ val kotlinBoxedPrimitiveFunctionDelegates: List<KotlinBoxedPrimitiveFunctionDelegate>,
+ val kotlinDefaultFunctionDelegates: List<KotlinDefaultFunctionDelegate>,
val constructorParamType: XTypeName?
) {
// parsed dao might have a suffix if it is used in multiple databases.
@@ -46,12 +46,12 @@
val typeName: XClassName by lazy { element.asClassName() }
- val deleteOrUpdateShortcutMethods: List<DeleteOrUpdateShortcutMethod> by lazy {
- deleteMethods + updateMethods
+ val mDeleteOrUpdateShortcutFunctions: List<DeleteOrUpdateShortcutFunction> by lazy {
+ deleteFunctions + updateFunctions
}
- val insertOrUpsertShortcutMethods: List<InsertOrUpsertShortcutMethod> by lazy {
- insertMethods + upsertMethods
+ val mInsertOrUpsertShortcutFunctions: List<InsertOrUpsertShortcutFunction> by lazy {
+ insertFunctions + upsertFunctions
}
val implTypeName: XClassName by lazy {
diff --git a/room/room-compiler/src/main/kotlin/androidx/room/vo/DaoMethod.kt b/room/room-compiler/src/main/kotlin/androidx/room/vo/DaoFunction.kt
similarity index 85%
rename from room/room-compiler/src/main/kotlin/androidx/room/vo/DaoMethod.kt
rename to room/room-compiler/src/main/kotlin/androidx/room/vo/DaoFunction.kt
index 32fab37..a3bbbd2 100644
--- a/room/room-compiler/src/main/kotlin/androidx/room/vo/DaoMethod.kt
+++ b/room/room-compiler/src/main/kotlin/androidx/room/vo/DaoFunction.kt
@@ -18,7 +18,7 @@
import androidx.room.compiler.processing.XMethodElement
-/** References a method that returns a dao in a Database */
-data class DaoMethod(val element: XMethodElement, val dao: Dao) {
+/** References a function that returns a dao in a Database */
+data class DaoFunction(val element: XMethodElement, val dao: Dao) {
val isProperty = element.isKotlinPropertyMethod()
}
diff --git a/room/room-compiler/src/main/kotlin/androidx/room/vo/DataClassMethod.kt b/room/room-compiler/src/main/kotlin/androidx/room/vo/DataClassFunction.kt
similarity index 96%
rename from room/room-compiler/src/main/kotlin/androidx/room/vo/DataClassMethod.kt
rename to room/room-compiler/src/main/kotlin/androidx/room/vo/DataClassFunction.kt
index b8d948d..153b1d1 100644
--- a/room/room-compiler/src/main/kotlin/androidx/room/vo/DataClassMethod.kt
+++ b/room/room-compiler/src/main/kotlin/androidx/room/vo/DataClassFunction.kt
@@ -20,7 +20,7 @@
import androidx.room.compiler.processing.XMethodType
/** An executable element processed as member of a class (data class or entity) */
-class DataClassMethod(
+class DataClassFunction(
val element: XMethodElement,
val resolvedType: XMethodType,
)
diff --git a/room/room-compiler/src/main/kotlin/androidx/room/vo/Database.kt b/room/room-compiler/src/main/kotlin/androidx/room/vo/Database.kt
index 15f95d4..02efebf 100644
--- a/room/room-compiler/src/main/kotlin/androidx/room/vo/Database.kt
+++ b/room/room-compiler/src/main/kotlin/androidx/room/vo/Database.kt
@@ -35,7 +35,7 @@
val type: XType,
val entities: List<Entity>,
val views: List<DatabaseView>,
- val daoMethods: List<DaoMethod>,
+ val daoFunctions: List<DaoFunction>,
val version: Int,
val exportSchema: Boolean,
val enableForeignKeys: Boolean,
diff --git a/room/room-compiler/src/main/kotlin/androidx/room/vo/DeleteMethod.kt b/room/room-compiler/src/main/kotlin/androidx/room/vo/DeleteFunction.kt
similarity index 78%
rename from room/room-compiler/src/main/kotlin/androidx/room/vo/DeleteMethod.kt
rename to room/room-compiler/src/main/kotlin/androidx/room/vo/DeleteFunction.kt
index 7e69f5f..016e9b4 100644
--- a/room/room-compiler/src/main/kotlin/androidx/room/vo/DeleteMethod.kt
+++ b/room/room-compiler/src/main/kotlin/androidx/room/vo/DeleteFunction.kt
@@ -16,11 +16,11 @@
package androidx.room.vo
import androidx.room.compiler.processing.XMethodElement
-import androidx.room.solver.shortcut.binder.DeleteOrUpdateMethodBinder
+import androidx.room.solver.shortcut.binder.DeleteOrUpdateFunctionBinder
-class DeleteMethod(
+class DeleteFunction(
element: XMethodElement,
entities: Map<String, ShortcutEntity>,
parameters: List<ShortcutQueryParameter>,
- methodBinder: DeleteOrUpdateMethodBinder?
-) : DeleteOrUpdateShortcutMethod(element, entities, parameters, methodBinder)
+ functionBinder: DeleteOrUpdateFunctionBinder?
+) : DeleteOrUpdateShortcutFunction(element, entities, parameters, functionBinder)
diff --git a/room/room-compiler/src/main/kotlin/androidx/room/vo/DeleteOrUpdateShortcutMethod.kt b/room/room-compiler/src/main/kotlin/androidx/room/vo/DeleteOrUpdateShortcutFunction.kt
similarity index 78%
rename from room/room-compiler/src/main/kotlin/androidx/room/vo/DeleteOrUpdateShortcutMethod.kt
rename to room/room-compiler/src/main/kotlin/androidx/room/vo/DeleteOrUpdateShortcutFunction.kt
index ce477a6..4de4de6e 100644
--- a/room/room-compiler/src/main/kotlin/androidx/room/vo/DeleteOrUpdateShortcutMethod.kt
+++ b/room/room-compiler/src/main/kotlin/androidx/room/vo/DeleteOrUpdateShortcutFunction.kt
@@ -17,12 +17,12 @@
package androidx.room.vo
import androidx.room.compiler.processing.XMethodElement
-import androidx.room.solver.shortcut.binder.DeleteOrUpdateMethodBinder
+import androidx.room.solver.shortcut.binder.DeleteOrUpdateFunctionBinder
-/** Base class for shortcut methods in @DAO. */
-abstract class DeleteOrUpdateShortcutMethod(
+/** Base class for shortcut functions in @DAO. */
+abstract class DeleteOrUpdateShortcutFunction(
val element: XMethodElement,
val entities: Map<String, ShortcutEntity>,
val parameters: List<ShortcutQueryParameter>,
- val methodBinder: DeleteOrUpdateMethodBinder?
+ val functionBinder: DeleteOrUpdateFunctionBinder?
)
diff --git a/room/room-compiler/src/main/kotlin/androidx/room/vo/InsertMethod.kt b/room/room-compiler/src/main/kotlin/androidx/room/vo/InsertFunction.kt
similarity index 80%
rename from room/room-compiler/src/main/kotlin/androidx/room/vo/InsertMethod.kt
rename to room/room-compiler/src/main/kotlin/androidx/room/vo/InsertFunction.kt
index c97af3d..3a966ff 100644
--- a/room/room-compiler/src/main/kotlin/androidx/room/vo/InsertMethod.kt
+++ b/room/room-compiler/src/main/kotlin/androidx/room/vo/InsertFunction.kt
@@ -19,13 +19,13 @@
import androidx.room.OnConflictStrategy
import androidx.room.compiler.processing.XMethodElement
import androidx.room.compiler.processing.XType
-import androidx.room.solver.shortcut.binder.InsertOrUpsertMethodBinder
+import androidx.room.solver.shortcut.binder.InsertOrUpsertFunctionBinder
-class InsertMethod(
+class InsertFunction(
element: XMethodElement,
@OnConflictStrategy val onConflict: Int,
entities: Map<String, ShortcutEntity>,
returnType: XType,
parameters: List<ShortcutQueryParameter>,
- methodBinder: InsertOrUpsertMethodBinder
-) : InsertOrUpsertShortcutMethod(element, entities, returnType, parameters, methodBinder)
+ functionBinder: InsertOrUpsertFunctionBinder
+) : InsertOrUpsertShortcutFunction(element, entities, returnType, parameters, functionBinder)
diff --git a/room/room-compiler/src/main/kotlin/androidx/room/vo/InsertOrUpsertShortcutMethod.kt b/room/room-compiler/src/main/kotlin/androidx/room/vo/InsertOrUpsertShortcutFunction.kt
similarity index 79%
rename from room/room-compiler/src/main/kotlin/androidx/room/vo/InsertOrUpsertShortcutMethod.kt
rename to room/room-compiler/src/main/kotlin/androidx/room/vo/InsertOrUpsertShortcutFunction.kt
index 2d04873..94b1b47 100644
--- a/room/room-compiler/src/main/kotlin/androidx/room/vo/InsertOrUpsertShortcutMethod.kt
+++ b/room/room-compiler/src/main/kotlin/androidx/room/vo/InsertOrUpsertShortcutFunction.kt
@@ -18,13 +18,13 @@
import androidx.room.compiler.processing.XMethodElement
import androidx.room.compiler.processing.XType
-import androidx.room.solver.shortcut.binder.InsertOrUpsertMethodBinder
+import androidx.room.solver.shortcut.binder.InsertOrUpsertFunctionBinder
-/** Base class for shortcut methods in @DAO. */
-abstract class InsertOrUpsertShortcutMethod(
+/** Base class for shortcut functions in @DAO. */
+abstract class InsertOrUpsertShortcutFunction(
val element: XMethodElement,
val entities: Map<String, ShortcutEntity>,
val returnType: XType,
val parameters: List<ShortcutQueryParameter>,
- val methodBinder: InsertOrUpsertMethodBinder?
+ val functionBinder: InsertOrUpsertFunctionBinder?
)
diff --git a/room/room-compiler/src/main/kotlin/androidx/room/vo/KotlinBoxedPrimitiveMethodDelegate.kt b/room/room-compiler/src/main/kotlin/androidx/room/vo/KotlinBoxedPrimitiveFunctionDelegate.kt
similarity index 65%
rename from room/room-compiler/src/main/kotlin/androidx/room/vo/KotlinBoxedPrimitiveMethodDelegate.kt
rename to room/room-compiler/src/main/kotlin/androidx/room/vo/KotlinBoxedPrimitiveFunctionDelegate.kt
index 0a7ed24..4b5076d 100644
--- a/room/room-compiler/src/main/kotlin/androidx/room/vo/KotlinBoxedPrimitiveMethodDelegate.kt
+++ b/room/room-compiler/src/main/kotlin/androidx/room/vo/KotlinBoxedPrimitiveFunctionDelegate.kt
@@ -19,11 +19,11 @@
import androidx.room.compiler.processing.XMethodElement
/**
- * Represents a DAO bridge method that to supported the boxed version of a generic abstract class or
- * interface in Kotlin. When generating the Java implementation of the DAO, Room needs to also
- * override the bridge method generated by Kotlin for the boxed version support, see KT-46650.
+ * Represents a DAO bridge function that to supported the boxed version of a generic abstract class
+ * or interface in Kotlin. When generating the Java implementation of the DAO, Room needs to also
+ * override the bridge function generated by Kotlin for the boxed version support, see KT-46650.
*/
-data class KotlinBoxedPrimitiveMethodDelegate(
+data class KotlinBoxedPrimitiveFunctionDelegate(
val element: XMethodElement,
- val concreteMethod: XMethodElement
+ val concreteFunction: XMethodElement
)
diff --git a/room/room-compiler/src/main/kotlin/androidx/room/vo/KotlinDefaultMethodDelegate.kt b/room/room-compiler/src/main/kotlin/androidx/room/vo/KotlinDefaultFunctionDelegate.kt
similarity index 86%
rename from room/room-compiler/src/main/kotlin/androidx/room/vo/KotlinDefaultMethodDelegate.kt
rename to room/room-compiler/src/main/kotlin/androidx/room/vo/KotlinDefaultFunctionDelegate.kt
index a6a43b4..de4ffe0 100644
--- a/room/room-compiler/src/main/kotlin/androidx/room/vo/KotlinDefaultMethodDelegate.kt
+++ b/room/room-compiler/src/main/kotlin/androidx/room/vo/KotlinDefaultFunctionDelegate.kt
@@ -19,10 +19,10 @@
import androidx.room.compiler.processing.XMethodElement
/**
- * Represents a DAO method that delegates to a concrete implementation, specifically to override a
+ * Represents a DAO function that delegates to a concrete implementation, specifically to override a
* Kotlin interface whose implementation is in the DefaultImpl generated class.
*/
-data class KotlinDefaultMethodDelegate(
+data class KotlinDefaultFunctionDelegate(
// the original element, not the stub that is generated for DefaultImpls
val element: XMethodElement
)
diff --git a/room/room-compiler/src/main/kotlin/androidx/room/vo/QueryMethod.kt b/room/room-compiler/src/main/kotlin/androidx/room/vo/QueryFunction.kt
similarity index 81%
rename from room/room-compiler/src/main/kotlin/androidx/room/vo/QueryMethod.kt
rename to room/room-compiler/src/main/kotlin/androidx/room/vo/QueryFunction.kt
index 6d837c0..0ff3413 100644
--- a/room/room-compiler/src/main/kotlin/androidx/room/vo/QueryMethod.kt
+++ b/room/room-compiler/src/main/kotlin/androidx/room/vo/QueryFunction.kt
@@ -23,10 +23,10 @@
import androidx.room.solver.query.result.QueryResultBinder
/**
- * A class that holds information about a QueryMethod. It is self sufficient and must have all
+ * A class that holds information about a QueryFunction. It is self sufficient and must have all
* generics etc resolved once created.
*/
-sealed class QueryMethod(
+sealed class QueryFunction(
val element: XMethodElement,
val query: ParsedQuery,
val returnType: XType,
@@ -46,23 +46,23 @@
}
}
-/** A query method who's query is a SELECT statement. */
-class ReadQueryMethod(
+/** A query function who's query is a SELECT statement. */
+class ReadQueryFunction(
element: XMethodElement,
query: ParsedQuery,
returnType: XType,
parameters: List<QueryParameter>,
val inTransaction: Boolean,
val queryResultBinder: QueryResultBinder
-) : QueryMethod(element, query, returnType, parameters) {
+) : QueryFunction(element, query, returnType, parameters) {
val isProperty = element.isKotlinPropertyMethod()
}
-/** A query method who's query is a INSERT, UPDATE or DELETE statement. */
-class WriteQueryMethod(
+/** A query function who's query is a INSERT, UPDATE or DELETE statement. */
+class WriteQueryFunction(
element: XMethodElement,
query: ParsedQuery,
returnType: XType,
parameters: List<QueryParameter>,
val preparedQueryResultBinder: PreparedQueryResultBinder
-) : QueryMethod(element, query, returnType, parameters)
+) : QueryFunction(element, query, returnType, parameters)
diff --git a/room/room-compiler/src/main/kotlin/androidx/room/vo/RawQueryMethod.kt b/room/room-compiler/src/main/kotlin/androidx/room/vo/RawQueryFunction.kt
similarity index 89%
rename from room/room-compiler/src/main/kotlin/androidx/room/vo/RawQueryMethod.kt
rename to room/room-compiler/src/main/kotlin/androidx/room/vo/RawQueryFunction.kt
index c447dd3..c359a85 100644
--- a/room/room-compiler/src/main/kotlin/androidx/room/vo/RawQueryMethod.kt
+++ b/room/room-compiler/src/main/kotlin/androidx/room/vo/RawQueryFunction.kt
@@ -27,10 +27,10 @@
import androidx.room.solver.query.result.QueryResultBinder
/**
- * A class that holds information about a method annotated with RawQuery. It is self sufficient and
- * must have all generics etc resolved once created.
+ * A class that holds information about a function annotated with RawQuery. It is self sufficient
+ * and must have all generics etc resolved once created.
*/
-data class RawQueryMethod(
+data class RawQueryFunction(
val element: XMethodElement,
val returnType: XType,
val inTransaction: Boolean,
diff --git a/room/room-compiler/src/main/kotlin/androidx/room/vo/ShortcutQueryParameter.kt b/room/room-compiler/src/main/kotlin/androidx/room/vo/ShortcutQueryParameter.kt
index 90196b8..425eb69 100644
--- a/room/room-compiler/src/main/kotlin/androidx/room/vo/ShortcutQueryParameter.kt
+++ b/room/room-compiler/src/main/kotlin/androidx/room/vo/ShortcutQueryParameter.kt
@@ -20,7 +20,7 @@
import androidx.room.compiler.processing.XType
import androidx.room.compiler.processing.XVariableElement
-/** Parameters used in DAO methods that are annotated with Insert, Delete, Update, and Upsert. */
+/** Parameters used in DAO functions that are annotated with Insert, Delete, Update, and Upsert. */
data class ShortcutQueryParameter(
val element: XVariableElement,
val name: String,
@@ -28,8 +28,8 @@
val pojoType: XType?, // extracted type, never a Collection
val isMultiple: Boolean
) {
- /** Method name in entity insertion or update adapter. */
- val handleMethodName =
+ /** Function name in entity insertion or update adapter. */
+ val handleFunctionName =
if (isMultiple) {
"handleMultiple"
} else {
diff --git a/room/room-compiler/src/main/kotlin/androidx/room/vo/TransactionMethod.kt b/room/room-compiler/src/main/kotlin/androidx/room/vo/TransactionFunction.kt
similarity index 83%
rename from room/room-compiler/src/main/kotlin/androidx/room/vo/TransactionMethod.kt
rename to room/room-compiler/src/main/kotlin/androidx/room/vo/TransactionFunction.kt
index a63abbc..6edaef4 100644
--- a/room/room-compiler/src/main/kotlin/androidx/room/vo/TransactionMethod.kt
+++ b/room/room-compiler/src/main/kotlin/androidx/room/vo/TransactionFunction.kt
@@ -18,17 +18,17 @@
import androidx.room.compiler.processing.XMethodElement
import androidx.room.compiler.processing.XType
-import androidx.room.solver.transaction.binder.TransactionMethodBinder
+import androidx.room.solver.transaction.binder.TransactionFunctionBinder
-class TransactionMethod(
+class TransactionFunction(
val element: XMethodElement,
val returnType: XType,
val parameterNames: List<String>,
val callType: CallType,
- val methodBinder: TransactionMethodBinder
+ val functionBinder: TransactionFunctionBinder
) {
enum class CallType {
- /** Directly call the method, it has a super implementation */
+ /** Directly call the function, it has a super implementation */
CONCRETE,
/**
diff --git a/room/room-compiler/src/main/kotlin/androidx/room/vo/UpdateMethod.kt b/room/room-compiler/src/main/kotlin/androidx/room/vo/UpdateFunction.kt
similarity index 79%
rename from room/room-compiler/src/main/kotlin/androidx/room/vo/UpdateMethod.kt
rename to room/room-compiler/src/main/kotlin/androidx/room/vo/UpdateFunction.kt
index bbcc6fa..fbf3eaa 100644
--- a/room/room-compiler/src/main/kotlin/androidx/room/vo/UpdateMethod.kt
+++ b/room/room-compiler/src/main/kotlin/androidx/room/vo/UpdateFunction.kt
@@ -18,12 +18,12 @@
import androidx.room.OnConflictStrategy
import androidx.room.compiler.processing.XMethodElement
-import androidx.room.solver.shortcut.binder.DeleteOrUpdateMethodBinder
+import androidx.room.solver.shortcut.binder.DeleteOrUpdateFunctionBinder
-class UpdateMethod(
+class UpdateFunction(
element: XMethodElement,
entities: Map<String, ShortcutEntity>,
parameters: List<ShortcutQueryParameter>,
- methodBinder: DeleteOrUpdateMethodBinder?,
+ functionBinder: DeleteOrUpdateFunctionBinder?,
@OnConflictStrategy val onConflictStrategy: Int
-) : DeleteOrUpdateShortcutMethod(element, entities, parameters, methodBinder)
+) : DeleteOrUpdateShortcutFunction(element, entities, parameters, functionBinder)
diff --git a/room/room-compiler/src/main/kotlin/androidx/room/vo/UpsertMethod.kt b/room/room-compiler/src/main/kotlin/androidx/room/vo/UpsertFunction.kt
similarity index 78%
rename from room/room-compiler/src/main/kotlin/androidx/room/vo/UpsertMethod.kt
rename to room/room-compiler/src/main/kotlin/androidx/room/vo/UpsertFunction.kt
index 161aa46..5ebb039 100644
--- a/room/room-compiler/src/main/kotlin/androidx/room/vo/UpsertMethod.kt
+++ b/room/room-compiler/src/main/kotlin/androidx/room/vo/UpsertFunction.kt
@@ -18,12 +18,12 @@
import androidx.room.compiler.processing.XMethodElement
import androidx.room.compiler.processing.XType
-import androidx.room.solver.shortcut.binder.InsertOrUpsertMethodBinder
+import androidx.room.solver.shortcut.binder.InsertOrUpsertFunctionBinder
-class UpsertMethod(
+class UpsertFunction(
element: XMethodElement,
entities: Map<String, ShortcutEntity>,
returnType: XType,
parameters: List<ShortcutQueryParameter>,
- methodBinder: InsertOrUpsertMethodBinder
-) : InsertOrUpsertShortcutMethod(element, entities, returnType, parameters, methodBinder)
+ functionBinder: InsertOrUpsertFunctionBinder
+) : InsertOrUpsertShortcutFunction(element, entities, returnType, parameters, functionBinder)
diff --git a/room/room-compiler/src/main/kotlin/androidx/room/vo/Warning.kt b/room/room-compiler/src/main/kotlin/androidx/room/vo/Warning.kt
index 181bf5b..cdfbbc8 100644
--- a/room/room-compiler/src/main/kotlin/androidx/room/vo/Warning.kt
+++ b/room/room-compiler/src/main/kotlin/androidx/room/vo/Warning.kt
@@ -48,7 +48,7 @@
// expand projection is removed.
EXPAND_PROJECTION_WITH_REMOVE_UNUSED_COLUMNS("ROOM_EXPAND_PROJECTION_WITH_UNUSED_COLUMNS"),
// We shouldn't let devs suppress this error via Room so there is no runtime constant for it
- JVM_NAME_ON_OVERRIDDEN_METHOD("ROOM_JVM_NAME_IN_OVERRIDDEN_METHOD"),
+ JVM_NAME_ON_OVERRIDDEN_FUNCTION("ROOM_JVM_NAME_IN_OVERRIDDEN_FUNCTION"),
AMBIGUOUS_COLUMN_IN_RESULT("ROOM_AMBIGUOUS_COLUMN_IN_RESULT"),
UNNECESSARY_NULLABILITY_IN_DAO_RETURN_TYPE("ROOM_UNNECESSARY_NULLABILITY_IN_DAO_RETURN_TYPE");
diff --git a/room/room-compiler/src/main/kotlin/androidx/room/writer/DaoWriter.kt b/room/room-compiler/src/main/kotlin/androidx/room/writer/DaoWriter.kt
index 4f73947..5130e72 100644
--- a/room/room-compiler/src/main/kotlin/androidx/room/writer/DaoWriter.kt
+++ b/room/room-compiler/src/main/kotlin/androidx/room/writer/DaoWriter.kt
@@ -45,21 +45,21 @@
import androidx.room.ext.capitalize
import androidx.room.processor.OnConflictProcessor
import androidx.room.solver.CodeGenScope
-import androidx.room.solver.KotlinBoxedPrimitiveMethodDelegateBinder
-import androidx.room.solver.KotlinDefaultMethodDelegateBinder
+import androidx.room.solver.KotlinBoxedPrimitiveFunctionDelegateBinder
+import androidx.room.solver.KotlinDefaultFunctionDelegateBinder
import androidx.room.solver.types.getRequiredTypeConverters
import androidx.room.vo.Dao
-import androidx.room.vo.DeleteOrUpdateShortcutMethod
-import androidx.room.vo.InsertMethod
-import androidx.room.vo.KotlinBoxedPrimitiveMethodDelegate
-import androidx.room.vo.KotlinDefaultMethodDelegate
-import androidx.room.vo.RawQueryMethod
-import androidx.room.vo.ReadQueryMethod
+import androidx.room.vo.DeleteOrUpdateShortcutFunction
+import androidx.room.vo.InsertFunction
+import androidx.room.vo.KotlinBoxedPrimitiveFunctionDelegate
+import androidx.room.vo.KotlinDefaultFunctionDelegate
+import androidx.room.vo.RawQueryFunction
+import androidx.room.vo.ReadQueryFunction
import androidx.room.vo.ShortcutEntity
-import androidx.room.vo.TransactionMethod
-import androidx.room.vo.UpdateMethod
-import androidx.room.vo.UpsertMethod
-import androidx.room.vo.WriteQueryMethod
+import androidx.room.vo.TransactionFunction
+import androidx.room.vo.UpdateFunction
+import androidx.room.vo.UpsertFunction
+import androidx.room.vo.WriteQueryFunction
import com.squareup.kotlinpoet.FunSpec
import com.squareup.kotlinpoet.KModifier
import com.squareup.kotlinpoet.jvm.jvmName
@@ -82,7 +82,7 @@
private val companionTypeBuilder = lazy { XTypeSpec.companionObjectBuilder() }
companion object {
- const val GET_LIST_OF_TYPE_CONVERTERS_METHOD = "getRequiredConverters"
+ const val GET_LIST_OF_TYPE_CONVERTERS_FUNCTION = "getRequiredConverters"
const val DB_PROPERTY_NAME = "__db"
@@ -103,14 +103,14 @@
override fun createTypeSpecBuilder(): XTypeSpec.Builder {
val builder = XTypeSpec.classBuilder(className)
- val preparedQueries = dao.queryMethods.filterIsInstance<WriteQueryMethod>()
+ val preparedQueries = dao.queryFunctions.filterIsInstance<WriteQueryFunction>()
- val shortcutMethods = buildList {
- addAll(createInsertMethods())
- addAll(createDeleteMethods())
- addAll(createUpdateMethods())
- addAll(createTransactionMethods())
- addAll(createUpsertMethods())
+ val shortcutFunctions = buildList {
+ addAll(createInsertFunctions())
+ addAll(createDeleteFunctions())
+ addAll(createUpdateFunctions())
+ addAll(createTransactionFunctions())
+ addAll(createUpsertFunctions())
}
builder.apply {
@@ -130,20 +130,20 @@
addProperty(dbProperty)
setPrimaryConstructor(
- createConstructor(shortcutMethods, dao.constructorParamType != null)
+ createConstructor(shortcutFunctions, dao.constructorParamType != null)
)
- shortcutMethods.forEach { addFunction(it.functionImpl) }
- dao.queryMethods.filterIsInstance<ReadQueryMethod>().forEach { method ->
- addFunction(createSelectMethod(method))
- if (method.isProperty) {
+ shortcutFunctions.forEach { addFunction(it.functionImpl) }
+ dao.queryFunctions.filterIsInstance<ReadQueryFunction>().forEach { function ->
+ addFunction(createSelectFunction(function))
+ if (function.isProperty) {
// DAO function is a getter from a Kotlin property, generate property override.
applyToKotlinPoet {
addProperty(
- PropertySpecHelper.overriding(method.element, declaredDao)
+ PropertySpecHelper.overriding(function.element, declaredDao)
.getter(
FunSpec.getterBuilder()
- .addCode("return %L()", method.element.name)
+ .addCode("return %L()", function.element.name)
.build()
)
.build()
@@ -151,20 +151,20 @@
}
}
}
- preparedQueries.forEach { addFunction(createPreparedQueryMethod(it)) }
- dao.rawQueryMethods.forEach { addFunction(createRawQueryMethod(it)) }
+ preparedQueries.forEach { addFunction(createPreparedQueryFunction(it)) }
+ dao.rawQueryFunctions.forEach { addFunction(createRawQueryFunction(it)) }
applyTo(CodeLanguage.JAVA) {
- dao.kotlinDefaultMethodDelegates.forEach {
- addFunction(createDefaultImplMethodDelegate(it))
+ dao.kotlinDefaultFunctionDelegates.forEach {
+ addFunction(createDefaultImplFunctionDelegate(it))
}
- dao.kotlinBoxedPrimitiveMethodDelegates.forEach {
- addFunction(createBoxedPrimitiveBridgeMethodDelegate(it))
+ dao.kotlinBoxedPrimitiveFunctionDelegates.forEach {
+ addFunction(createBoxedPrimitiveBridgeFunctionDelegate(it))
}
}
// Keep this the last one to be generated because used custom converters will
// register fields with a payload which we collect in dao to report used
// Type Converters.
- addConverterListMethod(this)
+ addConverterListFunction(this)
applyTo(CodeLanguage.KOTLIN) {
if (companionTypeBuilder.isInitialized()) {
addType(companionTypeBuilder.value.build())
@@ -174,16 +174,16 @@
return builder
}
- private fun addConverterListMethod(typeSpecBuilder: XTypeSpec.Builder) {
+ private fun addConverterListFunction(typeSpecBuilder: XTypeSpec.Builder) {
// For Java a static method is created
- typeSpecBuilder.applyTo(CodeLanguage.JAVA) { addFunction(createConverterListMethod()) }
+ typeSpecBuilder.applyTo(CodeLanguage.JAVA) { addFunction(createConverterListFunction()) }
// For Kotlin a function in the companion object is created
companionTypeBuilder.value.applyTo(CodeLanguage.KOTLIN) {
- addFunction(createConverterListMethod())
+ addFunction(createConverterListFunction())
}
}
- private fun createConverterListMethod(): XFunSpec {
+ private fun createConverterListFunction(): XFunSpec {
val body = buildCodeBlock { language ->
val requiredTypeConverters = getRequiredTypeConverters()
if (requiredTypeConverters.isEmpty()) {
@@ -218,7 +218,7 @@
}
}
}
- return XFunSpec.builder(GET_LIST_OF_TYPE_CONVERTERS_METHOD, VisibilityModifier.PUBLIC)
+ return XFunSpec.builder(GET_LIST_OF_TYPE_CONVERTERS_FUNCTION, VisibilityModifier.PUBLIC)
.applyToJavaPoet { addModifiers(javax.lang.model.element.Modifier.STATIC) }
.applyTo { language ->
returns(
@@ -234,33 +234,33 @@
.build()
}
- private fun createTransactionMethods(): List<PreparedStmtQuery> {
- return dao.transactionMethods.map {
- PreparedStmtQuery(emptyMap(), createTransactionMethodBody(it))
+ private fun createTransactionFunctions(): List<PreparedStmtQuery> {
+ return dao.transactionFunctions.map {
+ PreparedStmtQuery(emptyMap(), createTransactionFunctionBody(it))
}
}
- private fun createTransactionMethodBody(method: TransactionMethod): XFunSpec {
+ private fun createTransactionFunctionBody(function: TransactionFunction): XFunSpec {
val scope = CodeGenScope(this)
- method.methodBinder.executeAndReturn(
- parameterNames = method.parameterNames,
+ function.functionBinder.executeAndReturn(
+ parameterNames = function.parameterNames,
daoName = dao.typeName,
daoImplName = dao.implTypeName,
dbProperty = dbProperty,
scope = scope
)
- return overrideWithoutAnnotations(method.element, declaredDao)
+ return overrideWithoutAnnotations(function.element, declaredDao)
.addCode(scope.generate())
.build()
}
private fun createConstructor(
- shortcutMethods: List<PreparedStmtQuery>,
+ shortcutFunctions: List<PreparedStmtQuery>,
callSuper: Boolean
): XFunSpec {
val body = buildCodeBlock {
addStatement("this.%N = %L", dbProperty, dbProperty.name)
- shortcutMethods
+ shortcutFunctions
.asSequence()
.filterNot { it.fields.isEmpty() }
.map { it.fields.values }
@@ -282,11 +282,11 @@
.build()
}
- private fun createSelectMethod(method: ReadQueryMethod): XFunSpec {
- return overrideWithoutAnnotations(method.element, declaredDao)
+ private fun createSelectFunction(function: ReadQueryFunction): XFunSpec {
+ return overrideWithoutAnnotations(function.element, declaredDao)
.applyToKotlinPoet {
// TODO: Update XPoet to better handle this case.
- if (method.isProperty) {
+ if (function.isProperty) {
// When the DAO function is from a Kotlin property, we'll still generate
// a DAO function, but it won't be an override and it'll be private, to be
// called from the overridden property's getter.
@@ -302,34 +302,34 @@
context.targetPlatforms.size == 1 &&
context.targetPlatforms.contains(XProcessingEnv.Platform.JVM)
) {
- jvmName("_private${method.element.name.capitalize(Locale.US)}")
+ jvmName("_private${function.element.name.capitalize(Locale.US)}")
}
}
}
- .addCode(createQueryMethodBody(method))
+ .addCode(createQueryFunctionBody(function))
.build()
}
- private fun createRawQueryMethod(method: RawQueryMethod): XFunSpec {
- return overrideWithoutAnnotations(method.element, declaredDao)
+ private fun createRawQueryFunction(function: RawQueryFunction): XFunSpec {
+ return overrideWithoutAnnotations(function.element, declaredDao)
.addCode(
if (
- method.runtimeQueryParam == null ||
- method.queryResultBinder.usesCompatQueryWriter
+ function.runtimeQueryParam == null ||
+ function.queryResultBinder.usesCompatQueryWriter
) {
- compatCreateRawQueryMethodBody(method)
+ compatCreateRawQueryFunctionBody(function)
} else {
- createRawQueryMethodBody(method)
+ createRawQueryFunctionBody(function)
}
)
.build()
}
- private fun createRawQueryMethodBody(method: RawQueryMethod): XCodeBlock {
+ private fun createRawQueryFunctionBody(function: RawQueryFunction): XCodeBlock {
val scope = CodeGenScope(this@DaoWriter)
val sqlQueryVar = scope.getTmpVar("_sql")
val rawQueryParamName =
- if (method.runtimeQueryParam!!.isSupportQuery()) {
+ if (function.runtimeQueryParam!!.isSupportQuery()) {
val rawQueryVar = scope.getTmpVar("_rawQuery")
scope.builder.addLocalVariable(
name = rawQueryVar,
@@ -338,12 +338,12 @@
XCodeBlock.of(
format = "%T.copyFrom(%L).toRoomRawQuery()",
ROOM_SQL_QUERY,
- method.runtimeQueryParam.paramName
+ function.runtimeQueryParam.paramName
)
)
rawQueryVar
} else {
- method.runtimeQueryParam.paramName
+ function.runtimeQueryParam.paramName
}
scope.builder.addLocalVal(
@@ -354,8 +354,8 @@
XCodeBlock.ofString(java = "getSql()", kotlin = "sql")
)
- if (method.returnsValue) {
- method.queryResultBinder.convertAndReturn(
+ if (function.returnsValue) {
+ function.queryResultBinder.convertAndReturn(
sqlQueryVar = sqlQueryVar,
dbProperty = dbProperty,
bindStatement = { stmtVar ->
@@ -365,8 +365,8 @@
stmtVar
)
},
- returnTypeName = method.returnType.asTypeName(),
- inTransaction = method.inTransaction,
+ returnTypeName = function.returnType.asTypeName(),
+ inTransaction = function.inTransaction,
scope = scope
)
}
@@ -374,12 +374,12 @@
}
/** Used by the Non-KMP Paging3 binders and the Paging2 binders. */
- private fun compatCreateRawQueryMethodBody(method: RawQueryMethod): XCodeBlock =
+ private fun compatCreateRawQueryFunctionBody(function: RawQueryFunction): XCodeBlock =
XCodeBlock.builder()
.apply {
val scope = CodeGenScope(this@DaoWriter)
val roomSQLiteQueryVar: String
- val queryParam = method.runtimeQueryParam
+ val queryParam = function.runtimeQueryParam
if (queryParam?.isSupportQuery() == true) {
queryParam.paramName
} else if (queryParam?.isString() == true) {
@@ -408,10 +408,10 @@
),
)
}
- val rawQueryParamName = method.runtimeQueryParam?.paramName
+ val rawQueryParamName = function.runtimeQueryParam?.paramName
if (rawQueryParamName != null) {
- if (method.returnsValue) {
- method.queryResultBinder.convertAndReturn(
+ if (function.returnsValue) {
+ function.queryResultBinder.convertAndReturn(
sqlQueryVar = rawQueryParamName,
dbProperty = dbProperty,
bindStatement = { stmtVar ->
@@ -421,8 +421,8 @@
stmtVar
)
},
- returnTypeName = method.returnType.asTypeName(),
- inTransaction = method.inTransaction,
+ returnTypeName = function.returnType.asTypeName(),
+ inTransaction = function.inTransaction,
scope = scope
)
}
@@ -431,48 +431,48 @@
}
.build()
- private fun createPreparedQueryMethod(method: WriteQueryMethod): XFunSpec {
- return overrideWithoutAnnotations(method.element, declaredDao)
- .addCode(createPreparedQueryMethodBody(method))
+ private fun createPreparedQueryFunction(function: WriteQueryFunction): XFunSpec {
+ return overrideWithoutAnnotations(function.element, declaredDao)
+ .addCode(createPreparedQueryFunctionBody(function))
.build()
}
/**
- * Groups all insert methods based on the insert statement they will use then creates all field
- * specs, EntityInsertAdapterWriter and actual insert methods.
+ * Groups all insert functions based on the insert statement they will use then creates all
+ * field specs, EntityInsertAdapterWriter and actual insert functions.
*/
- private fun createInsertMethods(): List<PreparedStmtQuery> {
- return dao.insertMethods.map { insertMethod ->
- val onConflict = OnConflictProcessor.onConflictText(insertMethod.onConflict)
- val entities = insertMethod.entities
+ private fun createInsertFunctions(): List<PreparedStmtQuery> {
+ return dao.insertFunctions.map { insertFunction ->
+ val onConflict = OnConflictProcessor.onConflictText(insertFunction.onConflict)
+ val entities = insertFunction.entities
val fields =
entities.mapValues {
- val spec = getOrCreateProperty(InsertMethodProperty(it.value, onConflict))
+ val spec = getOrCreateProperty(InsertFunctionProperty(it.value, onConflict))
val impl =
EntityInsertAdapterWriter.create(it.value, onConflict)
.createAnonymous(this@DaoWriter)
spec to impl
}
- val methodImpl =
- overrideWithoutAnnotations(insertMethod.element, declaredDao)
- .apply { addCode(createInsertMethodBody(insertMethod, fields)) }
+ val functionImpl =
+ overrideWithoutAnnotations(insertFunction.element, declaredDao)
+ .apply { addCode(createInsertFunctionBody(insertFunction, fields)) }
.build()
- PreparedStmtQuery(fields, methodImpl)
+ PreparedStmtQuery(fields, functionImpl)
}
}
- private fun createInsertMethodBody(
- method: InsertMethod,
+ private fun createInsertFunctionBody(
+ function: InsertFunction,
insertAdapters: Map<String, Pair<XPropertySpec, XTypeSpec>>
): XCodeBlock {
- if (insertAdapters.isEmpty() || method.methodBinder == null) {
+ if (insertAdapters.isEmpty() || function.functionBinder == null) {
return XCodeBlock.builder().build()
}
val scope = CodeGenScope(writer = this)
- ShortcutQueryParameterWriter.addNullCheckValidation(scope, method.parameters)
- method.methodBinder.convertAndReturn(
- parameters = method.parameters,
+ ShortcutQueryParameterWriter.addNullCheckValidation(scope, function.parameters)
+ function.functionBinder.convertAndReturn(
+ parameters = function.parameters,
adapters = insertAdapters,
dbProperty = dbProperty,
scope = scope
@@ -480,34 +480,34 @@
return scope.generate()
}
- /** Creates EntityUpdateAdapter for each delete method. */
- private fun createDeleteMethods(): List<PreparedStmtQuery> {
- return createShortcutMethods(dao.deleteMethods, "delete") { _, entity ->
+ /** Creates EntityUpdateAdapter for each delete function. */
+ private fun createDeleteFunctions(): List<PreparedStmtQuery> {
+ return createShortcutFunctions(dao.deleteFunctions, "delete") { _, entity ->
EntityDeleteAdapterWriter.create(entity).createAnonymous(this@DaoWriter)
}
}
- /** Creates EntityUpdateAdapter for each @Update method. */
- private fun createUpdateMethods(): List<PreparedStmtQuery> {
- return createShortcutMethods(dao.updateMethods, "update") { update, entity ->
+ /** Creates EntityUpdateAdapter for each @Update function. */
+ private fun createUpdateFunctions(): List<PreparedStmtQuery> {
+ return createShortcutFunctions(dao.updateFunctions, "update") { update, entity ->
val onConflict = OnConflictProcessor.onConflictText(update.onConflictStrategy)
EntityUpdateAdapterWriter.create(entity, onConflict).createAnonymous(this@DaoWriter)
}
}
- private fun <T : DeleteOrUpdateShortcutMethod> createShortcutMethods(
- methods: List<T>,
- methodPrefix: String,
+ private fun <T : DeleteOrUpdateShortcutFunction> createShortcutFunctions(
+ functions: List<T>,
+ functionPrefix: String,
implCallback: (T, ShortcutEntity) -> XTypeSpec
): List<PreparedStmtQuery> {
- return methods.mapNotNull { method ->
- val entities = method.entities
+ return functions.mapNotNull { function ->
+ val entities = function.entities
if (entities.isEmpty()) {
null
} else {
val onConflict =
- if (method is UpdateMethod) {
- OnConflictProcessor.onConflictText(method.onConflictStrategy)
+ if (function is UpdateFunction) {
+ OnConflictProcessor.onConflictText(function.onConflictStrategy)
} else {
""
}
@@ -515,31 +515,31 @@
entities.mapValues {
val spec =
getOrCreateProperty(
- DeleteOrUpdateAdapterProperty(it.value, methodPrefix, onConflict)
+ DeleteOrUpdateAdapterProperty(it.value, functionPrefix, onConflict)
)
- val impl = implCallback(method, it.value)
+ val impl = implCallback(function, it.value)
spec to impl
}
- val methodSpec =
- overrideWithoutAnnotations(method.element, declaredDao)
- .apply { addCode(createDeleteOrUpdateMethodBody(method, fields)) }
+ val functionSpec =
+ overrideWithoutAnnotations(function.element, declaredDao)
+ .apply { addCode(createDeleteOrUpdateFunctionBody(function, fields)) }
.build()
- PreparedStmtQuery(fields, methodSpec)
+ PreparedStmtQuery(fields, functionSpec)
}
}
}
- private fun createDeleteOrUpdateMethodBody(
- method: DeleteOrUpdateShortcutMethod,
+ private fun createDeleteOrUpdateFunctionBody(
+ function: DeleteOrUpdateShortcutFunction,
adapters: Map<String, Pair<XPropertySpec, XTypeSpec>>
): XCodeBlock {
- if (adapters.isEmpty() || method.methodBinder == null) {
+ if (adapters.isEmpty() || function.functionBinder == null) {
return XCodeBlock.builder().build()
}
val scope = CodeGenScope(writer = this)
- ShortcutQueryParameterWriter.addNullCheckValidation(scope, method.parameters)
- method.methodBinder.convertAndReturn(
- parameters = method.parameters,
+ ShortcutQueryParameterWriter.addNullCheckValidation(scope, function.parameters)
+ function.functionBinder.convertAndReturn(
+ parameters = function.parameters,
adapters = adapters,
dbProperty = dbProperty,
scope = scope
@@ -548,12 +548,12 @@
}
/**
- * Groups all upsert methods based on the upsert statement they will use then creates all field
- * specs, EntityUpsertAdapterWriter and actual upsert methods.
+ * Groups all upsert functions based on the upsert statement they will use then creates all
+ * field specs, EntityUpsertAdapterWriter and actual upsert functions.
*/
- private fun createUpsertMethods(): List<PreparedStmtQuery> {
- return dao.upsertMethods.map { upsertMethod ->
- val entities = upsertMethod.entities
+ private fun createUpsertFunctions(): List<PreparedStmtQuery> {
+ return dao.upsertFunctions.map { upsertFunctions ->
+ val entities = upsertFunctions.entities
val fields =
entities.mapValues {
val spec = getOrCreateProperty(UpsertAdapterProperty(it.value))
@@ -562,25 +562,25 @@
.createConcrete(it.value, this@DaoWriter)
spec to impl
}
- val methodImpl =
- overrideWithoutAnnotations(upsertMethod.element, declaredDao)
- .apply { addCode(createUpsertMethodBody(upsertMethod, fields)) }
+ val functionImpl =
+ overrideWithoutAnnotations(upsertFunctions.element, declaredDao)
+ .apply { addCode(createUpsertFunctionBody(upsertFunctions, fields)) }
.build()
- PreparedStmtQuery(fields, methodImpl)
+ PreparedStmtQuery(fields, functionImpl)
}
}
- private fun createUpsertMethodBody(
- method: UpsertMethod,
+ private fun createUpsertFunctionBody(
+ function: UpsertFunction,
upsertAdapters: Map<String, Pair<XPropertySpec, XCodeBlock>>
): XCodeBlock {
- if (upsertAdapters.isEmpty() || method.methodBinder == null) {
+ if (upsertAdapters.isEmpty() || function.functionBinder == null) {
return XCodeBlock.builder().build()
}
val scope = CodeGenScope(writer = this)
- ShortcutQueryParameterWriter.addNullCheckValidation(scope, method.parameters)
- method.methodBinder.convertAndReturn(
- parameters = method.parameters,
+ ShortcutQueryParameterWriter.addNullCheckValidation(scope, function.parameters)
+ function.functionBinder.convertAndReturn(
+ parameters = function.parameters,
adapters = upsertAdapters,
dbProperty = dbProperty,
scope = scope
@@ -588,28 +588,28 @@
return scope.generate()
}
- private fun createPreparedQueryMethodBody(method: WriteQueryMethod): XCodeBlock {
+ private fun createPreparedQueryFunctionBody(function: WriteQueryFunction): XCodeBlock {
val scope = CodeGenScope(this)
- val queryWriter = QueryWriter(method)
+ val queryWriter = QueryWriter(function)
val sqlVar = scope.getTmpVar("_sql")
val listSizeArgs = queryWriter.prepareQuery(sqlVar, scope)
- method.preparedQueryResultBinder.executeAndReturn(
+ function.preparedQueryResultBinder.executeAndReturn(
sqlQueryVar = sqlVar,
dbProperty = dbProperty,
bindStatement = { stmtVar -> queryWriter.bindArgs(stmtVar, listSizeArgs, this) },
- returnTypeName = method.returnType.asTypeName(),
+ returnTypeName = function.returnType.asTypeName(),
scope = scope
)
return scope.generate()
}
- private fun createQueryMethodBody(method: ReadQueryMethod): XCodeBlock {
+ private fun createQueryFunctionBody(function: ReadQueryFunction): XCodeBlock {
val scope = CodeGenScope(this)
- val queryWriter = QueryWriter(method)
+ val queryWriter = QueryWriter(function)
val sqlStringVar = scope.getTmpVar("_sql")
val (sqlVar, listSizeArgs) =
- if (method.queryResultBinder.usesCompatQueryWriter) {
+ if (function.queryResultBinder.usesCompatQueryWriter) {
val roomSQLiteQueryVar = scope.getTmpVar("_statement")
queryWriter.prepareReadAndBind(sqlStringVar, roomSQLiteQueryVar, scope)
roomSQLiteQueryVar to emptyList()
@@ -624,12 +624,12 @@
null
}
- method.queryResultBinder.convertAndReturn(
+ function.queryResultBinder.convertAndReturn(
sqlQueryVar = sqlVar,
dbProperty = dbProperty,
bindStatement = bindStatement,
- returnTypeName = method.returnType.asTypeName(),
- inTransaction = method.inTransaction,
+ returnTypeName = function.returnType.asTypeName(),
+ inTransaction = function.inTransaction,
scope = scope
)
@@ -637,16 +637,18 @@
}
// TODO(b/251459654): Handle @JvmOverloads in delegating functions with Kotlin codegen.
- private fun createDefaultImplMethodDelegate(method: KotlinDefaultMethodDelegate): XFunSpec {
+ private fun createDefaultImplFunctionDelegate(
+ function: KotlinDefaultFunctionDelegate
+ ): XFunSpec {
val scope = CodeGenScope(this)
- return overrideWithoutAnnotations(method.element, declaredDao)
+ return overrideWithoutAnnotations(function.element, declaredDao)
.apply {
- KotlinDefaultMethodDelegateBinder.executeAndReturn(
+ KotlinDefaultFunctionDelegateBinder.executeAndReturn(
daoName = dao.typeName,
daoImplName = dao.implTypeName,
- methodName = method.element.jvmName,
- returnType = method.element.returnType,
- parameterNames = method.element.parameters.map { it.name },
+ functionName = function.element.jvmName,
+ returnType = function.element.returnType,
+ parameterNames = function.element.parameters.map { it.name },
scope = scope
)
addCode(scope.generate())
@@ -654,17 +656,19 @@
.build()
}
- private fun createBoxedPrimitiveBridgeMethodDelegate(
- method: KotlinBoxedPrimitiveMethodDelegate
+ private fun createBoxedPrimitiveBridgeFunctionDelegate(
+ function: KotlinBoxedPrimitiveFunctionDelegate
): XFunSpec {
val scope = CodeGenScope(this)
- return overrideWithoutAnnotations(method.element, declaredDao)
+ return overrideWithoutAnnotations(function.element, declaredDao)
.apply {
- KotlinBoxedPrimitiveMethodDelegateBinder.execute(
- methodName = method.element.jvmName,
- returnType = method.element.returnType,
+ KotlinBoxedPrimitiveFunctionDelegateBinder.execute(
+ functionName = function.element.jvmName,
+ returnType = function.element.returnType,
parameters =
- method.concreteMethod.parameters.map { it.type.asTypeName() to it.name },
+ function.concreteFunction.parameters.map {
+ it.type.asTypeName() to it.name
+ },
scope = scope
)
addCode(scope.generate())
@@ -680,22 +684,22 @@
* Represents a query statement prepared in Dao implementation.
*
* @param fields This map holds all the member properties necessary for this query. The key is
- * the corresponding parameter name in the defining query method. The value is a pair from the
- * property declaration to definition.
- * @param functionImpl The body of the query method implementation.
+ * the corresponding parameter name in the defining query function. The value is a pair from
+ * the property declaration to definition.
+ * @param functionImpl The body of the query function implementation.
*/
data class PreparedStmtQuery(
val fields: Map<String, Pair<XPropertySpec, Any>>,
val functionImpl: XFunSpec
) {
companion object {
- // The key to be used in `fields` where the method requires a field that is not
+ // The key to be used in `fields` where the function requires a field that is not
// associated with any of its parameters
const val NO_PARAM_FIELD = "-"
}
}
- private class InsertMethodProperty(
+ private class InsertFunctionProperty(
val shortcutEntity: ShortcutEntity,
val onConflictText: String,
) :
@@ -713,18 +717,18 @@
class DeleteOrUpdateAdapterProperty(
val shortcutEntity: ShortcutEntity,
- val methodPrefix: String,
+ val functionPrefix: String,
val onConflictText: String,
) :
SharedPropertySpec(
- baseName = "${methodPrefix}AdapterOf${shortcutEntityFieldNamePart(shortcutEntity)}",
+ baseName = "${functionPrefix}AdapterOf${shortcutEntityFieldNamePart(shortcutEntity)}",
type = DELETE_OR_UPDATE_ADAPTER.parametrizedBy(shortcutEntity.dataClass.typeName)
) {
override fun prepare(writer: TypeWriter, builder: XPropertySpec.Builder) {}
override fun getUniqueKey(): String {
return "${shortcutEntity.dataClass.typeName}-${shortcutEntity.entityTypeName}" +
- "$methodPrefix$onConflictText"
+ "$functionPrefix$onConflictText"
}
}
diff --git a/room/room-compiler/src/main/kotlin/androidx/room/writer/DatabaseWriter.kt b/room/room-compiler/src/main/kotlin/androidx/room/writer/DatabaseWriter.kt
index 7d0e36f..f66b224 100644
--- a/room/room-compiler/src/main/kotlin/androidx/room/writer/DatabaseWriter.kt
+++ b/room/room-compiler/src/main/kotlin/androidx/room/writer/DatabaseWriter.kt
@@ -40,7 +40,7 @@
import androidx.room.ext.decapitalize
import androidx.room.ext.stripNonJava
import androidx.room.solver.CodeGenScope
-import androidx.room.vo.DaoMethod
+import androidx.room.vo.DaoFunction
import androidx.room.vo.Database
import java.util.Locale
import javax.lang.model.element.Modifier
@@ -112,7 +112,7 @@
KotlinCollectionMemberNames.MUTABLE_MAP_OF
)
}
- database.daoMethods.forEach {
+ database.daoFunctions.forEach {
addStatement(
"%L.put(%L, %T.%L())",
typeConvertersVar,
@@ -121,7 +121,7 @@
CodeLanguage.KOTLIN -> XCodeBlock.ofKotlinClassLiteral(it.dao.typeName)
},
it.dao.implTypeName,
- DaoWriter.GET_LIST_OF_TYPE_CONVERTERS_METHOD
+ DaoWriter.GET_LIST_OF_TYPE_CONVERTERS_FUNCTION
)
}
addStatement("return %L", typeConvertersVar)
@@ -351,7 +351,7 @@
private fun addDaoImpls(builder: XTypeSpec.Builder) {
val scope = CodeGenScope(this)
- database.daoMethods.forEach { method ->
+ database.daoFunctions.forEach { method ->
val name =
method.dao.typeName.simpleNames.first().decapitalize(Locale.US).stripNonJava()
val privateDaoProperty =
@@ -411,7 +411,7 @@
}
}
- private fun createDaoGetter(method: DaoMethod, daoProperty: XPropertySpec): XFunSpec {
+ private fun createDaoGetter(method: DaoFunction, daoProperty: XPropertySpec): XFunSpec {
val body =
XCodeBlock.builder().applyTo { language ->
// For Java we implement the memoization logic in the Dao getter, meanwhile for
diff --git a/room/room-compiler/src/main/kotlin/androidx/room/writer/QueryWriter.kt b/room/room-compiler/src/main/kotlin/androidx/room/writer/QueryWriter.kt
index 0869212..f152389 100644
--- a/room/room-compiler/src/main/kotlin/androidx/room/writer/QueryWriter.kt
+++ b/room/room-compiler/src/main/kotlin/androidx/room/writer/QueryWriter.kt
@@ -28,7 +28,7 @@
import androidx.room.parser.ParsedQuery
import androidx.room.parser.Section
import androidx.room.solver.CodeGenScope
-import androidx.room.vo.QueryMethod
+import androidx.room.vo.QueryFunction
import androidx.room.vo.QueryParameter
/** Writes the SQL query and arguments for a QueryMethod. */
@@ -39,8 +39,8 @@
) {
constructor(
- queryMethod: QueryMethod
- ) : this(queryMethod.parameters, queryMethod.sectionToParamMapping, queryMethod.query)
+ queryFunction: QueryFunction
+ ) : this(queryFunction.parameters, queryFunction.sectionToParamMapping, queryFunction.query)
fun prepareReadAndBind(
outSqlQueryName: String,
diff --git a/room/room-compiler/src/main/kotlin/androidx/room/writer/RelationCollectorFunctionWriter.kt b/room/room-compiler/src/main/kotlin/androidx/room/writer/RelationCollectorFunctionWriter.kt
index 4d18e8a..c668ed4 100644
--- a/room/room-compiler/src/main/kotlin/androidx/room/writer/RelationCollectorFunctionWriter.kt
+++ b/room/room-compiler/src/main/kotlin/androidx/room/writer/RelationCollectorFunctionWriter.kt
@@ -56,7 +56,7 @@
override fun getUniqueKey(): String {
val relation = collector.relation
- return "RelationCollectorMethodWriter" +
+ return "RelationCollectorFunctionWriter" +
"-${collector.mapTypeName}" +
"-${relation.entity.typeName.toString(CodeLanguage.JAVA)}" +
"-${relation.entityField.columnName}" +
@@ -207,7 +207,7 @@
private fun XCodeBlock.Builder.addRecursiveFetchCall(
scope: CodeGenScope,
- methodName: String,
+ functionName: String,
) {
val utilFunction =
RELATION_UTIL.let {
@@ -239,7 +239,7 @@
val recursiveCall =
XCodeBlock.of(
"%L(%L, %L)",
- methodName,
+ functionName,
PARAM_CONNECTION_VARIABLE,
paramName
)
diff --git a/room/room-compiler/src/test/kotlin/androidx/room/processor/BaseDaoTest.kt b/room/room-compiler/src/test/kotlin/androidx/room/processor/BaseDaoTest.kt
index a8095c4..48fe74f 100644
--- a/room/room-compiler/src/test/kotlin/androidx/room/processor/BaseDaoTest.kt
+++ b/room/room-compiler/src/test/kotlin/androidx/room/processor/BaseDaoTest.kt
@@ -26,7 +26,7 @@
void insertMe(T t);
"""
) { dao ->
- assertThat(dao.insertMethods.size, `is`(1))
+ assertThat(dao.insertFunctions.size, `is`(1))
}
}
@@ -38,7 +38,7 @@
void insertMe(T[] t);
"""
) { dao ->
- assertThat(dao.insertMethods.size, `is`(1))
+ assertThat(dao.insertFunctions.size, `is`(1))
}
}
@@ -50,7 +50,7 @@
void insertMe(T... t);
"""
) { dao ->
- assertThat(dao.insertMethods.size, `is`(1))
+ assertThat(dao.insertFunctions.size, `is`(1))
}
}
@@ -62,7 +62,7 @@
void insertMe(List<T> t);
"""
) { dao ->
- assertThat(dao.insertMethods.size, `is`(1))
+ assertThat(dao.insertFunctions.size, `is`(1))
}
}
@@ -74,7 +74,7 @@
void deleteMe(T t);
"""
) { dao ->
- assertThat(dao.deleteMethods.size, `is`(1))
+ assertThat(dao.deleteFunctions.size, `is`(1))
}
}
@@ -86,7 +86,7 @@
void deleteMe(T[] t);
"""
) { dao ->
- assertThat(dao.deleteMethods.size, `is`(1))
+ assertThat(dao.deleteFunctions.size, `is`(1))
}
}
@@ -98,7 +98,7 @@
void deleteMe(T... t);
"""
) { dao ->
- assertThat(dao.deleteMethods.size, `is`(1))
+ assertThat(dao.deleteFunctions.size, `is`(1))
}
}
@@ -110,7 +110,7 @@
void deleteMe(List<T> t);
"""
) { dao ->
- assertThat(dao.deleteMethods.size, `is`(1))
+ assertThat(dao.deleteFunctions.size, `is`(1))
}
}
@@ -122,7 +122,7 @@
void updateMe(T t);
"""
) { dao ->
- assertThat(dao.updateMethods.size, `is`(1))
+ assertThat(dao.updateFunctions.size, `is`(1))
}
}
@@ -134,7 +134,7 @@
void updateMe(T[] t);
"""
) { dao ->
- assertThat(dao.updateMethods.size, `is`(1))
+ assertThat(dao.updateFunctions.size, `is`(1))
}
}
@@ -146,7 +146,7 @@
void updateMe(T... t);
"""
) { dao ->
- assertThat(dao.updateMethods.size, `is`(1))
+ assertThat(dao.updateFunctions.size, `is`(1))
}
}
@@ -158,7 +158,7 @@
void updateMe(List<T> t);
"""
) { dao ->
- assertThat(dao.updateMethods.size, `is`(1))
+ assertThat(dao.updateFunctions.size, `is`(1))
}
}
diff --git a/room/room-compiler/src/test/kotlin/androidx/room/processor/CustomConverterProcessorTest.kt b/room/room-compiler/src/test/kotlin/androidx/room/processor/CustomConverterProcessorTest.kt
index f4ff34f..5027258 100644
--- a/room/room-compiler/src/test/kotlin/androidx/room/processor/CustomConverterProcessorTest.kt
+++ b/room/room-compiler/src/test/kotlin/androidx/room/processor/CustomConverterProcessorTest.kt
@@ -286,7 +286,7 @@
.isEqualTo(XTypeName.BOXED_SHORT.copy(nullable = true))
assertThat(converter?.toTypeName).isEqualTo(XTypeName.BOXED_CHAR.copy(nullable = true))
invocation.assertCompilationResult {
- hasErrorContaining("Multiple methods define the same conversion")
+ hasErrorContaining("Multiple functions define the same conversion")
}
}
}
@@ -321,7 +321,7 @@
if (invocation.isKsp) {
// no error
} else {
- hasErrorContaining("Multiple methods define the same")
+ hasErrorContaining("Multiple functions define the same")
}
}
}
diff --git a/room/room-compiler/src/test/kotlin/androidx/room/processor/DaoProcessorTest.kt b/room/room-compiler/src/test/kotlin/androidx/room/processor/DaoProcessorTest.kt
index 6ebead5..c8303f2 100644
--- a/room/room-compiler/src/test/kotlin/androidx/room/processor/DaoProcessorTest.kt
+++ b/room/room-compiler/src/test/kotlin/androidx/room/processor/DaoProcessorTest.kt
@@ -23,13 +23,13 @@
import androidx.room.compiler.processing.util.XTestInvocation
import androidx.room.compiler.processing.util.compileFiles
import androidx.room.ext.RoomTypeNames.ROOM_DB
-import androidx.room.processor.ProcessorErrors.nullableCollectionOrArrayReturnTypeInDaoMethod
-import androidx.room.processor.ProcessorErrors.nullableComponentInDaoMethodReturnType
+import androidx.room.processor.ProcessorErrors.nullableCollectionOrArrayReturnTypeInDaoFunction
+import androidx.room.processor.ProcessorErrors.nullableComponentInDaoFunctionReturnType
import androidx.room.runKspTestWithK1
import androidx.room.runProcessorTestWithK1
import androidx.room.testing.context
import androidx.room.vo.Dao
-import androidx.room.vo.ReadQueryMethod
+import androidx.room.vo.ReadQueryFunction
import androidx.room.vo.Warning
import createVerifierFromEntitiesAndViews
import java.io.File
@@ -92,7 +92,7 @@
"""
) { _, invocation ->
invocation.assertCompilationResult {
- hasErrorContaining(ProcessorErrors.INVALID_ANNOTATION_COUNT_IN_DAO_METHOD)
+ hasErrorContaining(ProcessorErrors.INVALID_ANNOTATION_COUNT_IN_DAO_FUNCTION)
}
}
}
@@ -116,10 +116,10 @@
) { _, invocation ->
invocation.assertCompilationResult {
hasRawOutputContaining(
- ProcessorErrors.INVALID_ANNOTATION_COUNT_IN_DAO_METHOD +
+ ProcessorErrors.INVALID_ANNOTATION_COUNT_IN_DAO_FUNCTION +
" - test.library.MissingAnnotationsBaseDao.getFoo()"
)
- hasErrorContaining(ProcessorErrors.INVALID_ANNOTATION_COUNT_IN_DAO_METHOD)
+ hasErrorContaining(ProcessorErrors.INVALID_ANNOTATION_COUNT_IN_DAO_FUNCTION)
}
}
}
@@ -136,7 +136,8 @@
"""
) { _, invocation ->
invocation.assertCompilationResult {
- hasErrorContaining(ProcessorErrors.INVALID_ANNOTATION_COUNT_IN_DAO_METHOD).onLine(8)
+ hasErrorContaining(ProcessorErrors.INVALID_ANNOTATION_COUNT_IN_DAO_FUNCTION)
+ .onLine(8)
}
}
}
@@ -151,8 +152,8 @@
}
"""
) { dao, _ ->
- assertThat(dao.queryMethods.size, `is`(1))
- val method = dao.queryMethods.first()
+ assertThat(dao.queryFunctions.size, `is`(1))
+ val method = dao.queryFunctions.first()
assertThat(method.element.jvmName, `is`("getIds"))
}
}
@@ -167,8 +168,8 @@
}
"""
) { dao, _ ->
- assertThat(dao.queryMethods.size, `is`(1))
- val method = dao.queryMethods.first()
+ assertThat(dao.queryFunctions.size, `is`(1))
+ val method = dao.queryFunctions.first()
assertThat(method.element.jvmName, `is`("getIds"))
}
}
@@ -185,11 +186,11 @@
}
"""
) { dao, _ ->
- assertThat(dao.queryMethods.size, `is`(1))
- val method = dao.queryMethods.first()
+ assertThat(dao.queryFunctions.size, `is`(1))
+ val method = dao.queryFunctions.first()
assertThat(method.element.jvmName, `is`("getIds"))
- assertThat(dao.insertMethods.size, `is`(1))
- val insertMethod = dao.insertMethods.first()
+ assertThat(dao.insertFunctions.size, `is`(1))
+ val insertMethod = dao.insertFunctions.first()
assertThat(insertMethod.element.jvmName, `is`("insert"))
}
}
@@ -204,8 +205,8 @@
}
"""
) { dao, _ ->
- assertThat(dao.queryMethods.size, `is`(1))
- val method = dao.queryMethods.first()
+ assertThat(dao.queryFunctions.size, `is`(1))
+ val method = dao.queryFunctions.first()
assertThat(method.element.jvmName, `is`("getIds"))
}
}
@@ -229,9 +230,9 @@
`is`(setOf(Warning.ALL, Warning.QUERY_MISMATCH))
)
- dao.queryMethods.forEach {
+ dao.queryFunctions.forEach {
assertThat(
- QueryMethodProcessor(
+ QueryFunctionProcessor(
baseContext = daoProcessor.context,
containing = dao.element.type,
executableElement = it.element,
@@ -297,9 +298,9 @@
`is`(setOf(Warning.QUERY_MISMATCH))
)
- dao.queryMethods.forEach {
+ dao.queryFunctions.forEach {
assertThat(
- QueryMethodProcessor(
+ QueryFunctionProcessor(
baseContext = daoProcessor.context,
containing = dao.element.type,
executableElement = it.element,
@@ -332,9 +333,9 @@
}
"""
) { dao, invocation ->
- assertThat(dao.queryMethods.size, `is`(1))
+ assertThat(dao.queryFunctions.size, `is`(1))
assertThat(
- dao.queryMethods.filterIsInstance<ReadQueryMethod>().first().inTransaction,
+ dao.queryFunctions.filterIsInstance<ReadQueryFunction>().first().inTransaction,
`is`(false)
)
invocation.assertCompilationResult {
@@ -362,9 +363,9 @@
}
"""
) { dao, invocation ->
- assertThat(dao.queryMethods.size, `is`(1))
+ assertThat(dao.queryFunctions.size, `is`(1))
assertThat(
- dao.queryMethods.filterIsInstance<ReadQueryMethod>().first().inTransaction,
+ dao.queryFunctions.filterIsInstance<ReadQueryFunction>().first().inTransaction,
`is`(false)
)
invocation.assertCompilationResult { hasNoWarnings() }
@@ -391,9 +392,9 @@
"""
) { dao, invocation ->
// test sanity
- assertThat(dao.queryMethods.size, `is`(1))
+ assertThat(dao.queryFunctions.size, `is`(1))
assertThat(
- dao.queryMethods.filterIsInstance<ReadQueryMethod>().first().inTransaction,
+ dao.queryFunctions.filterIsInstance<ReadQueryFunction>().first().inTransaction,
`is`(true)
)
invocation.assertCompilationResult { hasNoWarnings() }
@@ -410,8 +411,8 @@
}
"""
) { dao, _ ->
- assertThat(dao.queryMethods.size, `is`(1))
- val method = dao.queryMethods.first()
+ assertThat(dao.queryFunctions.size, `is`(1))
+ val method = dao.queryFunctions.first()
assertThat(method.element.jvmName, `is`("deleteAllIds"))
}
}
@@ -426,8 +427,8 @@
}
"""
) { dao, invocation ->
- assertThat(dao.queryMethods.size, `is`(1))
- val method = dao.queryMethods.first()
+ assertThat(dao.queryFunctions.size, `is`(1))
+ val method = dao.queryFunctions.first()
assertThat(method.element.jvmName, `is`("getAllIds"))
invocation.assertCompilationResult {
hasErrorContaining(ProcessorErrors.cannotFindQueryResultAdapter("void"))
@@ -463,7 +464,7 @@
)
.process()
invocation.assertCompilationResult {
- hasWarningContaining(ProcessorErrors.JVM_NAME_ON_OVERRIDDEN_METHOD)
+ hasWarningContaining(ProcessorErrors.JVM_NAME_ON_OVERRIDDEN_FUNCTION)
}
}
}
@@ -656,55 +657,55 @@
.process()
invocation.assertCompilationResult {
hasWarningContaining(
- nullableCollectionOrArrayReturnTypeInDaoMethod(
+ nullableCollectionOrArrayReturnTypeInDaoFunction(
"kotlin.collections.List<MyEntity>?",
"Collection"
)
)
hasWarningContaining(
- nullableCollectionOrArrayReturnTypeInDaoMethod(
+ nullableCollectionOrArrayReturnTypeInDaoFunction(
"com.google.common.collect.ImmutableList<MyEntity>?",
"Collection"
)
)
hasWarningContaining(
- nullableCollectionOrArrayReturnTypeInDaoMethod(
+ nullableCollectionOrArrayReturnTypeInDaoFunction(
"kotlin.Array<MyEntity>?",
"Array"
)
)
hasWarningContaining(
- nullableCollectionOrArrayReturnTypeInDaoMethod(
+ nullableCollectionOrArrayReturnTypeInDaoFunction(
"java.util.Optional<MyEntity>?",
"Optional"
)
)
hasWarningContaining(
- nullableCollectionOrArrayReturnTypeInDaoMethod(
+ nullableCollectionOrArrayReturnTypeInDaoFunction(
"com.google.common.base.Optional<MyEntity>?",
"Optional"
)
)
hasWarningContaining(
- nullableCollectionOrArrayReturnTypeInDaoMethod(
+ nullableCollectionOrArrayReturnTypeInDaoFunction(
"kotlin.collections.Map<MyEntity, MyOtherEntity>?",
"Collection"
)
)
hasWarningContaining(
- nullableCollectionOrArrayReturnTypeInDaoMethod(
+ nullableCollectionOrArrayReturnTypeInDaoFunction(
"com.google.common.collect.ImmutableMap<MyEntity, MyOtherEntity>?",
"Collection"
)
)
hasWarningContaining(
- nullableCollectionOrArrayReturnTypeInDaoMethod(
+ nullableCollectionOrArrayReturnTypeInDaoFunction(
"com.google.common.collect.ImmutableSetMultimap<MyEntity, MyOtherEntity>?",
"Collection"
)
)
hasWarningContaining(
- nullableCollectionOrArrayReturnTypeInDaoMethod(
+ nullableCollectionOrArrayReturnTypeInDaoFunction(
"com.google.common.collect.ImmutableListMultimap<MyEntity, MyOtherEntity>?",
"Collection"
)
@@ -782,31 +783,31 @@
.process()
invocation.assertCompilationResult {
hasWarningContaining(
- nullableComponentInDaoMethodReturnType("kotlin.collections.List<MyEntity?>")
+ nullableComponentInDaoFunctionReturnType("kotlin.collections.List<MyEntity?>")
)
hasWarningContaining(
- nullableComponentInDaoMethodReturnType(
+ nullableComponentInDaoFunctionReturnType(
"com.google.common.collect.ImmutableList<MyEntity?>"
)
)
hasWarningContaining(
- nullableComponentInDaoMethodReturnType("kotlin.Array<MyEntity?>")
+ nullableComponentInDaoFunctionReturnType("kotlin.Array<MyEntity?>")
)
hasWarningContaining(
- nullableComponentInDaoMethodReturnType("java.util.Optional<MyEntity?>")
+ nullableComponentInDaoFunctionReturnType("java.util.Optional<MyEntity?>")
)
hasWarningContaining(
- nullableComponentInDaoMethodReturnType(
+ nullableComponentInDaoFunctionReturnType(
"com.google.common.base.Optional<MyEntity?>"
)
)
hasWarningContaining(
- nullableComponentInDaoMethodReturnType(
+ nullableComponentInDaoFunctionReturnType(
"kotlin.collections.Map<MyEntity?, MyOtherEntity>"
)
)
hasWarningContaining(
- nullableComponentInDaoMethodReturnType(
+ nullableComponentInDaoFunctionReturnType(
"com.google.common.collect.ImmutableMap<MyEntity?, MyOtherEntity>"
)
)
@@ -814,17 +815,17 @@
// convert the map to a mutable one and re-run the `findQueryResultAdapter`
// algorithm
hasWarningContaining(
- nullableComponentInDaoMethodReturnType(
+ nullableComponentInDaoFunctionReturnType(
"kotlin.collections.MutableMap<MyEntity?, MyOtherEntity>"
)
)
hasWarningContaining(
- nullableComponentInDaoMethodReturnType(
+ nullableComponentInDaoFunctionReturnType(
"com.google.common.collect.ImmutableSetMultimap<MyEntity?, MyOtherEntity>"
)
)
hasWarningContaining(
- nullableComponentInDaoMethodReturnType(
+ nullableComponentInDaoFunctionReturnType(
"com.google.common.collect.ImmutableListMultimap<MyEntity?, MyOtherEntity>"
)
)
diff --git a/room/room-compiler/src/test/kotlin/androidx/room/processor/DataClassProcessorTargetMethodTest.kt b/room/room-compiler/src/test/kotlin/androidx/room/processor/DataClassProcessorTargetFunctionTest.kt
similarity index 94%
rename from room/room-compiler/src/test/kotlin/androidx/room/processor/DataClassProcessorTargetMethodTest.kt
rename to room/room-compiler/src/test/kotlin/androidx/room/processor/DataClassProcessorTargetFunctionTest.kt
index 5fdb87b..3a1f875b 100644
--- a/room/room-compiler/src/test/kotlin/androidx/room/processor/DataClassProcessorTargetMethodTest.kt
+++ b/room/room-compiler/src/test/kotlin/androidx/room/processor/DataClassProcessorTargetFunctionTest.kt
@@ -26,7 +26,7 @@
import org.junit.runners.JUnit4
@RunWith(JUnit4::class)
-class DataClassProcessorTargetMethodTest {
+class DataClassProcessorTargetFunctionTest {
companion object {
val MY_DATA_CLASS = XClassName.get("foo.bar", "MyDataClass")
@@ -56,7 +56,7 @@
}
@Test
- fun invalidAnnotationInMethod() {
+ fun invalidAnnotationInFunction() {
val source =
Source.java(
MY_DATA_CLASS.canonicalName,
@@ -67,7 +67,7 @@
class MyDataClass {
@PrimaryKey
- void someRandomMethod() { }
+ void someRandomFunction() { }
}
"""
)
@@ -84,7 +84,7 @@
}
@Test
- fun invalidAnnotationInStaticMethod() {
+ fun invalidAnnotationInStaticFunction() {
val source =
Source.java(
MY_DATA_CLASS.canonicalName,
@@ -95,7 +95,7 @@
class MyDataClass {
@PrimaryKey
- static void someRandomMethod() { }
+ static void someRandomFunction() { }
}
"""
)
@@ -112,7 +112,7 @@
}
@Test
- fun invalidAnnotationInAbstractMethod() {
+ fun invalidAnnotationInAbstractFunction() {
val source =
Source.java(
MY_DATA_CLASS.canonicalName,
@@ -123,7 +123,7 @@
abstract class MyDataClass {
@PrimaryKey
- abstract void someRandomMethod();
+ abstract void someRandomFunction();
}
"""
)
@@ -140,14 +140,14 @@
}
@Test
- fun invalidAnnotationInAutoValueMethod() {
+ fun invalidAnnotationInAutoValueFunction() {
singleRun(
"""
@AutoValue.CopyAnnotations
@PrimaryKey
abstract long getId();
@ColumnInfo(name = "column_name")
- void someRandomMethod() { }
+ void someRandomFunction() { }
static MyDataClass create(long id) { return new AutoValue_MyDataClass(id); }
""",
"""
@@ -170,7 +170,7 @@
}
@Test
- fun invalidAnnotationInAutoValueParentMethod() {
+ fun invalidAnnotationInAutoValueParentFunction() {
val parent =
"""
package foo.bar;
@@ -181,7 +181,7 @@
@ColumnInfo(name = "column_name")
abstract String getValue();
@ColumnInfo(name = "another_column_name")
- void someRandomMethod() { }
+ void someRandomFunction() { }
}
"""
singleRunFullClass(
@@ -264,7 +264,7 @@
}
@Test
- fun validAnnotationInAutoValueAbstractMethod() {
+ fun validAnnotationInAutoValueAbstractFunction() {
singleRun(
"""
@AutoValue.CopyAnnotations
@@ -283,7 +283,7 @@
}
@Test
- fun validAnnotationInAutoValueParentMethod() {
+ fun validAnnotationInAutoValueParentFunction() {
val parent =
"""
package foo.bar;
@@ -328,7 +328,7 @@
}
@Test
- fun validAnnotationInAutoValueImplementedInterfaceMethod() {
+ fun validAnnotationInAutoValueImplementedInterfaceFunction() {
val parent =
"""
package foo.bar;
@@ -373,7 +373,7 @@
}
@Test
- fun validEmbeddedAnnotationInAutoValueAbstractMethod() {
+ fun validEmbeddedAnnotationInAutoValueAbstractFunction() {
val embeddedDataClass =
"""
package foo.bar;
@@ -415,7 +415,7 @@
}
@Test
- fun validRelationAnnotationInAutoValueAbstractMethod() {
+ fun validRelationAnnotationInAutoValueAbstractFunction() {
val embeddedDataClass =
"""
package foo.bar;
@@ -520,7 +520,7 @@
}
/**
- * KSP and JavaAP name methods different. To feel more native, we use the name based on the
+ * KSP and JavaAP name functions differently. To feel more native, we use the name based on the
* processor. It only matters for the test assertion
*/
private val XTestInvocation.functionKindName: String
diff --git a/room/room-compiler/src/test/kotlin/androidx/room/processor/DatabaseProcessorTest.kt b/room/room-compiler/src/test/kotlin/androidx/room/processor/DatabaseProcessorTest.kt
index bc483ad..be66f51a 100644
--- a/room/room-compiler/src/test/kotlin/androidx/room/processor/DatabaseProcessorTest.kt
+++ b/room/room-compiler/src/test/kotlin/androidx/room/processor/DatabaseProcessorTest.kt
@@ -40,7 +40,7 @@
import androidx.room.testing.context
import androidx.room.vo.Database
import androidx.room.vo.DatabaseView
-import androidx.room.vo.ReadQueryMethod
+import androidx.room.vo.ReadQueryFunction
import androidx.room.vo.Warning
import com.google.auto.service.processor.AutoServiceProcessor
import com.google.testing.junit.testparameterinjector.TestParameter
@@ -247,7 +247,7 @@
USER,
USER_DAO
) { db, _ ->
- assertThat(db.daoMethods.size, `is`(1))
+ assertThat(db.daoFunctions.size, `is`(1))
assertThat(db.entities.size, `is`(1))
}
}
@@ -267,9 +267,12 @@
BOOK,
BOOK_DAO
) { db, _ ->
- assertThat(db.daoMethods.size, `is`(2))
+ assertThat(db.daoFunctions.size, `is`(2))
assertThat(db.entities.size, `is`(2))
- assertThat(db.daoMethods.map { it.element.jvmName }, `is`(listOf("userDao", "bookDao")))
+ assertThat(
+ db.daoFunctions.map { it.element.jvmName },
+ `is`(listOf("userDao", "bookDao"))
+ )
assertThat(
db.entities.map { it.type.asTypeName().toString(CodeLanguage.JAVA) },
`is`(listOf("foo.bar.User", "foo.bar.Book"))
@@ -536,7 +539,7 @@
USER_DAO
) { _, invocation ->
invocation.assertCompilationResult {
- hasErrorContaining(ProcessorErrors.DAO_METHOD_CONFLICTS_WITH_OTHERS)
+ hasErrorContaining(ProcessorErrors.DAO_FUNCTION_CONFLICTS_WITH_OTHERS)
hasErrorContaining(
ProcessorErrors.duplicateDao("foo.bar.UserDao", listOf("userDao", "userDao2"))
)
@@ -924,11 +927,11 @@
USER,
USER_DAO
) { db, _ ->
- val userDao = db.daoMethods.first().dao
- val insertionMethod = userDao.insertMethods.find { it.element.jvmName == "insert" }
+ val userDao = db.daoFunctions.first().dao
+ val insertionMethod = userDao.insertFunctions.find { it.element.jvmName == "insert" }
assertThat(insertionMethod, notNullValue())
val loadOne =
- userDao.queryMethods.filterIsInstance<ReadQueryMethod>().find {
+ userDao.queryFunctions.filterIsInstance<ReadQueryFunction>().find {
it.element.jvmName == "loadOne"
}
assertThat(loadOne, notNullValue())
@@ -941,7 +944,7 @@
)
val withConverter =
- userDao.queryMethods.filterIsInstance<ReadQueryMethod>().find {
+ userDao.queryFunctions.filterIsInstance<ReadQueryFunction>().find {
it.element.jvmName == "loadWithConverter"
}
assertThat(withConverter, notNullValue())
@@ -970,9 +973,9 @@
USER,
USER_DAO
) { db, _ ->
- val userDao = db.daoMethods.first().dao
+ val userDao = db.daoFunctions.first().dao
val loadOne =
- userDao.queryMethods.filterIsInstance<ReadQueryMethod>().find {
+ userDao.queryFunctions.filterIsInstance<ReadQueryFunction>().find {
it.element.jvmName == "loadOneDataClass"
}
assertThat(loadOne, notNullValue())
@@ -981,7 +984,7 @@
val adapterDataClass = (adapter as DataClassRowAdapter).dataClass
val loadAll =
- userDao.queryMethods.filterIsInstance<ReadQueryMethod>().find {
+ userDao.queryFunctions.filterIsInstance<ReadQueryFunction>().find {
it.element.jvmName == "loadAllDataClasses"
}
assertThat(loadAll, notNullValue())
@@ -992,7 +995,7 @@
assertThat(adapterDataClass, sameInstance(loadAllDataClass))
val withConverter =
- userDao.queryMethods.filterIsInstance<ReadQueryMethod>().find {
+ userDao.queryFunctions.filterIsInstance<ReadQueryFunction>().find {
it.element.jvmName == "loadDataClassWithConverter"
}
assertThat(withConverter, notNullValue())
@@ -1261,9 +1264,9 @@
val element = invocation.processingEnv.requireTypeElement("foo.bar.MyDb")
val result =
DatabaseProcessor(baseContext = invocation.context, element = element).process()
- assertThat(result.daoMethods).hasSize(0)
+ assertThat(result.daoFunctions).hasSize(0)
invocation.assertCompilationResult {
- hasErrorContaining(ProcessorErrors.DATABASE_INVALID_DAO_METHOD_RETURN_TYPE)
+ hasErrorContaining(ProcessorErrors.DATABASE_INVALID_DAO_FUNCTION_RETURN_TYPE)
}
}
}
@@ -1598,7 +1601,7 @@
val element = invocation.processingEnv.requireTypeElement("foo.bar.MyDb")
DatabaseProcessor(baseContext = invocation.context, element = element).process()
invocation.assertCompilationResult {
- hasWarningContaining(ProcessorErrors.JVM_NAME_ON_OVERRIDDEN_METHOD)
+ hasWarningContaining(ProcessorErrors.JVM_NAME_ON_OVERRIDDEN_FUNCTION)
}
}
}
diff --git a/room/room-compiler/src/test/kotlin/androidx/room/processor/DeleteMethodProcessorTest.kt b/room/room-compiler/src/test/kotlin/androidx/room/processor/DeleteFunctionProcessorTest.kt
similarity index 83%
rename from room/room-compiler/src/test/kotlin/androidx/room/processor/DeleteMethodProcessorTest.kt
rename to room/room-compiler/src/test/kotlin/androidx/room/processor/DeleteFunctionProcessorTest.kt
index 0a78781..687a758 100644
--- a/room/room-compiler/src/test/kotlin/androidx/room/processor/DeleteMethodProcessorTest.kt
+++ b/room/room-compiler/src/test/kotlin/androidx/room/processor/DeleteFunctionProcessorTest.kt
@@ -20,14 +20,14 @@
import androidx.room.compiler.processing.XType
import androidx.room.processor.ProcessorErrors.CANNOT_FIND_DELETE_RESULT_ADAPTER
import androidx.room.processor.ProcessorErrors.DELETE_MISSING_PARAMS
-import androidx.room.vo.DeleteMethod
+import androidx.room.vo.DeleteFunction
import org.junit.runner.RunWith
import org.junit.runners.JUnit4
@Suppress("PLATFORM_CLASS_MAPPED_TO_KOTLIN")
@RunWith(JUnit4::class)
-class DeleteMethodProcessorTest :
- DeleteOrUpdateShortcutMethodProcessorTest<DeleteMethod>(Delete::class) {
+class DeleteFunctionProcessorTest :
+ DeleteOrUpdateShortcutFunctionProcessorTest<DeleteFunction>(Delete::class) {
override fun invalidReturnTypeError(): String = CANNOT_FIND_DELETE_RESULT_ADAPTER
override fun noParamsError(): String = DELETE_MISSING_PARAMS
@@ -36,7 +36,7 @@
baseContext: Context,
containing: XType,
executableElement: XMethodElement
- ): DeleteMethod {
- return DeleteMethodProcessor(baseContext, containing, executableElement).process()
+ ): DeleteFunction {
+ return DeleteFunctionProcessor(baseContext, containing, executableElement).process()
}
}
diff --git a/room/room-compiler/src/test/kotlin/androidx/room/processor/DeleteOrUpdateShortcutMethodProcessorTest.kt b/room/room-compiler/src/test/kotlin/androidx/room/processor/DeleteOrUpdateShortcutFunctionProcessorTest.kt
similarity index 95%
rename from room/room-compiler/src/test/kotlin/androidx/room/processor/DeleteOrUpdateShortcutMethodProcessorTest.kt
rename to room/room-compiler/src/test/kotlin/androidx/room/processor/DeleteOrUpdateShortcutFunctionProcessorTest.kt
index 8c900a7..2fd3542 100644
--- a/room/room-compiler/src/test/kotlin/androidx/room/processor/DeleteOrUpdateShortcutMethodProcessorTest.kt
+++ b/room/room-compiler/src/test/kotlin/androidx/room/processor/DeleteOrUpdateShortcutFunctionProcessorTest.kt
@@ -37,12 +37,12 @@
import androidx.room.ext.RxJava3TypeNames
import androidx.room.runProcessorTestWithK1
import androidx.room.testing.context
-import androidx.room.vo.DeleteOrUpdateShortcutMethod
+import androidx.room.vo.DeleteOrUpdateShortcutFunction
import kotlin.reflect.KClass
import org.junit.Test
-/** Base test class for shortcut methods. */
-abstract class DeleteOrUpdateShortcutMethodProcessorTest<out T : DeleteOrUpdateShortcutMethod>(
+/** Base test class for shortcut functions. */
+abstract class DeleteOrUpdateShortcutFunctionProcessorTest<out T : DeleteOrUpdateShortcutFunction>(
val annotation: KClass<out Annotation>
) {
companion object {
@@ -113,14 +113,14 @@
@Test
fun singleNullableParamError() {
- singleShortcutMethodKotlin(
+ singleShortcutFunction(
"""
@${annotation.java.canonicalName}
abstract fun foo(user: User?)
"""
) { _, invocation ->
invocation.assertCompilationResult {
- hasErrorContaining(ProcessorErrors.nullableParamInShortcutMethod("foo.bar.User"))
+ hasErrorContaining(ProcessorErrors.nullableParamInShortcutFunction("foo.bar.User"))
}
}
}
@@ -169,14 +169,14 @@
@Test
fun twoNullableParamError() {
- singleShortcutMethodKotlin(
+ singleShortcutFunction(
"""
@${annotation.java.canonicalName}
abstract fun foo(user1: User?, user2: User?)
"""
) { _, invocation ->
invocation.assertCompilationResult {
- hasErrorContaining(ProcessorErrors.nullableParamInShortcutMethod("foo.bar.User"))
+ hasErrorContaining(ProcessorErrors.nullableParamInShortcutFunction("foo.bar.User"))
hasErrorCount(2)
}
}
@@ -224,7 +224,7 @@
@Test
fun nullableListParamError() {
- singleShortcutMethodKotlin(
+ singleShortcutFunction(
"""
@${annotation.java.canonicalName}
abstract fun foo(users: List<User?>)
@@ -232,7 +232,7 @@
) { _, invocation ->
invocation.assertCompilationResult {
hasErrorContaining(
- ProcessorErrors.nullableParamInShortcutMethod(
+ ProcessorErrors.nullableParamInShortcutFunction(
"java.util.List<? extends foo.bar.User>"
)
)
@@ -264,14 +264,16 @@
@Test
fun nullableArrayParamError() {
- singleShortcutMethodKotlin(
+ singleShortcutFunction(
"""
@${annotation.java.canonicalName}
abstract fun foo(users: Array<User?>)
"""
) { _, invocation ->
invocation.assertCompilationResult {
- hasErrorContaining(ProcessorErrors.nullableParamInShortcutMethod("foo.bar.User[]"))
+ hasErrorContaining(
+ ProcessorErrors.nullableParamInShortcutFunction("foo.bar.User[]")
+ )
}
}
}
@@ -302,7 +304,7 @@
@Test
fun nullableSetParamError() {
- singleShortcutMethodKotlin(
+ singleShortcutFunction(
"""
@${annotation.java.canonicalName}
abstract fun foo(users: Set<User?>)
@@ -310,7 +312,7 @@
) { _, invocation ->
invocation.assertCompilationResult {
hasErrorContaining(
- ProcessorErrors.nullableParamInShortcutMethod(
+ ProcessorErrors.nullableParamInShortcutFunction(
"java.util.Set<? extends foo.bar.User>"
)
)
@@ -370,7 +372,7 @@
@Test
fun nullableCustomCollectionParamError() {
- singleShortcutMethodKotlin(
+ singleShortcutFunction(
"""
class MyList<Irrelevant, Item> : ArrayList<Item> {}
@${annotation.java.canonicalName}
@@ -379,7 +381,7 @@
) { _, invocation ->
invocation.assertCompilationResult {
hasErrorContaining(
- ProcessorErrors.nullableParamInShortcutMethod(
+ ProcessorErrors.nullableParamInShortcutFunction(
"foo.bar.MyClass.MyList<java.lang.String, foo.bar.User>"
)
)
@@ -428,15 +430,15 @@
@Test
fun twoNullableDifferentParamError() {
- singleShortcutMethodKotlin(
+ singleShortcutFunction(
"""
@${annotation.java.canonicalName}
abstract fun foo(user1: User?, book1: Book?)
"""
) { _, invocation ->
invocation.assertCompilationResult {
- hasErrorContaining(ProcessorErrors.nullableParamInShortcutMethod("foo.bar.User"))
- hasErrorContaining(ProcessorErrors.nullableParamInShortcutMethod("foo.bar.Book"))
+ hasErrorContaining(ProcessorErrors.nullableParamInShortcutFunction("foo.bar.User"))
+ hasErrorContaining(ProcessorErrors.nullableParamInShortcutFunction("foo.bar.Book"))
hasErrorCount(2)
}
}
@@ -492,7 +494,7 @@
"${KotlinTypeNames.FLOW.canonicalName}<Int>"
)
.forEach { type ->
- singleShortcutMethodKotlin(
+ singleShortcutFunction(
"""
@${annotation.java.canonicalName}
abstract suspend fun foo(user: User): $type
@@ -703,7 +705,7 @@
""",
) { _, invocation ->
invocation.assertCompilationResult {
- hasErrorContaining(ProcessorErrors.shortcutMethodArgumentMustBeAClass("long"))
+ hasErrorContaining(ProcessorErrors.shortcutFunctionArgumentMustBeAClass("long"))
}
}
}
@@ -735,7 +737,7 @@
@Test
fun nonNullVoidGuava() {
- singleShortcutMethodKotlin(
+ singleShortcutFunction(
"""
@${annotation.java.canonicalName}
abstract fun foo(user: User): ListenableFuture<Void>
@@ -799,7 +801,7 @@
}
}
- protected fun singleShortcutMethodKotlin(
+ protected fun singleShortcutFunction(
vararg input: String,
additionalSources: List<Source> = emptyList(),
handler: (T, XTestInvocation) -> Unit
@@ -834,7 +836,7 @@
sources = commonSources + additionalSources + inputSource,
options = mapOf(Context.BooleanProcessorOptions.GENERATE_KOTLIN.argName to "false"),
) { invocation ->
- val (owner, methods) =
+ val (owner, functions) =
invocation.roundEnv
.getElementsAnnotatedWith(Dao::class.qualifiedName!!)
.filterIsInstance<XTypeElement>()
@@ -850,7 +852,7 @@
process(
baseContext = invocation.context,
containing = owner.type,
- executableElement = methods.first()
+ executableElement = functions.first()
)
handler(processed, invocation)
}
diff --git a/room/room-compiler/src/test/kotlin/androidx/room/processor/InsertMethodProcessorTest.kt b/room/room-compiler/src/test/kotlin/androidx/room/processor/InsertFunctionProcessorTest.kt
similarity index 92%
rename from room/room-compiler/src/test/kotlin/androidx/room/processor/InsertMethodProcessorTest.kt
rename to room/room-compiler/src/test/kotlin/androidx/room/processor/InsertFunctionProcessorTest.kt
index 8aba5ee..f44f14b 100644
--- a/room/room-compiler/src/test/kotlin/androidx/room/processor/InsertMethodProcessorTest.kt
+++ b/room/room-compiler/src/test/kotlin/androidx/room/processor/InsertFunctionProcessorTest.kt
@@ -25,15 +25,15 @@
import androidx.room.processor.ProcessorErrors.INSERT_DOES_NOT_HAVE_ANY_PARAMETERS_TO_INSERT
import androidx.room.processor.ProcessorErrors.INSERT_MULTI_PARAM_SINGLE_RETURN_MISMATCH
import androidx.room.processor.ProcessorErrors.INSERT_SINGLE_PARAM_MULTI_RETURN_MISMATCH
-import androidx.room.vo.InsertMethod
+import androidx.room.vo.InsertFunction
import org.junit.Test
import org.junit.runner.RunWith
import org.junit.runners.JUnit4
@Suppress("PLATFORM_CLASS_MAPPED_TO_KOTLIN")
@RunWith(JUnit4::class)
-class InsertMethodProcessorTest :
- InsertOrUpsertShortcutMethodProcessorTest<InsertMethod>(Insert::class) {
+class InsertFunctionProcessorTest :
+ InsertOrUpsertShortcutFunctionProcessorTest<InsertFunction>(Insert::class) {
override fun noParamsError(): String = INSERT_DOES_NOT_HAVE_ANY_PARAMETERS_TO_INSERT
override fun missingPrimaryKey(
@@ -106,7 +106,7 @@
baseContext: Context,
containing: XType,
executableElement: XMethodElement
- ): InsertMethod {
- return InsertMethodProcessor(baseContext, containing, executableElement).process()
+ ): InsertFunction {
+ return InsertFunctionProcessor(baseContext, containing, executableElement).process()
}
}
diff --git a/room/room-compiler/src/test/kotlin/androidx/room/processor/InsertOrUpsertShortcutMethodProcessorTest.kt b/room/room-compiler/src/test/kotlin/androidx/room/processor/InsertOrUpsertShortcutFunctionProcessorTest.kt
similarity index 92%
rename from room/room-compiler/src/test/kotlin/androidx/room/processor/InsertOrUpsertShortcutMethodProcessorTest.kt
rename to room/room-compiler/src/test/kotlin/androidx/room/processor/InsertOrUpsertShortcutFunctionProcessorTest.kt
index 03be0b1..7857656 100644
--- a/room/room-compiler/src/test/kotlin/androidx/room/processor/InsertOrUpsertShortcutMethodProcessorTest.kt
+++ b/room/room-compiler/src/test/kotlin/androidx/room/processor/InsertOrUpsertShortcutFunctionProcessorTest.kt
@@ -36,14 +36,14 @@
import androidx.room.ext.RxJava2TypeNames
import androidx.room.ext.RxJava3TypeNames
import androidx.room.runProcessorTestWithK1
-import androidx.room.solver.shortcut.result.InsertOrUpsertMethodAdapter
+import androidx.room.solver.shortcut.result.InsertOrUpsertFunctionAdapter
import androidx.room.testing.context
-import androidx.room.vo.InsertOrUpsertShortcutMethod
+import androidx.room.vo.InsertOrUpsertShortcutFunction
import kotlin.reflect.KClass
import org.junit.Test
/** Base test class for insert and upsert methods. */
-abstract class InsertOrUpsertShortcutMethodProcessorTest<out T : InsertOrUpsertShortcutMethod>(
+abstract class InsertOrUpsertShortcutFunctionProcessorTest<out T : InsertOrUpsertShortcutFunction>(
val annotation: KClass<out Annotation>
) {
companion object {
@@ -139,14 +139,14 @@
@Test
fun singleNullableParamError() {
- singleInsertUpsertShortcutMethodKotlin(
+ singleInsertUpsertShortcutFunction(
"""
@${annotation.java.canonicalName}
abstract fun foo(user: User?)
"""
) { _, invocation ->
invocation.assertCompilationResult {
- hasErrorContaining(ProcessorErrors.nullableParamInShortcutMethod("foo.bar.User"))
+ hasErrorContaining(ProcessorErrors.nullableParamInShortcutFunction("foo.bar.User"))
}
}
}
@@ -183,14 +183,14 @@
@Test
fun twoNullableParamError() {
- singleInsertUpsertShortcutMethodKotlin(
+ singleInsertUpsertShortcutFunction(
"""
@${annotation.java.canonicalName}
abstract fun foo(user1: User?, user2: User?)
"""
) { _, invocation ->
invocation.assertCompilationResult {
- hasErrorContaining(ProcessorErrors.nullableParamInShortcutMethod("foo.bar.User"))
+ hasErrorContaining(ProcessorErrors.nullableParamInShortcutFunction("foo.bar.User"))
hasErrorCount(2)
}
}
@@ -234,7 +234,7 @@
@Test
fun nullableListParamError() {
- singleInsertUpsertShortcutMethodKotlin(
+ singleInsertUpsertShortcutFunction(
"""
@${annotation.java.canonicalName}
abstract fun foo(users: List<User?>)
@@ -242,7 +242,7 @@
) { _, invocation ->
invocation.assertCompilationResult {
hasErrorContaining(
- ProcessorErrors.nullableParamInShortcutMethod(
+ ProcessorErrors.nullableParamInShortcutFunction(
"java.util.List<? extends foo.bar.User>"
)
)
@@ -278,14 +278,16 @@
@Test
fun nullableArrayParamError() {
- singleInsertUpsertShortcutMethodKotlin(
+ singleInsertUpsertShortcutFunction(
"""
@${annotation.java.canonicalName}
abstract fun foo(users: Array<User?>)
"""
) { _, invocation ->
invocation.assertCompilationResult {
- hasErrorContaining(ProcessorErrors.nullableParamInShortcutMethod("foo.bar.User[]"))
+ hasErrorContaining(
+ ProcessorErrors.nullableParamInShortcutFunction("foo.bar.User[]")
+ )
}
}
}
@@ -320,7 +322,7 @@
@Test
fun nullableSetParamError() {
- singleInsertUpsertShortcutMethodKotlin(
+ singleInsertUpsertShortcutFunction(
"""
@${annotation.java.canonicalName}
abstract fun foo(users: Set<User?>)
@@ -328,7 +330,7 @@
) { _, invocation ->
invocation.assertCompilationResult {
hasErrorContaining(
- ProcessorErrors.nullableParamInShortcutMethod(
+ ProcessorErrors.nullableParamInShortcutFunction(
"java.util.Set<? extends foo.bar.User>"
)
)
@@ -422,7 +424,7 @@
@Test
fun nullableCustomCollectionParamError() {
- singleInsertUpsertShortcutMethodKotlin(
+ singleInsertUpsertShortcutFunction(
"""
class MyList<Irrelevant, Item> : ArrayList<Item> {}
@${annotation.java.canonicalName}
@@ -431,7 +433,7 @@
) { _, invocation ->
invocation.assertCompilationResult {
hasErrorContaining(
- ProcessorErrors.nullableParamInShortcutMethod(
+ ProcessorErrors.nullableParamInShortcutFunction(
"foo.bar.MyClass.MyList<java.lang.String, foo.bar.User>"
)
)
@@ -479,7 +481,7 @@
RxJava3TypeNames.COMPLETABLE.canonicalName
)
.forEach { type ->
- singleInsertUpsertShortcutMethodKotlin(
+ singleInsertUpsertShortcutFunction(
"""
@${annotation.java.canonicalName}
abstract fun bookUserCompletable(user: User, book: Book): $type
@@ -492,15 +494,15 @@
@Test
fun twoNullableDifferentParamError() {
- singleInsertUpsertShortcutMethodKotlin(
+ singleInsertUpsertShortcutFunction(
"""
@${annotation.java.canonicalName}
abstract fun foo(user1: User?, book1: Book?)
"""
) { _, invocation ->
invocation.assertCompilationResult {
- hasErrorContaining(ProcessorErrors.nullableParamInShortcutMethod("foo.bar.User"))
- hasErrorContaining(ProcessorErrors.nullableParamInShortcutMethod("foo.bar.Book"))
+ hasErrorContaining(ProcessorErrors.nullableParamInShortcutFunction("foo.bar.User"))
+ hasErrorContaining(ProcessorErrors.nullableParamInShortcutFunction("foo.bar.Book"))
hasErrorCount(2)
}
}
@@ -524,7 +526,7 @@
abstract public $type foo(User user);
"""
) { insertionUpsertion, invocation ->
- assertThat(insertionUpsertion.methodBinder?.adapter).isNull()
+ assertThat(insertionUpsertion.functionBinder?.adapter).isNull()
invocation.assertCompilationResult { hasErrorContaining(noAdapter()) }
}
@@ -547,7 +549,7 @@
abstract public $type foo(User user);
"""
) { insertionUpsertion, invocation ->
- assertThat(insertionUpsertion.methodBinder?.adapter).isNull()
+ assertThat(insertionUpsertion.functionBinder?.adapter).isNull()
invocation.assertCompilationResult {
hasErrorContaining(singleParamAndMultiReturnMismatchError())
@@ -571,7 +573,7 @@
abstract public $type foo(User... user);
"""
) { insertionUpsertion, invocation ->
- assertThat(insertionUpsertion.methodBinder?.adapter).isNull()
+ assertThat(insertionUpsertion.functionBinder?.adapter).isNull()
invocation.assertCompilationResult {
hasErrorContaining(multiParamAndSingleReturnMismatchError())
@@ -595,7 +597,7 @@
abstract public $type foo(User user1, User user2);
"""
) { insertionUpsertion, invocation ->
- assertThat(insertionUpsertion.methodBinder?.adapter).isNull()
+ assertThat(insertionUpsertion.functionBinder?.adapter).isNull()
invocation.assertCompilationResult { hasErrorContaining(noAdapter()) }
}
@@ -605,50 +607,50 @@
@Test
fun validReturnTypes() {
listOf(
- Pair("void", InsertOrUpsertMethodAdapter.ReturnInfo.VOID),
- Pair("long", InsertOrUpsertMethodAdapter.ReturnInfo.SINGLE_ID),
- Pair("long[]", InsertOrUpsertMethodAdapter.ReturnInfo.ID_ARRAY),
- Pair("Long[]", InsertOrUpsertMethodAdapter.ReturnInfo.ID_ARRAY_BOX),
- Pair("List<Long>", InsertOrUpsertMethodAdapter.ReturnInfo.ID_LIST),
+ Pair("void", InsertOrUpsertFunctionAdapter.ReturnInfo.VOID),
+ Pair("long", InsertOrUpsertFunctionAdapter.ReturnInfo.SINGLE_ID),
+ Pair("long[]", InsertOrUpsertFunctionAdapter.ReturnInfo.ID_ARRAY),
+ Pair("Long[]", InsertOrUpsertFunctionAdapter.ReturnInfo.ID_ARRAY_BOX),
+ Pair("List<Long>", InsertOrUpsertFunctionAdapter.ReturnInfo.ID_LIST),
Pair(
RxJava2TypeNames.COMPLETABLE.canonicalName,
- InsertOrUpsertMethodAdapter.ReturnInfo.VOID_OBJECT
+ InsertOrUpsertFunctionAdapter.ReturnInfo.VOID_OBJECT
),
Pair(
"${RxJava2TypeNames.SINGLE.canonicalName}<Long>",
- InsertOrUpsertMethodAdapter.ReturnInfo.SINGLE_ID
+ InsertOrUpsertFunctionAdapter.ReturnInfo.SINGLE_ID
),
Pair(
"${RxJava2TypeNames.SINGLE.canonicalName}<List<Long>>",
- InsertOrUpsertMethodAdapter.ReturnInfo.ID_LIST
+ InsertOrUpsertFunctionAdapter.ReturnInfo.ID_LIST
),
Pair(
"${RxJava2TypeNames.MAYBE.canonicalName}<Long>",
- InsertOrUpsertMethodAdapter.ReturnInfo.SINGLE_ID
+ InsertOrUpsertFunctionAdapter.ReturnInfo.SINGLE_ID
),
Pair(
"${RxJava2TypeNames.MAYBE.canonicalName}<List<Long>>",
- InsertOrUpsertMethodAdapter.ReturnInfo.ID_LIST
+ InsertOrUpsertFunctionAdapter.ReturnInfo.ID_LIST
),
Pair(
RxJava3TypeNames.COMPLETABLE.canonicalName,
- InsertOrUpsertMethodAdapter.ReturnInfo.VOID_OBJECT
+ InsertOrUpsertFunctionAdapter.ReturnInfo.VOID_OBJECT
),
Pair(
"${RxJava3TypeNames.SINGLE.canonicalName}<Long>",
- InsertOrUpsertMethodAdapter.ReturnInfo.SINGLE_ID
+ InsertOrUpsertFunctionAdapter.ReturnInfo.SINGLE_ID
),
Pair(
"${RxJava3TypeNames.SINGLE.canonicalName}<List<Long>>",
- InsertOrUpsertMethodAdapter.ReturnInfo.ID_LIST
+ InsertOrUpsertFunctionAdapter.ReturnInfo.ID_LIST
),
Pair(
"${RxJava3TypeNames.MAYBE.canonicalName}<Long>",
- InsertOrUpsertMethodAdapter.ReturnInfo.SINGLE_ID
+ InsertOrUpsertFunctionAdapter.ReturnInfo.SINGLE_ID
),
Pair(
"${RxJava3TypeNames.MAYBE.canonicalName}<List<Long>>",
- InsertOrUpsertMethodAdapter.ReturnInfo.ID_LIST
+ InsertOrUpsertFunctionAdapter.ReturnInfo.ID_LIST
)
)
.forEach { pair ->
@@ -656,9 +658,9 @@
if (
pair.second in
setOf(
- InsertOrUpsertMethodAdapter.ReturnInfo.ID_LIST,
- InsertOrUpsertMethodAdapter.ReturnInfo.ID_ARRAY,
- InsertOrUpsertMethodAdapter.ReturnInfo.ID_ARRAY_BOX
+ InsertOrUpsertFunctionAdapter.ReturnInfo.ID_LIST,
+ InsertOrUpsertFunctionAdapter.ReturnInfo.ID_ARRAY,
+ InsertOrUpsertFunctionAdapter.ReturnInfo.ID_ARRAY_BOX
)
) {
"..."
@@ -671,7 +673,7 @@
abstract public ${pair.first} foo(User$dots user);
"""
) { insertionUpsertion, _ ->
- assertThat(insertionUpsertion.methodBinder?.adapter).isNotNull()
+ assertThat(insertionUpsertion.functionBinder?.adapter).isNotNull()
}
}
}
@@ -1091,7 +1093,7 @@
"${KotlinTypeNames.FLOW.canonicalName}<Int>"
)
.forEach { type ->
- singleInsertUpsertShortcutMethodKotlin(
+ singleInsertUpsertShortcutFunction(
"""
@${annotation.java.canonicalName}
abstract suspend fun foo(user: User): $type
@@ -1107,7 +1109,7 @@
@Test
fun nonNullVoidGuava() {
- singleInsertUpsertShortcutMethodKotlin(
+ singleInsertUpsertShortcutFunction(
"""
@${annotation.java.canonicalName}
abstract fun foo(user: User): ListenableFuture<Void>
@@ -1168,7 +1170,7 @@
}
}
- protected fun singleInsertUpsertShortcutMethodKotlin(
+ protected fun singleInsertUpsertShortcutFunction(
vararg input: String,
additionalSources: List<Source> = emptyList(),
handler: (T, XTestInvocation) -> Unit
@@ -1202,7 +1204,7 @@
sources = commonSources + additionalSources + inputSource,
options = mapOf(Context.BooleanProcessorOptions.GENERATE_KOTLIN.argName to "false"),
) { invocation ->
- val (owner, methods) =
+ val (owner, functions) =
invocation.roundEnv
.getElementsAnnotatedWith(Dao::class.qualifiedName!!)
.filterIsInstance<XTypeElement>()
@@ -1217,7 +1219,7 @@
process(
baseContext = invocation.context,
containing = owner.type,
- executableElement = methods.first()
+ executableElement = functions.first()
)
handler(processed, invocation)
}
diff --git a/room/room-compiler/src/test/kotlin/androidx/room/processor/QueryMethodProcessorTest.kt b/room/room-compiler/src/test/kotlin/androidx/room/processor/QueryFunctionProcessorTest.kt
similarity index 94%
rename from room/room-compiler/src/test/kotlin/androidx/room/processor/QueryMethodProcessorTest.kt
rename to room/room-compiler/src/test/kotlin/androidx/room/processor/QueryFunctionProcessorTest.kt
index d00ef58..10f2366 100644
--- a/room/room-compiler/src/test/kotlin/androidx/room/processor/QueryMethodProcessorTest.kt
+++ b/room/room-compiler/src/test/kotlin/androidx/room/processor/QueryFunctionProcessorTest.kt
@@ -54,10 +54,10 @@
import androidx.room.solver.query.result.SingleItemQueryResultAdapter
import androidx.room.testing.context
import androidx.room.vo.Field
-import androidx.room.vo.QueryMethod
-import androidx.room.vo.ReadQueryMethod
+import androidx.room.vo.QueryFunction
+import androidx.room.vo.ReadQueryFunction
import androidx.room.vo.Warning
-import androidx.room.vo.WriteQueryMethod
+import androidx.room.vo.WriteQueryFunction
import createVerifierFromEntitiesAndViews
import mockElementAndType
import org.junit.AssumptionViolatedException
@@ -67,7 +67,7 @@
import org.mockito.Mockito
@RunWith(Parameterized::class)
-class QueryMethodProcessorTest(private val enableVerification: Boolean) {
+class QueryFunctionProcessorTest(private val enableVerification: Boolean) {
companion object {
const val DAO_PREFIX =
"""
@@ -115,7 +115,7 @@
@Test
fun testReadNoParams() {
- singleQueryMethod<ReadQueryMethod>(
+ singleQueryMethod<ReadQueryFunction>(
"""
@Query("SELECT uid from User")
abstract public int[] foo();
@@ -130,7 +130,7 @@
@Test
fun testSingleParam() {
- singleQueryMethod<ReadQueryMethod>(
+ singleQueryMethod<ReadQueryFunction>(
"""
@Query("SELECT * from User where uid = :x")
abstract public long foo(int x);
@@ -149,7 +149,7 @@
@Test
fun testVarArgs() {
- singleQueryMethod<ReadQueryMethod>(
+ singleQueryMethod<ReadQueryFunction>(
"""
@Query("SELECT * from User where uid in (:ids)")
abstract public long foo(int... ids);
@@ -168,7 +168,7 @@
@Test
fun testParamBindingMatchingNoName() {
- singleQueryMethod<ReadQueryMethod>(
+ singleQueryMethod<ReadQueryFunction>(
"""
@Query("SELECT uid from User where uid = :id")
abstract public long getIdById(int id);
@@ -184,7 +184,7 @@
@Test
fun testParamBindingMatchingSimpleBind() {
- singleQueryMethod<ReadQueryMethod>(
+ singleQueryMethod<ReadQueryFunction>(
"""
@Query("SELECT uid from User where uid = :id")
abstract public long getIdById(int id);
@@ -200,7 +200,7 @@
@Test
fun testParamBindingTwoBindVarsIntoTheSameParameter() {
- singleQueryMethod<ReadQueryMethod>(
+ singleQueryMethod<ReadQueryFunction>(
"""
@Query("SELECT uid from User where uid = :id OR uid = :id")
abstract public long getIdById(int id);
@@ -219,7 +219,7 @@
@Test
fun testMissingParameterForBinding() {
- singleQueryMethod<ReadQueryMethod>(
+ singleQueryMethod<ReadQueryFunction>(
"""
@Query("SELECT uid from User where uid = :id OR uid = :uid")
abstract public long getIdById(int id);
@@ -241,7 +241,7 @@
@Test
fun test2MissingParameterForBinding() {
- singleQueryMethod<ReadQueryMethod>(
+ singleQueryMethod<ReadQueryFunction>(
"""
@Query("SELECT uid from User where name = :bar AND uid = :id OR uid = :uid")
abstract public long getIdById(int id);
@@ -268,7 +268,7 @@
@Test
fun testUnusedParameters() {
- singleQueryMethod<ReadQueryMethod>(
+ singleQueryMethod<ReadQueryFunction>(
"""
@Query("SELECT uid from User where name = :bar")
abstract public long getIdById(int bar, int whyNotUseMe);
@@ -281,7 +281,7 @@
assertThat(parsedQuery.sectionToParamMapping).containsExactly(bar to barParam)
invocation.assertCompilationResult {
hasErrorContaining(
- ProcessorErrors.unusedQueryMethodParameter(listOf("whyNotUseMe"))
+ ProcessorErrors.unusedQueryFunctionParameter(listOf("whyNotUseMe"))
)
}
}
@@ -289,7 +289,7 @@
@Test
fun testNameWithUnderscore() {
- singleQueryMethod<ReadQueryMethod>(
+ singleQueryMethod<ReadQueryFunction>(
"""
@Query("select * from User where uid = :_blah")
abstract public long getSth(int _blah);
@@ -303,7 +303,7 @@
@Test
fun testGenericReturnType() {
- singleQueryMethod<ReadQueryMethod>(
+ singleQueryMethod<ReadQueryFunction>(
"""
@Query("select * from User")
abstract public <T> ${LIST.canonicalName}<T> foo(int x);
@@ -320,14 +320,14 @@
.copy(nullable = true)
assertThat(parsedQuery.returnType.asTypeName()).isEqualTo(expected)
invocation.assertCompilationResult {
- hasErrorContaining(ProcessorErrors.CANNOT_USE_UNBOUND_GENERICS_IN_QUERY_METHODS)
+ hasErrorContaining(ProcessorErrors.CANNOT_USE_UNBOUND_GENERICS_IN_QUERY_FUNCTIONS)
}
}
}
@Test
fun testBadQuery() {
- singleQueryMethod<ReadQueryMethod>(
+ singleQueryMethod<ReadQueryFunction>(
"""
@Query("select * from :1 :2")
abstract public long foo(int x);
@@ -340,7 +340,7 @@
@Test
fun testLiveDataWithWithClause() {
- singleQueryMethod<ReadQueryMethod>(
+ singleQueryMethod<ReadQueryFunction>(
"""
@Query("WITH RECURSIVE tempTable(n, fact) AS (SELECT 0, 1 UNION ALL SELECT n+1,"
+ " (n+1)*fact FROM tempTable WHERE n < 9) SELECT fact FROM tempTable, User")
@@ -356,7 +356,7 @@
@Test
fun testLiveDataWithNothingToObserve() {
- singleQueryMethod<ReadQueryMethod>(
+ singleQueryMethod<ReadQueryFunction>(
"""
@Query("SELECT 1")
abstract public ${LifecyclesTypeNames.LIVE_DATA.canonicalName}<Integer> getOne();
@@ -370,7 +370,7 @@
@Test
fun testLiveDataWithWithClauseAndNothingToObserve() {
- singleQueryMethod<ReadQueryMethod>(
+ singleQueryMethod<ReadQueryFunction>(
"""
@Query("WITH RECURSIVE tempTable(n, fact) AS (SELECT 0, 1 UNION ALL SELECT n+1,"
+ " (n+1)*fact FROM tempTable WHERE n < 9) SELECT fact FROM tempTable")
@@ -386,7 +386,7 @@
@Test
fun testBoundGeneric() {
- singleQueryMethod<ReadQueryMethod>(
+ singleQueryMethod<ReadQueryFunction>(
"""
static abstract class BaseModel<T> {
@Query("select COUNT(*) from User")
@@ -404,7 +404,7 @@
@Test
fun testBoundGenericParameter() {
- singleQueryMethod<ReadQueryMethod>(
+ singleQueryMethod<ReadQueryFunction>(
"""
static abstract class BaseModel<T> {
@Query("select COUNT(*) from User where :t")
@@ -422,7 +422,7 @@
@Test
fun testReadDeleteWithBadReturnType() {
- singleQueryMethod<WriteQueryMethod>(
+ singleQueryMethod<WriteQueryFunction>(
"""
@Query("DELETE from User where uid = :id")
abstract public float foo(int id);
@@ -438,7 +438,7 @@
@Test
fun testSimpleDelete() {
- singleQueryMethod<WriteQueryMethod>(
+ singleQueryMethod<WriteQueryFunction>(
"""
@Query("DELETE from User where uid = :id")
abstract public int foo(int id);
@@ -452,7 +452,7 @@
@Test
fun testVoidDeleteQuery() {
- singleQueryMethod<WriteQueryMethod>(
+ singleQueryMethod<WriteQueryFunction>(
"""
@Query("DELETE from User where uid = :id")
abstract public void foo(int id);
@@ -466,7 +466,7 @@
@Test
fun testVoidUpdateQuery() {
- singleQueryMethod<WriteQueryMethod>(
+ singleQueryMethod<WriteQueryFunction>(
"""
@Query("update user set name = :name")
abstract public void updateAllNames(String name);
@@ -482,7 +482,7 @@
@Test
fun testVoidInsertQuery() {
- singleQueryMethod<WriteQueryMethod>(
+ singleQueryMethod<WriteQueryFunction>(
"""
@Query("insert into user (name) values (:name)")
abstract public void insertUsername(String name);
@@ -498,7 +498,7 @@
@Test
fun testLongInsertQuery() {
- singleQueryMethod<WriteQueryMethod>(
+ singleQueryMethod<WriteQueryFunction>(
"""
@Query("insert into user (name) values (:name)")
abstract public long insertUsername(String name);
@@ -514,7 +514,7 @@
@Test
fun testInsertQueryWithBadReturnType() {
- singleQueryMethod<WriteQueryMethod>(
+ singleQueryMethod<WriteQueryFunction>(
"""
@Query("insert into user (name) values (:name)")
abstract public int insert(String name);
@@ -531,7 +531,7 @@
@Test
fun testLiveDataQuery() {
- singleQueryMethod<ReadQueryMethod>(
+ singleQueryMethod<ReadQueryFunction>(
"""
@Query("select name from user where uid = :id")
abstract ${LifecyclesTypeNames.LIVE_DATA.canonicalName}<String> nameLiveData(String id);
@@ -549,7 +549,7 @@
@Test
fun testBadReturnForDeleteQuery() {
- singleQueryMethod<WriteQueryMethod>(
+ singleQueryMethod<WriteQueryFunction>(
"""
@Query("delete from user where uid = :id")
abstract ${LifecyclesTypeNames.LIVE_DATA.canonicalName}<Integer> deleteLiveData(String id);
@@ -568,7 +568,7 @@
@Test
fun testBadReturnForUpdateQuery() {
- singleQueryMethod<WriteQueryMethod>(
+ singleQueryMethod<WriteQueryFunction>(
"""
@Query("update user set name = :name")
abstract ${LifecyclesTypeNames.LIVE_DATA.canonicalName}<Integer> updateNameLiveData(String name);
@@ -587,7 +587,7 @@
@Test
fun testDataSourceFactoryQuery() {
- singleQueryMethod<ReadQueryMethod>(
+ singleQueryMethod<ReadQueryFunction>(
"""
@Query("select name from user")
abstract ${PagingTypeNames.DATA_SOURCE_FACTORY.canonicalName}<Integer, String>
@@ -615,7 +615,7 @@
@Test
fun testMultiTableDataSourceFactoryQuery() {
- singleQueryMethod<ReadQueryMethod>(
+ singleQueryMethod<ReadQueryFunction>(
"""
@Query("select name from User u LEFT OUTER JOIN Book b ON u.uid == b.uid")
abstract ${PagingTypeNames.DATA_SOURCE_FACTORY.canonicalName}<Integer, String>
@@ -642,7 +642,7 @@
@Test
fun testBadChannelReturnForQuery() {
- singleQueryMethod<QueryMethod>(
+ singleQueryMethod<QueryFunction>(
"""
@Query("select * from user")
abstract ${KotlinTypeNames.CHANNEL.canonicalName}<User> getUsersChannel();
@@ -659,7 +659,7 @@
@Test
fun testBadSendChannelReturnForQuery() {
- singleQueryMethod<QueryMethod>(
+ singleQueryMethod<QueryFunction>(
"""
@Query("select * from user")
abstract ${KotlinTypeNames.SEND_CHANNEL.canonicalName}<User> getUsersChannel();
@@ -676,7 +676,7 @@
@Test
fun testBadReceiveChannelReturnForQuery() {
- singleQueryMethod<QueryMethod>(
+ singleQueryMethod<QueryFunction>(
"""
@Query("select * from user")
abstract ${KotlinTypeNames.RECEIVE_CHANNEL.canonicalName}<User> getUsersChannel();
@@ -695,7 +695,7 @@
@Test
fun query_detectTransaction_select() {
- singleQueryMethod<ReadQueryMethod>(
+ singleQueryMethod<ReadQueryFunction>(
"""
@Query("select * from user")
abstract int loadUsers();
@@ -707,7 +707,7 @@
@Test
fun query_detectTransaction_selectInTransaction() {
- singleQueryMethod<ReadQueryMethod>(
+ singleQueryMethod<ReadQueryFunction>(
"""
@Transaction
@Query("select * from user")
@@ -720,7 +720,7 @@
@Test
fun skipVerification() {
- singleQueryMethod<ReadQueryMethod>(
+ singleQueryMethod<ReadQueryFunction>(
"""
@SkipQueryVerification
@Query("SELECT foo from User")
@@ -736,7 +736,7 @@
@Test
fun skipVerificationDataClass() {
- singleQueryMethod<ReadQueryMethod>(
+ singleQueryMethod<ReadQueryFunction>(
"""
@SkipQueryVerification
@Query("SELECT bookId, uid FROM User")
@@ -758,7 +758,7 @@
@Test
fun suppressWarnings() {
- singleQueryMethod<ReadQueryMethod>(
+ singleQueryMethod<ReadQueryFunction>(
"""
@SuppressWarnings(RoomWarnings.QUERY_MISMATCH)
@Query("SELECT uid from User")
@@ -766,7 +766,7 @@
"""
) { method, invocation ->
assertThat(
- QueryMethodProcessor(
+ QueryFunctionProcessor(
baseContext = invocation.context,
containing = Mockito.mock(XType::class.java),
executableElement = method.element,
@@ -785,7 +785,7 @@
if (!enableVerification) {
return
}
- singleQueryMethod<ReadQueryMethod>(
+ singleQueryMethod<ReadQueryFunction>(
"""
static class Merged extends User {
@Relation(parentColumn = "name", entityColumn = "lastName",
@@ -865,7 +865,7 @@
if (!enableVerification) {
throw AssumptionViolatedException("nothing to test w/o db verification")
}
- singleQueryMethod<ReadQueryMethod>(
+ singleQueryMethod<ReadQueryFunction>(
"""
@RewriteQueriesToDropUnusedColumns
@Query("select 1 from user")
@@ -884,7 +884,7 @@
if (!enableVerification) {
throw AssumptionViolatedException("nothing to test w/o db verification")
}
- singleQueryMethod<ReadQueryMethod>(
+ singleQueryMethod<ReadQueryFunction>(
"""
public static class DataClass {
public String name;
@@ -923,7 +923,7 @@
"""
.trimIndent()
)
- singleQueryMethod<ReadQueryMethod>(
+ singleQueryMethod<ReadQueryFunction>(
"""
public static class Username {
public String name;
@@ -960,7 +960,7 @@
if (!enableVerification) {
throw AssumptionViolatedException("nothing to test w/o db verification")
}
- singleQueryMethod<ReadQueryMethod>(
+ singleQueryMethod<ReadQueryFunction>(
"""
public static class DataClass {
public String name;
@@ -1190,9 +1190,9 @@
dataClassFields: String,
queryColumns: List<String>,
options: Map<String, String> = emptyMap(),
- handler: (DataClassRowAdapter?, QueryMethod, XTestInvocation) -> Unit
+ handler: (DataClassRowAdapter?, QueryFunction, XTestInvocation) -> Unit
) {
- singleQueryMethod<ReadQueryMethod>(
+ singleQueryMethod<ReadQueryFunction>(
"""
static class DataClass {
$dataClassFields
@@ -1219,7 +1219,7 @@
}
}
- private fun <T : QueryMethod> singleQueryMethod(
+ private fun <T : QueryFunction> singleQueryMethod(
vararg input: String,
additionalSources: Iterable<Source> = emptyList(),
options: Map<String, String> = emptyMap(),
@@ -1269,7 +1269,7 @@
null
}
val parser =
- QueryMethodProcessor(
+ QueryFunctionProcessor(
baseContext = invocation.context,
containing = owner.type,
executableElement = methods.first(),
@@ -1280,7 +1280,7 @@
}
}
- private fun <T : QueryMethod> singleQueryMethodKotlin(
+ private fun <T : QueryFunction> singleQueryFunction(
vararg input: String,
additionalSources: Iterable<Source> = emptyList(),
options: Map<String, String> = emptyMap(),
@@ -1339,7 +1339,7 @@
null
}
val parser =
- QueryMethodProcessor(
+ QueryFunctionProcessor(
baseContext = invocation.context,
containing = owner.type,
executableElement = methods.first(),
@@ -1352,7 +1352,7 @@
@Test
fun testInvalidLinkedListCollectionInMultimapJoin() {
- singleQueryMethod<ReadQueryMethod>(
+ singleQueryMethod<ReadQueryFunction>(
"""
@Query("select * from User u JOIN Book b ON u.uid == b.uid")
abstract Map<User, LinkedList<Book>> getInvalidCollectionMultimap();
@@ -1362,7 +1362,7 @@
hasErrorCount(2)
hasErrorContaining("Multimap 'value' collection type must be a List, Set or Map.")
hasErrorContaining(
- "Not sure how to convert the query result to this method's return type"
+ "Not sure how to convert the query result to this function's return type"
)
}
}
@@ -1370,7 +1370,7 @@
@Test
fun testInvalidGenericMultimapJoin() {
- singleQueryMethod<ReadQueryMethod>(
+ singleQueryMethod<ReadQueryFunction>(
"""
@Query("select * from User u JOIN Book b ON u.uid == b.uid")
abstract com.google.common.collect.ImmutableMultimap<User, Book>
@@ -1381,7 +1381,7 @@
hasErrorCount(2)
hasErrorContaining(DO_NOT_USE_GENERIC_IMMUTABLE_MULTIMAP)
hasErrorContaining(
- "Not sure how to convert the query result to this method's return type"
+ "Not sure how to convert the query result to this function's return type"
)
}
}
@@ -1392,7 +1392,7 @@
if (!enableVerification) {
return
}
- singleQueryMethod<ReadQueryMethod>(
+ singleQueryMethod<ReadQueryFunction>(
"""
@MapInfo
@Query("select * from User u JOIN Book b ON u.uid == b.uid")
@@ -1411,7 +1411,7 @@
if (!enableVerification) {
return
}
- singleQueryMethod<ReadQueryMethod>(
+ singleQueryMethod<ReadQueryFunction>(
"""
@SuppressWarnings(
{RoomWarnings.QUERY_MISMATCH, RoomWarnings.AMBIGUOUS_COLUMN_IN_RESULT}
@@ -1430,7 +1430,7 @@
if (!enableVerification) {
return
}
- singleQueryMethod<ReadQueryMethod>(
+ singleQueryMethod<ReadQueryFunction>(
"""
@SuppressWarnings(
{RoomWarnings.QUERY_MISMATCH, RoomWarnings.AMBIGUOUS_COLUMN_IN_RESULT}
@@ -1449,7 +1449,7 @@
if (!enableVerification) {
return
}
- singleQueryMethod<ReadQueryMethod>(
+ singleQueryMethod<ReadQueryFunction>(
"""
@SuppressWarnings(RoomWarnings.QUERY_MISMATCH)
@MapInfo(keyColumn = "name", valueColumn = "bookCount")
@@ -1467,7 +1467,7 @@
if (!enableVerification) {
return
}
- singleQueryMethod<ReadQueryMethod>(
+ singleQueryMethod<ReadQueryFunction>(
"""
@SuppressWarnings(
{RoomWarnings.QUERY_MISMATCH, RoomWarnings.AMBIGUOUS_COLUMN_IN_RESULT}
@@ -1485,7 +1485,7 @@
if (!enableVerification) {
return
}
- singleQueryMethod<ReadQueryMethod>(
+ singleQueryMethod<ReadQueryFunction>(
"""
@SuppressWarnings(
{RoomWarnings.QUERY_MISMATCH, RoomWarnings.AMBIGUOUS_COLUMN_IN_RESULT}
@@ -1508,7 +1508,7 @@
if (!enableVerification) {
return
}
- singleQueryMethod<ReadQueryMethod>(
+ singleQueryMethod<ReadQueryFunction>(
"""
@SuppressWarnings(
{RoomWarnings.QUERY_MISMATCH, RoomWarnings.AMBIGUOUS_COLUMN_IN_RESULT}
@@ -1526,7 +1526,7 @@
if (!enableVerification) {
return
}
- singleQueryMethod<ReadQueryMethod>(
+ singleQueryMethod<ReadQueryFunction>(
"""
@SuppressWarnings(
{RoomWarnings.QUERY_MISMATCH, RoomWarnings.AMBIGUOUS_COLUMN_IN_RESULT}
@@ -1544,7 +1544,7 @@
if (!enableVerification) {
return
}
- singleQueryMethod<ReadQueryMethod>(
+ singleQueryMethod<ReadQueryFunction>(
"""
@SuppressWarnings(RoomWarnings.QUERY_MISMATCH)
@Query("SELECT name, (SELECT count(*) FROM User u JOIN Book b ON u.uid == b.uid) "
@@ -1561,7 +1561,7 @@
if (!enableVerification) {
return
}
- singleQueryMethod<ReadQueryMethod>(
+ singleQueryMethod<ReadQueryFunction>(
"""
@SuppressWarnings(
{RoomWarnings.QUERY_MISMATCH, RoomWarnings.AMBIGUOUS_COLUMN_IN_RESULT}
@@ -1579,7 +1579,7 @@
@Test
fun testDoesNotImplementEqualsAndHashcodeQuery() {
- singleQueryMethod<ReadQueryMethod>(
+ singleQueryMethod<ReadQueryFunction>(
"""
@Query("select * from User u JOIN Book b ON u.uid == b.uid")
abstract Map<User, Book> getMultimap();
@@ -1596,7 +1596,7 @@
@Test
fun testMissingMapInfoOneToOneString() {
- singleQueryMethod<ReadQueryMethod>(
+ singleQueryMethod<ReadQueryFunction>(
"""
@Query("select * from Artist JOIN Song ON Artist.mArtistName == Song.mArtist")
abstract Map<Artist, String> getAllArtistsWithAlbumCoverYear();
@@ -1610,7 +1610,7 @@
@Test
fun testOneToOneStringMapInfoForKeyInsteadOfColumn() {
- singleQueryMethod<ReadQueryMethod>(
+ singleQueryMethod<ReadQueryFunction>(
"""
@MapInfo(keyColumn = "mArtistName")
@Query("select * from Artist JOIN Song ON Artist.mArtistName == Song.mArtist")
@@ -1625,7 +1625,7 @@
@Test
fun testMissingMapInfoOneToManyString() {
- singleQueryMethod<ReadQueryMethod>(
+ singleQueryMethod<ReadQueryFunction>(
"""
@Query("select * from Artist JOIN Song ON Artist.mArtistName == Song.mArtist")
abstract Map<Artist, List<String>> getAllArtistsWithAlbumCoverYear();
@@ -1639,7 +1639,7 @@
@Test
fun testMissingMapInfoImmutableListMultimapOneToOneString() {
- singleQueryMethod<ReadQueryMethod>(
+ singleQueryMethod<ReadQueryFunction>(
"""
@Query("select * from Artist JOIN Song ON Artist.mArtistName == Song.mArtist")
abstract ImmutableListMultimap<Artist, String> getAllArtistsWithAlbumCoverYear();
@@ -1653,7 +1653,7 @@
@Test
fun testMissingMapInfoOneToOneLong() {
- singleQueryMethod<ReadQueryMethod>(
+ singleQueryMethod<ReadQueryFunction>(
"""
@Query("SELECT * FROM Artist JOIN Image ON Artist.mArtistName = Image.mArtistInImage")
Map<Artist, Long> getAllArtistsWithAlbumCoverYear();
@@ -1667,7 +1667,7 @@
@Test
fun testMissingMapInfoOneToManyLong() {
- singleQueryMethod<ReadQueryMethod>(
+ singleQueryMethod<ReadQueryFunction>(
"""
@Query("SELECT * FROM Artist JOIN Image ON Artist.mArtistName = Image.mArtistInImage")
Map<Artist, Set<Long>> getAllArtistsWithAlbumCoverYear();
@@ -1681,7 +1681,7 @@
@Test
fun testMissingMapInfoImmutableListMultimapOneToOneLong() {
- singleQueryMethod<ReadQueryMethod>(
+ singleQueryMethod<ReadQueryFunction>(
"""
@Query("SELECT * FROM Artist JOIN Image ON Artist.mArtistName = Image.mArtistInImage")
ImmutableListMultimap<Artist, Long> getAllArtistsWithAlbumCoverYear();
@@ -1695,7 +1695,7 @@
@Test
fun testMissingMapInfoImmutableListMultimapOneToOneTypeConverterKey() {
- singleQueryMethod<ReadQueryMethod>(
+ singleQueryMethod<ReadQueryFunction>(
"""
@TypeConverters(DateConverter.class)
@Query("SELECT * FROM Image JOIN Artist ON Artist.mArtistName = Image.mArtistInImage")
@@ -1710,7 +1710,7 @@
@Test
fun testMissingMapInfoImmutableListMultimapOneToOneTypeConverterValue() {
- singleQueryMethod<ReadQueryMethod>(
+ singleQueryMethod<ReadQueryFunction>(
"""
@TypeConverters(DateConverter.class)
@Query("SELECT * FROM Artist JOIN Image ON Artist.mArtistName = Image.mArtistInImage")
@@ -1728,7 +1728,7 @@
if (!enableVerification) {
return
}
- singleQueryMethod<ReadQueryMethod>(
+ singleQueryMethod<ReadQueryFunction>(
"""
@MapInfo(keyColumn="cat", valueColumn="dog")
@Query("select * from User u JOIN Book b ON u.uid == b.uid")
@@ -1759,7 +1759,7 @@
// No warning without verification, avoiding false positives
return
}
- singleQueryMethod<ReadQueryMethod>(
+ singleQueryMethod<ReadQueryFunction>(
"""
@SuppressWarnings(RoomWarnings.QUERY_MISMATCH)
@MapInfo(keyColumn = "uid")
@@ -1806,7 +1806,7 @@
"""
.trimIndent()
)
- singleQueryMethod<ReadQueryMethod>(
+ singleQueryMethod<ReadQueryFunction>(
"""
@SuppressWarnings(RoomWarnings.QUERY_MISMATCH)
@Query("SELECT * FROM User u JOIN Book b ON u.uid == b.uid")
@@ -1846,7 +1846,7 @@
"${KotlinTypeNames.FLOW.canonicalName}<Int>"
)
.forEach { type ->
- singleQueryMethodKotlin<WriteQueryMethod>(
+ singleQueryFunction<WriteQueryFunction>(
"""
@Query("DELETE from User where uid = :id")
abstract suspend fun foo(id: Int): $type
@@ -1862,7 +1862,7 @@
@Test
fun nonNullVoidGuava() {
- singleQueryMethodKotlin<WriteQueryMethod>(
+ singleQueryFunction<WriteQueryFunction>(
"""
@Query("DELETE from User where uid = :id")
abstract fun foo(id: Int): ListenableFuture<Void>
@@ -1874,7 +1874,7 @@
@Test
fun maybe() {
- singleQueryMethodKotlin<ReadQueryMethod>(
+ singleQueryFunction<ReadQueryFunction>(
"""
@Query("SELECT * FROM book WHERE bookId = :bookId")
abstract fun getBookMaybe(bookId: String): io.reactivex.Maybe<Book>
@@ -1886,7 +1886,7 @@
@Test
fun single() {
- singleQueryMethodKotlin<ReadQueryMethod>(
+ singleQueryFunction<ReadQueryFunction>(
"""
@Query("SELECT * FROM book WHERE bookId = :bookId")
abstract fun getBookSingle(bookId: String): io.reactivex.Single<Book>
@@ -1901,7 +1901,7 @@
if (!enableVerification) {
return
}
- singleQueryMethod<ReadQueryMethod>(
+ singleQueryMethod<ReadQueryFunction>(
"""
@Query("select * from User")
abstract String[] stringArray();
@@ -1920,7 +1920,7 @@
if (!enableVerification) {
return
}
- singleQueryMethod<ReadQueryMethod>(
+ singleQueryMethod<ReadQueryFunction>(
"""
@Query("select * from User")
abstract long[] longArray();
diff --git a/room/room-compiler/src/test/kotlin/androidx/room/processor/RawQueryMethodProcessorTest.kt b/room/room-compiler/src/test/kotlin/androidx/room/processor/RawQueryFunctionProcessorTest.kt
similarity index 95%
rename from room/room-compiler/src/test/kotlin/androidx/room/processor/RawQueryMethodProcessorTest.kt
rename to room/room-compiler/src/test/kotlin/androidx/room/processor/RawQueryFunctionProcessorTest.kt
index 7bacb42..5a851a5 100644
--- a/room/room-compiler/src/test/kotlin/androidx/room/processor/RawQueryMethodProcessorTest.kt
+++ b/room/room-compiler/src/test/kotlin/androidx/room/processor/RawQueryFunctionProcessorTest.kt
@@ -37,13 +37,13 @@
import androidx.room.processor.ProcessorErrors.RAW_QUERY_STRING_PARAMETER_REMOVED
import androidx.room.runProcessorTestWithK1
import androidx.room.testing.context
-import androidx.room.vo.RawQueryMethod
+import androidx.room.vo.RawQueryFunction
import androidx.sqlite.db.SupportSQLiteQuery
import org.hamcrest.CoreMatchers.`is`
import org.hamcrest.MatcherAssert.assertThat
import org.junit.Test
-class RawQueryMethodProcessorTest {
+class RawQueryFunctionProcessorTest {
@Test
fun supportRawQuery() {
singleQueryMethod(
@@ -56,7 +56,7 @@
assertThat(
query.runtimeQueryParam,
`is`(
- RawQueryMethod.RuntimeQueryParameter(
+ RawQueryFunction.RuntimeQueryParameter(
paramName = "query",
typeName = SupportDbTypeNames.QUERY
)
@@ -95,7 +95,7 @@
assertThat(
query.runtimeQueryParam,
`is`(
- RawQueryMethod.RuntimeQueryParameter(
+ RawQueryFunction.RuntimeQueryParameter(
paramName = "query",
typeName = SupportDbTypeNames.QUERY
)
@@ -118,7 +118,7 @@
assertThat(
query.runtimeQueryParam,
`is`(
- RawQueryMethod.RuntimeQueryParameter(
+ RawQueryFunction.RuntimeQueryParameter(
paramName = "query",
typeName = SupportDbTypeNames.QUERY
)
@@ -190,7 +190,7 @@
assertThat(
query.runtimeQueryParam,
`is`(
- RawQueryMethod.RuntimeQueryParameter(
+ RawQueryFunction.RuntimeQueryParameter(
paramName = "query",
typeName = SupportDbTypeNames.QUERY
)
@@ -225,7 +225,7 @@
val daoElement =
invocation.processingEnv.requireTypeElement(RawQuerySuspendUnitDao::class)
val daoFunctionElement = daoElement.getDeclaredMethods().first()
- RawQueryMethodProcessor(
+ RawQueryFunctionProcessor(
baseContext = invocation.context,
containing = daoElement.type,
executableElement = daoFunctionElement
@@ -341,8 +341,8 @@
@RawQuery(observedEntities = MyDataClass.class)
abstract public int[] foo(SupportSQLiteQuery query);
"""
- ) { method, _ ->
- assertThat(method.observedTableNames, `is`(setOf("User")))
+ ) { function, _ ->
+ assertThat(function.observedTableNames, `is`(setOf("User")))
}
}
@@ -358,8 +358,8 @@
@RawQuery(observedEntities = MyDataClass.class)
abstract public int[] foo(SupportSQLiteQuery query);
"""
- ) { method, _ ->
- assertThat(method.observedTableNames, `is`(setOf("User")))
+ ) { function, _ ->
+ assertThat(function.observedTableNames, `is`(setOf("User")))
}
}
@@ -598,7 +598,7 @@
"${KotlinTypeNames.FLOW.canonicalName}<Int>"
)
.forEach { type ->
- singleQueryMethodKotlin(
+ singleQueryFunction(
"""
@RawQuery
abstract suspend fun foo(query: SupportSQLiteQuery): $type
@@ -614,7 +614,7 @@
@Test
fun nonNullVoidGuava() {
- singleQueryMethodKotlin(
+ singleQueryFunction(
"""
@RawQuery
abstract fun foo(query: SupportSQLiteQuery): ListenableFuture<Void>
@@ -626,7 +626,7 @@
private fun singleQueryMethod(
vararg input: String,
- handler: (RawQueryMethod, XTestInvocation) -> Unit
+ handler: (RawQueryFunction, XTestInvocation) -> Unit
) {
val inputSource =
Source.java("foo.bar.MyClass", DAO_PREFIX + input.joinToString("\n") + DAO_SUFFIX)
@@ -649,7 +649,7 @@
sources = commonSources + inputSource,
options = mapOf(Context.BooleanProcessorOptions.GENERATE_KOTLIN.argName to "false"),
) { invocation ->
- val (owner, methods) =
+ val (owner, functions) =
invocation.roundEnv
.getElementsAnnotatedWith(Dao::class.qualifiedName!!)
.filterIsInstance<XTypeElement>()
@@ -661,19 +661,19 @@
}
.first { it.second.isNotEmpty() }
val parser =
- RawQueryMethodProcessor(
+ RawQueryFunctionProcessor(
baseContext = invocation.context,
containing = owner.type,
- executableElement = methods.first()
+ executableElement = functions.first()
)
val parsedQuery = parser.process()
handler(parsedQuery, invocation)
}
}
- private fun singleQueryMethodKotlin(
+ private fun singleQueryFunction(
vararg input: String,
- handler: (RawQueryMethod, XTestInvocation) -> Unit
+ handler: (RawQueryFunction, XTestInvocation) -> Unit
) {
val inputSource =
Source.kotlin("MyClass.kt", DAO_PREFIX_KT + input.joinToString("\n") + DAO_SUFFIX)
@@ -700,7 +700,7 @@
COMMON.GUAVA_ROOM
)
runProcessorTestWithK1(sources = commonSources + inputSource) { invocation ->
- val (owner, methods) =
+ val (owner, functions) =
invocation.roundEnv
.getElementsAnnotatedWith(Dao::class.qualifiedName!!)
.filterIsInstance<XTypeElement>()
@@ -712,10 +712,10 @@
}
.first { it.second.isNotEmpty() }
val parser =
- RawQueryMethodProcessor(
+ RawQueryFunctionProcessor(
baseContext = invocation.context,
containing = owner.type,
- executableElement = methods.first()
+ executableElement = functions.first()
)
val parsedQuery = parser.process()
handler(parsedQuery, invocation)
diff --git a/room/room-compiler/src/test/kotlin/androidx/room/processor/TransactionMethodProcessorTest.kt b/room/room-compiler/src/test/kotlin/androidx/room/processor/TransactionFunctionProcessorTest.kt
similarity index 91%
rename from room/room-compiler/src/test/kotlin/androidx/room/processor/TransactionMethodProcessorTest.kt
rename to room/room-compiler/src/test/kotlin/androidx/room/processor/TransactionFunctionProcessorTest.kt
index 9354625..6edea0d 100644
--- a/room/room-compiler/src/test/kotlin/androidx/room/processor/TransactionMethodProcessorTest.kt
+++ b/room/room-compiler/src/test/kotlin/androidx/room/processor/TransactionFunctionProcessorTest.kt
@@ -32,7 +32,7 @@
import androidx.room.ext.RxJava3TypeNames
import androidx.room.runProcessorTestWithK1
import androidx.room.testing.context
-import androidx.room.vo.TransactionMethod
+import androidx.room.vo.TransactionFunction
import org.hamcrest.CoreMatchers.`is`
import org.hamcrest.MatcherAssert.assertThat
import org.junit.Test
@@ -41,7 +41,7 @@
@Suppress("PLATFORM_CLASS_MAPPED_TO_KOTLIN")
@RunWith(JUnit4::class)
-class TransactionMethodProcessorTest {
+class TransactionFunctionProcessorTest {
companion object {
const val DAO_PREFIX =
@@ -80,7 +80,7 @@
) { transaction, invocation ->
assertThat(transaction.jvmName, `is`("doInTransaction"))
invocation.assertCompilationResult {
- hasErrorContaining(ProcessorErrors.TRANSACTION_METHOD_MODIFIERS)
+ hasErrorContaining(ProcessorErrors.TRANSACTION_FUNCTION_MODIFIERS)
}
}
}
@@ -95,7 +95,7 @@
) { transaction, invocation ->
assertThat(transaction.jvmName, `is`("doInTransaction"))
invocation.assertCompilationResult {
- hasErrorContaining(ProcessorErrors.TRANSACTION_METHOD_MODIFIERS)
+ hasErrorContaining(ProcessorErrors.TRANSACTION_FUNCTION_MODIFIERS)
}
}
}
@@ -113,7 +113,7 @@
assertThat(transaction.jvmName, `is`("doInTransaction"))
invocation.assertCompilationResult {
hasErrorContaining(
- ProcessorErrors.transactionMethodAsync(
+ ProcessorErrors.transactionFunctionAsync(
FLOW.rawTypeName.toString(CodeLanguage.JAVA)
)
)
@@ -132,7 +132,7 @@
assertThat(transaction.jvmName, `is`("doInTransaction"))
invocation.assertCompilationResult {
hasErrorContaining(
- ProcessorErrors.transactionMethodAsync(
+ ProcessorErrors.transactionFunctionAsync(
LIVE_DATA.rawTypeName.toString(CodeLanguage.JAVA)
)
)
@@ -151,7 +151,7 @@
assertThat(transaction.jvmName, `is`("doInTransaction"))
invocation.assertCompilationResult {
hasErrorContaining(
- ProcessorErrors.transactionMethodAsync(
+ ProcessorErrors.transactionFunctionAsync(
COMPUTABLE_LIVE_DATA.rawTypeName.toString(CodeLanguage.JAVA)
)
)
@@ -170,7 +170,7 @@
assertThat(transaction.jvmName, `is`("doInTransaction"))
invocation.assertCompilationResult {
hasErrorContaining(
- ProcessorErrors.transactionMethodAsync(
+ ProcessorErrors.transactionFunctionAsync(
RxJava2TypeNames.FLOWABLE.rawTypeName.toString(CodeLanguage.JAVA)
)
)
@@ -191,7 +191,7 @@
assertThat(transaction.jvmName, `is`("doInTransaction"))
invocation.assertCompilationResult {
hasErrorContaining(
- ProcessorErrors.transactionMethodAsync(
+ ProcessorErrors.transactionFunctionAsync(
RxJava3TypeNames.FLOWABLE.rawTypeName.toString(CodeLanguage.JAVA)
)
)
@@ -210,7 +210,7 @@
assertThat(transaction.jvmName, `is`("doInTransaction"))
invocation.assertCompilationResult {
hasErrorContaining(
- ProcessorErrors.transactionMethodAsync(
+ ProcessorErrors.transactionFunctionAsync(
RxJava2TypeNames.COMPLETABLE.rawTypeName.toString(CodeLanguage.JAVA)
)
)
@@ -231,7 +231,7 @@
assertThat(transaction.jvmName, `is`("doInTransaction"))
invocation.assertCompilationResult {
hasErrorContaining(
- ProcessorErrors.transactionMethodAsync(
+ ProcessorErrors.transactionFunctionAsync(
RxJava3TypeNames.COMPLETABLE.rawTypeName.toString(CodeLanguage.JAVA)
)
)
@@ -250,7 +250,7 @@
assertThat(transaction.jvmName, `is`("doInTransaction"))
invocation.assertCompilationResult {
hasErrorContaining(
- ProcessorErrors.transactionMethodAsync(
+ ProcessorErrors.transactionFunctionAsync(
RxJava2TypeNames.SINGLE.rawTypeName.toString(CodeLanguage.JAVA)
)
)
@@ -271,7 +271,7 @@
assertThat(transaction.jvmName, `is`("doInTransaction"))
invocation.assertCompilationResult {
hasErrorContaining(
- ProcessorErrors.transactionMethodAsync(
+ ProcessorErrors.transactionFunctionAsync(
RxJava3TypeNames.SINGLE.rawTypeName.toString(CodeLanguage.JAVA)
)
)
@@ -290,7 +290,7 @@
assertThat(transaction.jvmName, `is`("doInTransaction"))
invocation.assertCompilationResult {
hasErrorContaining(
- ProcessorErrors.transactionMethodAsync(
+ ProcessorErrors.transactionFunctionAsync(
LISTENABLE_FUTURE.rawTypeName.toString(CodeLanguage.JAVA)
)
)
@@ -309,7 +309,7 @@
assertThat(transaction.jvmName, `is`("doInTransaction"))
invocation.assertCompilationResult {
hasErrorContaining(
- ProcessorErrors.transactionMethodAsync(
+ ProcessorErrors.transactionFunctionAsync(
PUBLISHER.rawTypeName.toString(CodeLanguage.JAVA)
)
)
@@ -317,12 +317,12 @@
}
}
- private val TransactionMethod.jvmName: String
+ private val TransactionFunction.jvmName: String
get() = element.jvmName
private fun singleTransactionMethod(
vararg input: String,
- handler: (TransactionMethod, XTestInvocation) -> Unit
+ handler: (TransactionFunction, XTestInvocation) -> Unit
) {
val inputSource =
listOf(
@@ -360,7 +360,7 @@
}
.first { it.second.isNotEmpty() }
val processor =
- TransactionMethodProcessor(
+ TransactionFunctionProcessor(
baseContext = invocation.context,
containingElement = owner,
containingType = owner.type,
diff --git a/room/room-compiler/src/test/kotlin/androidx/room/processor/UpdateMethodProcessorTest.kt b/room/room-compiler/src/test/kotlin/androidx/room/processor/UpdateFunctionProcessorTest.kt
similarity index 92%
rename from room/room-compiler/src/test/kotlin/androidx/room/processor/UpdateMethodProcessorTest.kt
rename to room/room-compiler/src/test/kotlin/androidx/room/processor/UpdateFunctionProcessorTest.kt
index f5a3a5a..b9b31bd 100644
--- a/room/room-compiler/src/test/kotlin/androidx/room/processor/UpdateMethodProcessorTest.kt
+++ b/room/room-compiler/src/test/kotlin/androidx/room/processor/UpdateFunctionProcessorTest.kt
@@ -22,7 +22,7 @@
import androidx.room.compiler.processing.util.Source
import androidx.room.processor.ProcessorErrors.CANNOT_FIND_UPDATE_RESULT_ADAPTER
import androidx.room.processor.ProcessorErrors.UPDATE_MISSING_PARAMS
-import androidx.room.vo.UpdateMethod
+import androidx.room.vo.UpdateFunction
import org.hamcrest.CoreMatchers.`is`
import org.hamcrest.MatcherAssert.assertThat
import org.junit.Test
@@ -31,8 +31,8 @@
@Suppress("PLATFORM_CLASS_MAPPED_TO_KOTLIN")
@RunWith(JUnit4::class)
-class UpdateMethodProcessorTest :
- DeleteOrUpdateShortcutMethodProcessorTest<UpdateMethod>(Update::class) {
+class UpdateFunctionProcessorTest :
+ DeleteOrUpdateShortcutFunctionProcessorTest<UpdateFunction>(Update::class) {
override fun invalidReturnTypeError(): String = CANNOT_FIND_UPDATE_RESULT_ADAPTER
override fun noParamsError(): String = UPDATE_MISSING_PARAMS
@@ -41,8 +41,8 @@
baseContext: Context,
containing: XType,
executableElement: XMethodElement
- ): UpdateMethod {
- return UpdateMethodProcessor(baseContext, containing, executableElement).process()
+ ): UpdateFunction {
+ return UpdateFunctionProcessor(baseContext, containing, executableElement).process()
}
@Test
diff --git a/room/room-compiler/src/test/kotlin/androidx/room/processor/UpsertMethodProcessorTest.kt b/room/room-compiler/src/test/kotlin/androidx/room/processor/UpsertFunctionProcessorTest.kt
similarity index 88%
rename from room/room-compiler/src/test/kotlin/androidx/room/processor/UpsertMethodProcessorTest.kt
rename to room/room-compiler/src/test/kotlin/androidx/room/processor/UpsertFunctionProcessorTest.kt
index 25f9a07..e36bf35 100644
--- a/room/room-compiler/src/test/kotlin/androidx/room/processor/UpsertMethodProcessorTest.kt
+++ b/room/room-compiler/src/test/kotlin/androidx/room/processor/UpsertFunctionProcessorTest.kt
@@ -23,14 +23,14 @@
import androidx.room.processor.ProcessorErrors.UPSERT_DOES_NOT_HAVE_ANY_PARAMETERS_TO_UPSERT
import androidx.room.processor.ProcessorErrors.UPSERT_MULTI_PARAM_SINGLE_RETURN_MISMATCH
import androidx.room.processor.ProcessorErrors.UPSERT_SINGLE_PARAM_MULTI_RETURN_MISMATCH
-import androidx.room.vo.UpsertMethod
+import androidx.room.vo.UpsertFunction
import org.junit.runner.RunWith
import org.junit.runners.JUnit4
@Suppress("PLATFORM_CLASS_MAPPED_TO_KOTLIN")
@RunWith(JUnit4::class)
-class UpsertMethodProcessorTest :
- InsertOrUpsertShortcutMethodProcessorTest<UpsertMethod>(Upsert::class) {
+class UpsertFunctionProcessorTest :
+ InsertOrUpsertShortcutFunctionProcessorTest<UpsertFunction>(Upsert::class) {
override fun noParamsError(): String = UPSERT_DOES_NOT_HAVE_ANY_PARAMETERS_TO_UPSERT
override fun missingPrimaryKey(
@@ -55,7 +55,7 @@
baseContext: Context,
containing: XType,
executableElement: XMethodElement
- ): UpsertMethod {
- return UpsertMethodProcessor(baseContext, containing, executableElement).process()
+ ): UpsertFunction {
+ return UpsertFunctionProcessor(baseContext, containing, executableElement).process()
}
}
diff --git a/room/room-compiler/src/test/kotlin/androidx/room/solver/TypeAdapterStoreTest.kt b/room/room-compiler/src/test/kotlin/androidx/room/solver/TypeAdapterStoreTest.kt
index bf39ada..19a60fa 100644
--- a/room/room-compiler/src/test/kotlin/androidx/room/solver/TypeAdapterStoreTest.kt
+++ b/room/room-compiler/src/test/kotlin/androidx/room/solver/TypeAdapterStoreTest.kt
@@ -61,10 +61,10 @@
import androidx.room.solver.query.parameter.CollectionQueryParameterAdapter
import androidx.room.solver.query.result.MultiTypedPagingSourceQueryResultBinder
import androidx.room.solver.query.result.Paging3PagingSourceQueryResultBinder
-import androidx.room.solver.shortcut.binderprovider.GuavaListenableFutureDeleteOrUpdateMethodBinderProvider
-import androidx.room.solver.shortcut.binderprovider.GuavaListenableFutureInsertOrUpsertMethodBinderProvider
-import androidx.room.solver.shortcut.binderprovider.RxCallableDeleteOrUpdateMethodBinderProvider
-import androidx.room.solver.shortcut.binderprovider.RxCallableInsertOrUpsertMethodBinderProvider
+import androidx.room.solver.shortcut.binderprovider.GuavaListenableFutureDeleteOrUpdateFunctionBinderProvider
+import androidx.room.solver.shortcut.binderprovider.GuavaListenableFutureInsertOrUpsertFunctionBinderProvider
+import androidx.room.solver.shortcut.binderprovider.RxCallableDeleteOrUpdateFunctionBinderProvider
+import androidx.room.solver.shortcut.binderprovider.RxCallableInsertOrUpsertFunctionBinderProvider
import androidx.room.solver.types.BoxedPrimitiveColumnTypeAdapter
import androidx.room.solver.types.ByteBufferColumnTypeAdapter
import androidx.room.solver.types.ColumnTypeAdapter
@@ -79,7 +79,7 @@
import androidx.room.solver.types.ValueClassConverterWrapper
import androidx.room.testing.context
import androidx.room.vo.BuiltInConverterFlags
-import androidx.room.vo.ReadQueryMethod
+import androidx.room.vo.ReadQueryFunction
import org.hamcrest.CoreMatchers.instanceOf
import org.hamcrest.CoreMatchers.`is`
import org.hamcrest.CoreMatchers.notNullValue
@@ -880,7 +880,7 @@
val single = invocation.processingEnv.requireTypeElement(rxTypeClassName)
assertThat(single, notNullValue())
assertThat(
- RxCallableInsertOrUpsertMethodBinderProvider.getAll(invocation.context)
+ RxCallableInsertOrUpsertFunctionBinderProvider.getAll(invocation.context)
.any { it.matches(single.type) },
`is`(true)
)
@@ -898,7 +898,7 @@
runProcessorTestWithK1(sources = listOf(rxTypeSrc)) { invocation ->
val maybe = invocation.processingEnv.requireTypeElement(rxTypeClassName)
assertThat(
- RxCallableInsertOrUpsertMethodBinderProvider.getAll(invocation.context)
+ RxCallableInsertOrUpsertFunctionBinderProvider.getAll(invocation.context)
.any { it.matches(maybe.type) },
`is`(true)
)
@@ -916,7 +916,7 @@
runProcessorTestWithK1(sources = listOf(rxTypeSrc)) { invocation ->
val completable = invocation.processingEnv.requireTypeElement(rxTypeClassName)
assertThat(
- RxCallableInsertOrUpsertMethodBinderProvider.getAll(invocation.context)
+ RxCallableInsertOrUpsertFunctionBinderProvider.getAll(invocation.context)
.any { it.matches(completable.type) },
`is`(true)
)
@@ -932,7 +932,7 @@
GuavaUtilConcurrentTypeNames.LISTENABLE_FUTURE
)
assertThat(
- GuavaListenableFutureInsertOrUpsertMethodBinderProvider(invocation.context)
+ GuavaListenableFutureInsertOrUpsertFunctionBinderProvider(invocation.context)
.matches(future.type),
`is`(true)
)
@@ -945,7 +945,7 @@
val single = invocation.processingEnv.requireTypeElement(RxJava2TypeNames.SINGLE)
assertThat(single, notNullValue())
assertThat(
- RxCallableDeleteOrUpdateMethodBinderProvider.getAll(invocation.context).any {
+ RxCallableDeleteOrUpdateFunctionBinderProvider.getAll(invocation.context).any {
it.matches(single.type)
},
`is`(true)
@@ -959,7 +959,7 @@
val maybe = invocation.processingEnv.requireTypeElement(RxJava2TypeNames.MAYBE)
assertThat(maybe, notNullValue())
assertThat(
- RxCallableDeleteOrUpdateMethodBinderProvider.getAll(invocation.context).any {
+ RxCallableDeleteOrUpdateFunctionBinderProvider.getAll(invocation.context).any {
it.matches(maybe.type)
},
`is`(true)
@@ -974,7 +974,7 @@
invocation.processingEnv.requireTypeElement(RxJava2TypeNames.COMPLETABLE)
assertThat(completable, notNullValue())
assertThat(
- RxCallableDeleteOrUpdateMethodBinderProvider.getAll(invocation.context).any {
+ RxCallableDeleteOrUpdateFunctionBinderProvider.getAll(invocation.context).any {
it.matches(completable.type)
},
`is`(true)
@@ -991,7 +991,7 @@
)
assertThat(future, notNullValue())
assertThat(
- GuavaListenableFutureDeleteOrUpdateMethodBinderProvider(invocation.context)
+ GuavaListenableFutureDeleteOrUpdateFunctionBinderProvider(invocation.context)
.matches(future.type),
`is`(true)
)
@@ -1009,7 +1009,9 @@
val single = invocation.processingEnv.requireTypeElement(rxTypeClassName)
assertThat(single).isNotNull()
assertThat(
- RxCallableInsertOrUpsertMethodBinderProvider.getAll(invocation.context)
+ RxCallableInsertOrUpsertFunctionBinderProvider.getAll(
+ invocation.context
+ )
.any { it.matches(single.type) }
)
.isTrue()
@@ -1027,7 +1029,9 @@
runProcessorTestWithK1(sources = listOf(rxTypeSrc)) { invocation ->
val maybe = invocation.processingEnv.requireTypeElement(rxTypeClassName)
assertThat(
- RxCallableInsertOrUpsertMethodBinderProvider.getAll(invocation.context)
+ RxCallableInsertOrUpsertFunctionBinderProvider.getAll(
+ invocation.context
+ )
.any { it.matches(maybe.type) }
)
.isTrue()
@@ -1045,7 +1049,9 @@
runProcessorTestWithK1(sources = listOf(rxTypeSrc)) { invocation ->
val completable = invocation.processingEnv.requireTypeElement(rxTypeClassName)
assertThat(
- RxCallableInsertOrUpsertMethodBinderProvider.getAll(invocation.context)
+ RxCallableInsertOrUpsertFunctionBinderProvider.getAll(
+ invocation.context
+ )
.any { it.matches(completable.type) }
)
.isTrue()
@@ -1061,7 +1067,7 @@
GuavaUtilConcurrentTypeNames.LISTENABLE_FUTURE
)
assertThat(
- GuavaListenableFutureInsertOrUpsertMethodBinderProvider(invocation.context)
+ GuavaListenableFutureInsertOrUpsertFunctionBinderProvider(invocation.context)
.matches(future.type)
)
.isTrue()
@@ -1427,7 +1433,10 @@
)
val parsedDao = parser.process()
val binder =
- parsedDao.queryMethods.filterIsInstance<ReadQueryMethod>().first().queryResultBinder
+ parsedDao.queryFunctions
+ .filterIsInstance<ReadQueryFunction>()
+ .first()
+ .queryResultBinder
assertThat(binder is Paging3PagingSourceQueryResultBinder).isTrue()
val pagingSourceXRawType: XRawType? =
@@ -1435,8 +1444,8 @@
.findType(PagingTypeNames.PAGING_SOURCE.canonicalName)
?.rawType
val returnedXRawType =
- parsedDao.queryMethods
- .filterIsInstance<ReadQueryMethod>()
+ parsedDao.queryFunctions
+ .filterIsInstance<ReadQueryFunction>()
.first()
.returnType
.rawType
@@ -1490,7 +1499,10 @@
)
val parsedDao = parser.process()
val binder =
- parsedDao.queryMethods.filterIsInstance<ReadQueryMethod>().first().queryResultBinder
+ parsedDao.queryFunctions
+ .filterIsInstance<ReadQueryFunction>()
+ .first()
+ .queryResultBinder
// assert that room correctly binds to ListenableFuturePagingSource instead of
// its supertype PagingSource. ListenableFuturePagingSourceBinderProvider
@@ -1502,8 +1514,8 @@
.findType(PagingTypeNames.LISTENABLE_FUTURE_PAGING_SOURCE.canonicalName)
?.rawType
val returnedXRawType =
- parsedDao.queryMethods
- .filterIsInstance<ReadQueryMethod>()
+ parsedDao.queryFunctions
+ .filterIsInstance<ReadQueryFunction>()
.first()
.returnType
.rawType
@@ -1550,7 +1562,10 @@
)
val parsedDao = parser.process()
val binder =
- parsedDao.queryMethods.filterIsInstance<ReadQueryMethod>().first().queryResultBinder
+ parsedDao.queryFunctions
+ .filterIsInstance<ReadQueryFunction>()
+ .first()
+ .queryResultBinder
assertThat(binder is MultiTypedPagingSourceQueryResultBinder).isTrue()
val rxPagingSourceXRawType: XRawType? =
@@ -1558,8 +1573,8 @@
.findType(PagingTypeNames.RX2_PAGING_SOURCE.canonicalName)
?.rawType
val returnedXRawType =
- parsedDao.queryMethods
- .filterIsInstance<ReadQueryMethod>()
+ parsedDao.queryFunctions
+ .filterIsInstance<ReadQueryFunction>()
.first()
.returnType
.rawType
@@ -1606,7 +1621,10 @@
)
val parsedDao = parser.process()
val binder =
- parsedDao.queryMethods.filterIsInstance<ReadQueryMethod>().first().queryResultBinder
+ parsedDao.queryFunctions
+ .filterIsInstance<ReadQueryFunction>()
+ .first()
+ .queryResultBinder
assertThat(binder is MultiTypedPagingSourceQueryResultBinder).isTrue()
val rxPagingSourceXRawType: XRawType? =
@@ -1614,8 +1632,8 @@
.findType(PagingTypeNames.RX3_PAGING_SOURCE.canonicalName)
?.rawType
val returnedXRawType =
- parsedDao.queryMethods
- .filterIsInstance<ReadQueryMethod>()
+ parsedDao.queryFunctions
+ .filterIsInstance<ReadQueryFunction>()
.first()
.returnType
.rawType
diff --git a/room/room-compiler/src/test/kotlin/androidx/room/solver/query/QueryWriterTest.kt b/room/room-compiler/src/test/kotlin/androidx/room/solver/query/QueryWriterTest.kt
index ad513ea..23c72a0 100644
--- a/room/room-compiler/src/test/kotlin/androidx/room/solver/query/QueryWriterTest.kt
+++ b/room/room-compiler/src/test/kotlin/androidx/room/solver/query/QueryWriterTest.kt
@@ -25,7 +25,7 @@
import androidx.room.compiler.processing.util.Source
import androidx.room.ext.RoomTypeNames.ROOM_SQL_QUERY
import androidx.room.ext.RoomTypeNames.STRING_UTIL
-import androidx.room.processor.QueryMethodProcessor
+import androidx.room.processor.QueryFunctionProcessor
import androidx.room.runProcessorTestWithK1
import androidx.room.testing.context
import androidx.room.writer.QueryWriter
@@ -375,7 +375,7 @@
}
.first { it.second.isNotEmpty() }
val parser =
- QueryMethodProcessor(
+ QueryFunctionProcessor(
baseContext = invocation.context,
containing = owner.type,
executableElement = methods.first()
diff --git a/room/room-compiler/src/test/kotlin/androidx/room/verifier/DatabaseVerifierTest.kt b/room/room-compiler/src/test/kotlin/androidx/room/verifier/DatabaseVerifierTest.kt
index 421fb25..a730267 100644
--- a/room/room-compiler/src/test/kotlin/androidx/room/verifier/DatabaseVerifierTest.kt
+++ b/room/room-compiler/src/test/kotlin/androidx/room/verifier/DatabaseVerifierTest.kt
@@ -399,7 +399,7 @@
type = mock(XType::class.java),
entities = entities,
views = views,
- daoMethods = emptyList(),
+ daoFunctions = emptyList(),
version = -1,
exportSchema = false,
enableForeignKeys = false,
diff --git a/room/room-compiler/src/test/kotlin/androidx/room/vo/DatabaseTest.kt b/room/room-compiler/src/test/kotlin/androidx/room/vo/DatabaseTest.kt
index 536bc08..cc50bc3 100644
--- a/room/room-compiler/src/test/kotlin/androidx/room/vo/DatabaseTest.kt
+++ b/room/room-compiler/src/test/kotlin/androidx/room/vo/DatabaseTest.kt
@@ -67,7 +67,7 @@
)
),
views = emptyList(),
- daoMethods = emptyList(),
+ daoFunctions = emptyList(),
version = 1,
exportSchema = false,
enableForeignKeys = false,
diff --git a/room/room-compiler/src/test/kotlin/androidx/room/writer/DaoKotlinCodeGenTest.kt b/room/room-compiler/src/test/kotlin/androidx/room/writer/DaoKotlinCodeGenTest.kt
index ec8ee0d..55272a9 100644
--- a/room/room-compiler/src/test/kotlin/androidx/room/writer/DaoKotlinCodeGenTest.kt
+++ b/room/room-compiler/src/test/kotlin/androidx/room/writer/DaoKotlinCodeGenTest.kt
@@ -1109,7 +1109,7 @@
}
@Test
- fun transactionMethodAdapter_interface(
+ fun transactionFunctionAdapter_interface(
@TestParameter("disable", "all-compatibility", "all") jvmDefaultMode: String
) {
// For parametrized tests, use method name from reflection
@@ -1181,7 +1181,7 @@
}
@Test
- fun transactionMethodAdapter_abstractClass() {
+ fun transactionFunctionAdapter_abstractClass() {
val src =
Source.kotlin(
"MyDao.kt",
@@ -1236,7 +1236,7 @@
}
@Test
- fun deleteOrUpdateMethodAdapter() {
+ fun deleteOrUpdateFunctionAdapter() {
val src =
Source.kotlin(
"MyDao.kt",
@@ -1274,7 +1274,7 @@
}
@Test
- fun insertOrUpsertMethodAdapter() {
+ fun insertOrUpsertFunctionAdapter() {
val src =
Source.kotlin(
"MyDao.kt",
diff --git a/room/room-compiler/src/test/test-data/kotlinCodeGen/deleteOrUpdateMethodAdapter.kt b/room/room-compiler/src/test/test-data/kotlinCodeGen/deleteOrUpdateFunctionAdapter.kt
similarity index 100%
rename from room/room-compiler/src/test/test-data/kotlinCodeGen/deleteOrUpdateMethodAdapter.kt
rename to room/room-compiler/src/test/test-data/kotlinCodeGen/deleteOrUpdateFunctionAdapter.kt
diff --git a/room/room-compiler/src/test/test-data/kotlinCodeGen/insertOrUpsertMethodAdapter.kt b/room/room-compiler/src/test/test-data/kotlinCodeGen/insertOrUpsertFunctionAdapter.kt
similarity index 100%
rename from room/room-compiler/src/test/test-data/kotlinCodeGen/insertOrUpsertMethodAdapter.kt
rename to room/room-compiler/src/test/test-data/kotlinCodeGen/insertOrUpsertFunctionAdapter.kt
diff --git a/room/room-compiler/src/test/test-data/kotlinCodeGen/transactionMethodAdapter_abstractClass.kt b/room/room-compiler/src/test/test-data/kotlinCodeGen/transactionFunctionAdapter_abstractClass.kt
similarity index 100%
rename from room/room-compiler/src/test/test-data/kotlinCodeGen/transactionMethodAdapter_abstractClass.kt
rename to room/room-compiler/src/test/test-data/kotlinCodeGen/transactionFunctionAdapter_abstractClass.kt
diff --git a/room/room-compiler/src/test/test-data/kotlinCodeGen/transactionMethodAdapter_interface.kt b/room/room-compiler/src/test/test-data/kotlinCodeGen/transactionFunctionAdapter_interface.kt
similarity index 100%
rename from room/room-compiler/src/test/test-data/kotlinCodeGen/transactionMethodAdapter_interface.kt
rename to room/room-compiler/src/test/test-data/kotlinCodeGen/transactionFunctionAdapter_interface.kt
diff --git a/settings.gradle b/settings.gradle
index 2a0e494..ec60c4a 100644
--- a/settings.gradle
+++ b/settings.gradle
@@ -33,7 +33,7 @@
if (agpOverride != null) {
classpath("com.android.settings:com.android.settings.gradle.plugin:$agpOverride")
} else {
- classpath("com.android.settings:com.android.settings.gradle.plugin:8.9.0-alpha01")
+ classpath("com.android.settings:com.android.settings.gradle.plugin:8.9.0-alpha06")
}
// set guava version to be compatible with Depdendency analysis gradle plugin
classpath("com.google.guava:guava:33.3.1-jre")
diff --git a/test/uiautomator/integration-tests/testapp/src/androidTest/java/androidx/test/uiautomator/testapp/UiObject2Test.java b/test/uiautomator/integration-tests/testapp/src/androidTest/java/androidx/test/uiautomator/testapp/UiObject2Test.java
index 4573dd0..65f83a0 100644
--- a/test/uiautomator/integration-tests/testapp/src/androidTest/java/androidx/test/uiautomator/testapp/UiObject2Test.java
+++ b/test/uiautomator/integration-tests/testapp/src/androidTest/java/androidx/test/uiautomator/testapp/UiObject2Test.java
@@ -376,6 +376,7 @@
}
@Test
+ @SdkSuppress(maxSdkVersion = 34) // b/384973122: Failing on SDK 35
public void testGetVisibleCenter() {
launchTestActivity(VisibleBoundsTestActivity.class);
diff --git a/wear/compose/compose-foundation/src/main/java/androidx/wear/compose/foundation/lazy/TransformingLazyColumn.kt b/wear/compose/compose-foundation/src/main/java/androidx/wear/compose/foundation/lazy/TransformingLazyColumn.kt
index bee8429..2c1b95d 100644
--- a/wear/compose/compose-foundation/src/main/java/androidx/wear/compose/foundation/lazy/TransformingLazyColumn.kt
+++ b/wear/compose/compose-foundation/src/main/java/androidx/wear/compose/foundation/lazy/TransformingLazyColumn.kt
@@ -30,6 +30,7 @@
import androidx.compose.foundation.lazy.layout.LazyLayoutIntervalContent
import androidx.compose.foundation.lazy.layout.LazyLayoutItemProvider
import androidx.compose.foundation.lazy.layout.getDefaultLazyLayoutKey
+import androidx.compose.foundation.overscroll
import androidx.compose.runtime.Composable
import androidx.compose.runtime.CompositionLocalProvider
import androidx.compose.runtime.ProvidableCompositionLocal
@@ -228,6 +229,8 @@
reverseScrolling = false
)
val semanticState = remember(state) { TransformingLazyColumnSemanticState(state = state) }
+ // TODO: b/388191915 - Migrate to use rememberOverscrollEffect when updated to 1.8.0.
+ @Suppress("DEPRECATION") val overscrollEffect = ScrollableDefaults.overscrollEffect()
LazyLayout(
itemProvider = itemProviderLambda,
@@ -250,12 +253,14 @@
userScrollEnabled = userScrollEnabled,
reverseScrolling = false,
)
+ .overscroll(overscrollEffect)
.scrollable(
state = state,
reverseDirection = reverseDirection,
enabled = userScrollEnabled,
orientation = Orientation.Vertical,
flingBehavior = flingBehavior,
+ overscrollEffect = overscrollEffect,
),
measurePolicy = measurePolicy
)
diff --git a/wear/compose/compose-material-core/src/main/java/androidx/wear/compose/materialcore/Resources.kt b/wear/compose/compose-material-core/src/main/java/androidx/wear/compose/materialcore/Resources.kt
index f4933a4..441f0c2 100644
--- a/wear/compose/compose-material-core/src/main/java/androidx/wear/compose/materialcore/Resources.kt
+++ b/wear/compose/compose-material-core/src/main/java/androidx/wear/compose/materialcore/Resources.kt
@@ -78,6 +78,6 @@
@RestrictTo(RestrictTo.Scope.LIBRARY_GROUP)
@Composable
public fun isSmallScreen(): Boolean =
- LocalContext.current.resources.configuration.screenWidthDp <= SMALL_SCREEN_WIDTH_DP
+ LocalConfiguration.current.screenWidthDp <= SMALL_SCREEN_WIDTH_DP
@RestrictTo(RestrictTo.Scope.LIBRARY_GROUP) public const val SMALL_SCREEN_WIDTH_DP: Int = 225
diff --git a/wear/compose/compose-material3/api/current.txt b/wear/compose/compose-material3/api/current.txt
index 4326ccb..7e3e1c2 100644
--- a/wear/compose/compose-material3/api/current.txt
+++ b/wear/compose/compose-material3/api/current.txt
@@ -8,7 +8,6 @@
method @androidx.compose.runtime.Composable public void GroupSeparator();
method @androidx.compose.runtime.Composable public androidx.compose.foundation.layout.PaddingValues confirmDismissContentPadding();
method @androidx.compose.runtime.Composable public androidx.compose.foundation.layout.PaddingValues contentPadding();
- method @androidx.compose.runtime.Composable public androidx.compose.foundation.layout.PaddingValues contentPaddingWithEdgeButton(optional float edgeButtonSize);
method public kotlin.jvm.functions.Function1<androidx.compose.foundation.layout.RowScope,kotlin.Unit> getConfirmIcon();
method public kotlin.jvm.functions.Function1<androidx.compose.foundation.layout.RowScope,kotlin.Unit> getDismissIcon();
method public androidx.compose.foundation.layout.Arrangement.Vertical getVerticalArrangement();
@@ -1010,17 +1009,26 @@
}
public final class ScreenScaffoldDefaults {
- method public androidx.compose.foundation.layout.PaddingValues contentPaddingWithEdgeButton(float edgeButtonSize, optional float start, optional float top, optional float end, optional float extraBottom);
+ method @Deprecated public androidx.compose.foundation.layout.PaddingValues contentPaddingWithEdgeButton(float edgeButtonSize, optional float start, optional float top, optional float end, optional float extraBottom);
+ method @androidx.compose.runtime.Composable public androidx.compose.foundation.layout.PaddingValues getContentPadding();
+ method public float getEdgeButtonMinSpacing();
+ method public float getEdgeButtonSpacing();
+ property public final float EdgeButtonMinSpacing;
+ property public final float EdgeButtonSpacing;
+ property @androidx.compose.runtime.Composable public final androidx.compose.foundation.layout.PaddingValues contentPadding;
field public static final androidx.wear.compose.material3.ScreenScaffoldDefaults INSTANCE;
}
public final class ScreenScaffoldKt {
- method @androidx.compose.runtime.Composable public static void ScreenScaffold(androidx.compose.foundation.lazy.LazyListState scrollState, optional androidx.compose.ui.Modifier modifier, optional kotlin.jvm.functions.Function0<kotlin.Unit>? timeText, optional kotlin.jvm.functions.Function1<? super androidx.compose.foundation.layout.BoxScope,kotlin.Unit>? scrollIndicator, optional kotlin.jvm.functions.Function1<? super androidx.compose.foundation.layout.BoxScope,kotlin.Unit>? edgeButton, kotlin.jvm.functions.Function1<? super androidx.compose.foundation.layout.BoxScope,kotlin.Unit> content);
- method @androidx.compose.runtime.Composable public static void ScreenScaffold(androidx.compose.foundation.ScrollState scrollState, optional androidx.compose.ui.Modifier modifier, optional kotlin.jvm.functions.Function0<kotlin.Unit>? timeText, optional kotlin.jvm.functions.Function1<? super androidx.compose.foundation.layout.BoxScope,kotlin.Unit>? scrollIndicator, kotlin.jvm.functions.Function1<? super androidx.compose.foundation.layout.BoxScope,kotlin.Unit> content);
- method @androidx.compose.runtime.Composable public static void ScreenScaffold(optional androidx.compose.ui.Modifier modifier, optional kotlin.jvm.functions.Function0<kotlin.Unit>? timeText, optional androidx.wear.compose.foundation.ScrollInfoProvider? scrollInfoProvider, optional kotlin.jvm.functions.Function1<? super androidx.compose.foundation.layout.BoxScope,kotlin.Unit>? scrollIndicator, kotlin.jvm.functions.Function1<? super androidx.compose.foundation.layout.BoxScope,kotlin.Unit> content);
- method @androidx.compose.runtime.Composable public static void ScreenScaffold(androidx.wear.compose.foundation.lazy.ScalingLazyListState scrollState, optional androidx.compose.ui.Modifier modifier, optional kotlin.jvm.functions.Function0<kotlin.Unit>? timeText, optional kotlin.jvm.functions.Function1<? super androidx.compose.foundation.layout.BoxScope,kotlin.Unit>? scrollIndicator, optional kotlin.jvm.functions.Function1<? super androidx.compose.foundation.layout.BoxScope,kotlin.Unit>? edgeButton, kotlin.jvm.functions.Function1<? super androidx.compose.foundation.layout.BoxScope,kotlin.Unit> content);
- method @androidx.compose.runtime.Composable public static void ScreenScaffold(androidx.wear.compose.foundation.lazy.TransformingLazyColumnState scrollState, optional androidx.compose.ui.Modifier modifier, optional kotlin.jvm.functions.Function0<kotlin.Unit>? timeText, optional kotlin.jvm.functions.Function1<? super androidx.compose.foundation.layout.BoxScope,kotlin.Unit>? scrollIndicator, optional kotlin.jvm.functions.Function1<? super androidx.compose.foundation.layout.BoxScope,kotlin.Unit>? edgeButton, kotlin.jvm.functions.Function1<? super androidx.compose.foundation.layout.BoxScope,kotlin.Unit> content);
- method @androidx.compose.runtime.Composable public static void ScreenScaffold(kotlin.jvm.functions.Function1<? super androidx.compose.foundation.layout.BoxScope,kotlin.Unit> edgeButton, androidx.wear.compose.foundation.ScrollInfoProvider scrollInfoProvider, optional androidx.compose.ui.Modifier modifier, optional kotlin.jvm.functions.Function0<kotlin.Unit>? timeText, optional kotlin.jvm.functions.Function1<? super androidx.compose.foundation.layout.BoxScope,kotlin.Unit>? scrollIndicator, kotlin.jvm.functions.Function1<? super androidx.compose.foundation.layout.BoxScope,kotlin.Unit> content);
+ method @androidx.compose.runtime.Composable public static void ScreenScaffold(androidx.compose.foundation.lazy.LazyListState scrollState, optional androidx.compose.ui.Modifier modifier, optional androidx.compose.foundation.layout.PaddingValues contentPadding, optional kotlin.jvm.functions.Function0<kotlin.Unit>? timeText, optional kotlin.jvm.functions.Function1<? super androidx.compose.foundation.layout.BoxScope,kotlin.Unit>? scrollIndicator, kotlin.jvm.functions.Function2<? super androidx.compose.foundation.layout.BoxScope,? super androidx.compose.foundation.layout.PaddingValues,kotlin.Unit> content);
+ method @androidx.compose.runtime.Composable public static void ScreenScaffold(androidx.compose.foundation.lazy.LazyListState scrollState, kotlin.jvm.functions.Function1<? super androidx.compose.foundation.layout.BoxScope,kotlin.Unit> edgeButton, optional androidx.compose.ui.Modifier modifier, optional androidx.compose.foundation.layout.PaddingValues contentPadding, optional kotlin.jvm.functions.Function0<kotlin.Unit>? timeText, optional kotlin.jvm.functions.Function1<? super androidx.compose.foundation.layout.BoxScope,kotlin.Unit>? scrollIndicator, optional float edgeButtonSpacing, kotlin.jvm.functions.Function2<? super androidx.compose.foundation.layout.BoxScope,? super androidx.compose.foundation.layout.PaddingValues,kotlin.Unit> content);
+ method @androidx.compose.runtime.Composable public static void ScreenScaffold(androidx.compose.foundation.ScrollState scrollState, optional androidx.compose.ui.Modifier modifier, optional androidx.compose.foundation.layout.PaddingValues contentPadding, optional kotlin.jvm.functions.Function0<kotlin.Unit>? timeText, optional kotlin.jvm.functions.Function1<? super androidx.compose.foundation.layout.BoxScope,kotlin.Unit>? scrollIndicator, kotlin.jvm.functions.Function2<? super androidx.compose.foundation.layout.BoxScope,? super androidx.compose.foundation.layout.PaddingValues,kotlin.Unit> content);
+ method @androidx.compose.runtime.Composable public static void ScreenScaffold(optional androidx.compose.ui.Modifier modifier, optional androidx.wear.compose.foundation.ScrollInfoProvider? scrollInfoProvider, optional androidx.compose.foundation.layout.PaddingValues contentPadding, optional kotlin.jvm.functions.Function0<kotlin.Unit>? timeText, optional kotlin.jvm.functions.Function1<? super androidx.compose.foundation.layout.BoxScope,kotlin.Unit>? scrollIndicator, kotlin.jvm.functions.Function2<? super androidx.compose.foundation.layout.BoxScope,? super androidx.compose.foundation.layout.PaddingValues,kotlin.Unit> content);
+ method @androidx.compose.runtime.Composable public static void ScreenScaffold(androidx.wear.compose.foundation.lazy.ScalingLazyListState scrollState, optional androidx.compose.ui.Modifier modifier, optional androidx.compose.foundation.layout.PaddingValues contentPadding, optional kotlin.jvm.functions.Function0<kotlin.Unit>? timeText, optional kotlin.jvm.functions.Function1<? super androidx.compose.foundation.layout.BoxScope,kotlin.Unit>? scrollIndicator, kotlin.jvm.functions.Function2<? super androidx.compose.foundation.layout.BoxScope,? super androidx.compose.foundation.layout.PaddingValues,kotlin.Unit> content);
+ method @androidx.compose.runtime.Composable public static void ScreenScaffold(androidx.wear.compose.foundation.lazy.ScalingLazyListState scrollState, kotlin.jvm.functions.Function1<? super androidx.compose.foundation.layout.BoxScope,kotlin.Unit> edgeButton, optional androidx.compose.ui.Modifier modifier, optional androidx.compose.foundation.layout.PaddingValues contentPadding, optional kotlin.jvm.functions.Function0<kotlin.Unit>? timeText, optional kotlin.jvm.functions.Function1<? super androidx.compose.foundation.layout.BoxScope,kotlin.Unit>? scrollIndicator, optional float edgeButtonSpacing, kotlin.jvm.functions.Function2<? super androidx.compose.foundation.layout.BoxScope,? super androidx.compose.foundation.layout.PaddingValues,kotlin.Unit> content);
+ method @androidx.compose.runtime.Composable public static void ScreenScaffold(androidx.wear.compose.foundation.lazy.TransformingLazyColumnState scrollState, optional androidx.compose.ui.Modifier modifier, optional androidx.compose.foundation.layout.PaddingValues contentPadding, optional kotlin.jvm.functions.Function0<kotlin.Unit>? timeText, optional kotlin.jvm.functions.Function1<? super androidx.compose.foundation.layout.BoxScope,kotlin.Unit>? scrollIndicator, kotlin.jvm.functions.Function2<? super androidx.compose.foundation.layout.BoxScope,? super androidx.compose.foundation.layout.PaddingValues,kotlin.Unit> content);
+ method @androidx.compose.runtime.Composable public static void ScreenScaffold(androidx.wear.compose.foundation.lazy.TransformingLazyColumnState scrollState, kotlin.jvm.functions.Function1<? super androidx.compose.foundation.layout.BoxScope,kotlin.Unit> edgeButton, optional androidx.compose.ui.Modifier modifier, optional androidx.compose.foundation.layout.PaddingValues contentPadding, optional kotlin.jvm.functions.Function0<kotlin.Unit>? timeText, optional kotlin.jvm.functions.Function1<? super androidx.compose.foundation.layout.BoxScope,kotlin.Unit>? scrollIndicator, optional float edgeButtonSpacing, kotlin.jvm.functions.Function2<? super androidx.compose.foundation.layout.BoxScope,? super androidx.compose.foundation.layout.PaddingValues,kotlin.Unit> content);
+ method @androidx.compose.runtime.Composable public static void ScreenScaffold(androidx.wear.compose.foundation.ScrollInfoProvider scrollInfoProvider, kotlin.jvm.functions.Function1<? super androidx.compose.foundation.layout.BoxScope,kotlin.Unit> edgeButton, optional androidx.compose.ui.Modifier modifier, optional androidx.compose.foundation.layout.PaddingValues contentPadding, optional kotlin.jvm.functions.Function0<kotlin.Unit>? timeText, optional kotlin.jvm.functions.Function1<? super androidx.compose.foundation.layout.BoxScope,kotlin.Unit>? scrollIndicator, optional float edgeButtonSpacing, kotlin.jvm.functions.Function2<? super androidx.compose.foundation.layout.BoxScope,? super androidx.compose.foundation.layout.PaddingValues,kotlin.Unit> content);
}
@androidx.compose.runtime.Immutable @kotlin.jvm.JvmInline public final value class ScreenStage {
diff --git a/wear/compose/compose-material3/api/restricted_current.txt b/wear/compose/compose-material3/api/restricted_current.txt
index 4326ccb..7e3e1c2 100644
--- a/wear/compose/compose-material3/api/restricted_current.txt
+++ b/wear/compose/compose-material3/api/restricted_current.txt
@@ -8,7 +8,6 @@
method @androidx.compose.runtime.Composable public void GroupSeparator();
method @androidx.compose.runtime.Composable public androidx.compose.foundation.layout.PaddingValues confirmDismissContentPadding();
method @androidx.compose.runtime.Composable public androidx.compose.foundation.layout.PaddingValues contentPadding();
- method @androidx.compose.runtime.Composable public androidx.compose.foundation.layout.PaddingValues contentPaddingWithEdgeButton(optional float edgeButtonSize);
method public kotlin.jvm.functions.Function1<androidx.compose.foundation.layout.RowScope,kotlin.Unit> getConfirmIcon();
method public kotlin.jvm.functions.Function1<androidx.compose.foundation.layout.RowScope,kotlin.Unit> getDismissIcon();
method public androidx.compose.foundation.layout.Arrangement.Vertical getVerticalArrangement();
@@ -1010,17 +1009,26 @@
}
public final class ScreenScaffoldDefaults {
- method public androidx.compose.foundation.layout.PaddingValues contentPaddingWithEdgeButton(float edgeButtonSize, optional float start, optional float top, optional float end, optional float extraBottom);
+ method @Deprecated public androidx.compose.foundation.layout.PaddingValues contentPaddingWithEdgeButton(float edgeButtonSize, optional float start, optional float top, optional float end, optional float extraBottom);
+ method @androidx.compose.runtime.Composable public androidx.compose.foundation.layout.PaddingValues getContentPadding();
+ method public float getEdgeButtonMinSpacing();
+ method public float getEdgeButtonSpacing();
+ property public final float EdgeButtonMinSpacing;
+ property public final float EdgeButtonSpacing;
+ property @androidx.compose.runtime.Composable public final androidx.compose.foundation.layout.PaddingValues contentPadding;
field public static final androidx.wear.compose.material3.ScreenScaffoldDefaults INSTANCE;
}
public final class ScreenScaffoldKt {
- method @androidx.compose.runtime.Composable public static void ScreenScaffold(androidx.compose.foundation.lazy.LazyListState scrollState, optional androidx.compose.ui.Modifier modifier, optional kotlin.jvm.functions.Function0<kotlin.Unit>? timeText, optional kotlin.jvm.functions.Function1<? super androidx.compose.foundation.layout.BoxScope,kotlin.Unit>? scrollIndicator, optional kotlin.jvm.functions.Function1<? super androidx.compose.foundation.layout.BoxScope,kotlin.Unit>? edgeButton, kotlin.jvm.functions.Function1<? super androidx.compose.foundation.layout.BoxScope,kotlin.Unit> content);
- method @androidx.compose.runtime.Composable public static void ScreenScaffold(androidx.compose.foundation.ScrollState scrollState, optional androidx.compose.ui.Modifier modifier, optional kotlin.jvm.functions.Function0<kotlin.Unit>? timeText, optional kotlin.jvm.functions.Function1<? super androidx.compose.foundation.layout.BoxScope,kotlin.Unit>? scrollIndicator, kotlin.jvm.functions.Function1<? super androidx.compose.foundation.layout.BoxScope,kotlin.Unit> content);
- method @androidx.compose.runtime.Composable public static void ScreenScaffold(optional androidx.compose.ui.Modifier modifier, optional kotlin.jvm.functions.Function0<kotlin.Unit>? timeText, optional androidx.wear.compose.foundation.ScrollInfoProvider? scrollInfoProvider, optional kotlin.jvm.functions.Function1<? super androidx.compose.foundation.layout.BoxScope,kotlin.Unit>? scrollIndicator, kotlin.jvm.functions.Function1<? super androidx.compose.foundation.layout.BoxScope,kotlin.Unit> content);
- method @androidx.compose.runtime.Composable public static void ScreenScaffold(androidx.wear.compose.foundation.lazy.ScalingLazyListState scrollState, optional androidx.compose.ui.Modifier modifier, optional kotlin.jvm.functions.Function0<kotlin.Unit>? timeText, optional kotlin.jvm.functions.Function1<? super androidx.compose.foundation.layout.BoxScope,kotlin.Unit>? scrollIndicator, optional kotlin.jvm.functions.Function1<? super androidx.compose.foundation.layout.BoxScope,kotlin.Unit>? edgeButton, kotlin.jvm.functions.Function1<? super androidx.compose.foundation.layout.BoxScope,kotlin.Unit> content);
- method @androidx.compose.runtime.Composable public static void ScreenScaffold(androidx.wear.compose.foundation.lazy.TransformingLazyColumnState scrollState, optional androidx.compose.ui.Modifier modifier, optional kotlin.jvm.functions.Function0<kotlin.Unit>? timeText, optional kotlin.jvm.functions.Function1<? super androidx.compose.foundation.layout.BoxScope,kotlin.Unit>? scrollIndicator, optional kotlin.jvm.functions.Function1<? super androidx.compose.foundation.layout.BoxScope,kotlin.Unit>? edgeButton, kotlin.jvm.functions.Function1<? super androidx.compose.foundation.layout.BoxScope,kotlin.Unit> content);
- method @androidx.compose.runtime.Composable public static void ScreenScaffold(kotlin.jvm.functions.Function1<? super androidx.compose.foundation.layout.BoxScope,kotlin.Unit> edgeButton, androidx.wear.compose.foundation.ScrollInfoProvider scrollInfoProvider, optional androidx.compose.ui.Modifier modifier, optional kotlin.jvm.functions.Function0<kotlin.Unit>? timeText, optional kotlin.jvm.functions.Function1<? super androidx.compose.foundation.layout.BoxScope,kotlin.Unit>? scrollIndicator, kotlin.jvm.functions.Function1<? super androidx.compose.foundation.layout.BoxScope,kotlin.Unit> content);
+ method @androidx.compose.runtime.Composable public static void ScreenScaffold(androidx.compose.foundation.lazy.LazyListState scrollState, optional androidx.compose.ui.Modifier modifier, optional androidx.compose.foundation.layout.PaddingValues contentPadding, optional kotlin.jvm.functions.Function0<kotlin.Unit>? timeText, optional kotlin.jvm.functions.Function1<? super androidx.compose.foundation.layout.BoxScope,kotlin.Unit>? scrollIndicator, kotlin.jvm.functions.Function2<? super androidx.compose.foundation.layout.BoxScope,? super androidx.compose.foundation.layout.PaddingValues,kotlin.Unit> content);
+ method @androidx.compose.runtime.Composable public static void ScreenScaffold(androidx.compose.foundation.lazy.LazyListState scrollState, kotlin.jvm.functions.Function1<? super androidx.compose.foundation.layout.BoxScope,kotlin.Unit> edgeButton, optional androidx.compose.ui.Modifier modifier, optional androidx.compose.foundation.layout.PaddingValues contentPadding, optional kotlin.jvm.functions.Function0<kotlin.Unit>? timeText, optional kotlin.jvm.functions.Function1<? super androidx.compose.foundation.layout.BoxScope,kotlin.Unit>? scrollIndicator, optional float edgeButtonSpacing, kotlin.jvm.functions.Function2<? super androidx.compose.foundation.layout.BoxScope,? super androidx.compose.foundation.layout.PaddingValues,kotlin.Unit> content);
+ method @androidx.compose.runtime.Composable public static void ScreenScaffold(androidx.compose.foundation.ScrollState scrollState, optional androidx.compose.ui.Modifier modifier, optional androidx.compose.foundation.layout.PaddingValues contentPadding, optional kotlin.jvm.functions.Function0<kotlin.Unit>? timeText, optional kotlin.jvm.functions.Function1<? super androidx.compose.foundation.layout.BoxScope,kotlin.Unit>? scrollIndicator, kotlin.jvm.functions.Function2<? super androidx.compose.foundation.layout.BoxScope,? super androidx.compose.foundation.layout.PaddingValues,kotlin.Unit> content);
+ method @androidx.compose.runtime.Composable public static void ScreenScaffold(optional androidx.compose.ui.Modifier modifier, optional androidx.wear.compose.foundation.ScrollInfoProvider? scrollInfoProvider, optional androidx.compose.foundation.layout.PaddingValues contentPadding, optional kotlin.jvm.functions.Function0<kotlin.Unit>? timeText, optional kotlin.jvm.functions.Function1<? super androidx.compose.foundation.layout.BoxScope,kotlin.Unit>? scrollIndicator, kotlin.jvm.functions.Function2<? super androidx.compose.foundation.layout.BoxScope,? super androidx.compose.foundation.layout.PaddingValues,kotlin.Unit> content);
+ method @androidx.compose.runtime.Composable public static void ScreenScaffold(androidx.wear.compose.foundation.lazy.ScalingLazyListState scrollState, optional androidx.compose.ui.Modifier modifier, optional androidx.compose.foundation.layout.PaddingValues contentPadding, optional kotlin.jvm.functions.Function0<kotlin.Unit>? timeText, optional kotlin.jvm.functions.Function1<? super androidx.compose.foundation.layout.BoxScope,kotlin.Unit>? scrollIndicator, kotlin.jvm.functions.Function2<? super androidx.compose.foundation.layout.BoxScope,? super androidx.compose.foundation.layout.PaddingValues,kotlin.Unit> content);
+ method @androidx.compose.runtime.Composable public static void ScreenScaffold(androidx.wear.compose.foundation.lazy.ScalingLazyListState scrollState, kotlin.jvm.functions.Function1<? super androidx.compose.foundation.layout.BoxScope,kotlin.Unit> edgeButton, optional androidx.compose.ui.Modifier modifier, optional androidx.compose.foundation.layout.PaddingValues contentPadding, optional kotlin.jvm.functions.Function0<kotlin.Unit>? timeText, optional kotlin.jvm.functions.Function1<? super androidx.compose.foundation.layout.BoxScope,kotlin.Unit>? scrollIndicator, optional float edgeButtonSpacing, kotlin.jvm.functions.Function2<? super androidx.compose.foundation.layout.BoxScope,? super androidx.compose.foundation.layout.PaddingValues,kotlin.Unit> content);
+ method @androidx.compose.runtime.Composable public static void ScreenScaffold(androidx.wear.compose.foundation.lazy.TransformingLazyColumnState scrollState, optional androidx.compose.ui.Modifier modifier, optional androidx.compose.foundation.layout.PaddingValues contentPadding, optional kotlin.jvm.functions.Function0<kotlin.Unit>? timeText, optional kotlin.jvm.functions.Function1<? super androidx.compose.foundation.layout.BoxScope,kotlin.Unit>? scrollIndicator, kotlin.jvm.functions.Function2<? super androidx.compose.foundation.layout.BoxScope,? super androidx.compose.foundation.layout.PaddingValues,kotlin.Unit> content);
+ method @androidx.compose.runtime.Composable public static void ScreenScaffold(androidx.wear.compose.foundation.lazy.TransformingLazyColumnState scrollState, kotlin.jvm.functions.Function1<? super androidx.compose.foundation.layout.BoxScope,kotlin.Unit> edgeButton, optional androidx.compose.ui.Modifier modifier, optional androidx.compose.foundation.layout.PaddingValues contentPadding, optional kotlin.jvm.functions.Function0<kotlin.Unit>? timeText, optional kotlin.jvm.functions.Function1<? super androidx.compose.foundation.layout.BoxScope,kotlin.Unit>? scrollIndicator, optional float edgeButtonSpacing, kotlin.jvm.functions.Function2<? super androidx.compose.foundation.layout.BoxScope,? super androidx.compose.foundation.layout.PaddingValues,kotlin.Unit> content);
+ method @androidx.compose.runtime.Composable public static void ScreenScaffold(androidx.wear.compose.foundation.ScrollInfoProvider scrollInfoProvider, kotlin.jvm.functions.Function1<? super androidx.compose.foundation.layout.BoxScope,kotlin.Unit> edgeButton, optional androidx.compose.ui.Modifier modifier, optional androidx.compose.foundation.layout.PaddingValues contentPadding, optional kotlin.jvm.functions.Function0<kotlin.Unit>? timeText, optional kotlin.jvm.functions.Function1<? super androidx.compose.foundation.layout.BoxScope,kotlin.Unit>? scrollIndicator, optional float edgeButtonSpacing, kotlin.jvm.functions.Function2<? super androidx.compose.foundation.layout.BoxScope,? super androidx.compose.foundation.layout.PaddingValues,kotlin.Unit> content);
}
@androidx.compose.runtime.Immutable @kotlin.jvm.JvmInline public final value class ScreenStage {
diff --git a/wear/compose/compose-material3/integration-tests/src/main/java/androidx/wear/compose/material3/demos/EdgeButtonDemo.kt b/wear/compose/compose-material3/integration-tests/src/main/java/androidx/wear/compose/material3/demos/EdgeButtonDemo.kt
index d5cc344..a82e444 100644
--- a/wear/compose/compose-material3/integration-tests/src/main/java/androidx/wear/compose/material3/demos/EdgeButtonDemo.kt
+++ b/wear/compose/compose-material3/integration-tests/src/main/java/androidx/wear/compose/material3/demos/EdgeButtonDemo.kt
@@ -18,6 +18,7 @@
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Column
+import androidx.compose.foundation.layout.PaddingValues
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.fillMaxSize
@@ -48,7 +49,6 @@
import androidx.wear.compose.material3.EdgeButtonSize
import androidx.wear.compose.material3.RadioButton
import androidx.wear.compose.material3.ScreenScaffold
-import androidx.wear.compose.material3.ScreenScaffoldDefaults
import androidx.wear.compose.material3.Text
import androidx.wear.compose.material3.TextButton
import androidx.wear.compose.material3.TextButtonDefaults
@@ -71,6 +71,7 @@
val state = rememberLazyListState()
ScreenScaffold(
scrollState = state,
+ contentPadding = PaddingValues(horizontal = 10.dp, vertical = 20.dp),
edgeButton = {
EdgeButton(
onClick = {},
@@ -80,19 +81,12 @@
Text(labels[selectedLabel.intValue], color = Color.White)
}
}
- ) {
+ ) { contentPadding ->
LazyColumn(
state = state,
modifier = Modifier.fillMaxSize(),
verticalArrangement = Arrangement.spacedBy(4.dp),
- contentPadding =
- ScreenScaffoldDefaults.contentPaddingWithEdgeButton(
- edgeButtonSize = EdgeButtonSize.Large,
- 10.dp,
- 20.dp,
- 10.dp,
- 10.dp
- ),
+ contentPadding = contentPadding,
horizontalAlignment = Alignment.CenterHorizontally
) {
items(labels.size) {
@@ -126,6 +120,7 @@
val state = rememberScalingLazyListState()
ScreenScaffold(
scrollState = state,
+ contentPadding = PaddingValues(horizontal = 10.dp, vertical = 20.dp),
edgeButton = {
EdgeButton(
onClick = {},
@@ -135,19 +130,12 @@
Text(labels[selectedLabel.intValue], color = Color.White)
}
}
- ) {
+ ) { contentPadding ->
ScalingLazyColumn(
state = state,
modifier = Modifier.fillMaxSize(),
autoCentering = null,
- contentPadding =
- ScreenScaffoldDefaults.contentPaddingWithEdgeButton(
- edgeButtonSize = EdgeButtonSize.Medium,
- 10.dp,
- 20.dp,
- 10.dp,
- 10.dp
- ),
+ contentPadding = contentPadding,
horizontalAlignment = Alignment.CenterHorizontally
) {
items(labels.size) {
@@ -270,6 +258,7 @@
val state = rememberScalingLazyListState()
ScreenScaffold(
scrollState = state,
+ contentPadding = PaddingValues(horizontal = 10.dp, vertical = 20.dp),
edgeButton = {
EdgeButton(
onClick = {},
@@ -293,18 +282,12 @@
}
}
}
- ) {
+ ) { contentPadding ->
ScalingLazyColumn(
state = state,
modifier = Modifier.fillMaxSize(),
autoCentering = null,
- contentPadding =
- ScreenScaffoldDefaults.contentPaddingWithEdgeButton(
- sizes[selectedSize].second,
- 10.dp,
- 20.dp,
- 10.dp
- ),
+ contentPadding = contentPadding,
horizontalAlignment = Alignment.CenterHorizontally
) {
selection(
diff --git a/wear/compose/compose-material3/integration-tests/src/main/java/androidx/wear/compose/material3/demos/WearMaterial3Demos.kt b/wear/compose/compose-material3/integration-tests/src/main/java/androidx/wear/compose/material3/demos/WearMaterial3Demos.kt
index b70eeef..a30a8f5 100644
--- a/wear/compose/compose-material3/integration-tests/src/main/java/androidx/wear/compose/material3/demos/WearMaterial3Demos.kt
+++ b/wear/compose/compose-material3/integration-tests/src/main/java/androidx/wear/compose/material3/demos/WearMaterial3Demos.kt
@@ -31,7 +31,7 @@
import androidx.wear.compose.material3.samples.EdgeSwipeForSwipeToDismiss
import androidx.wear.compose.material3.samples.HorizontalPagerScaffoldSample
import androidx.wear.compose.material3.samples.ListHeaderSample
-import androidx.wear.compose.material3.samples.ScaffoldSample
+import androidx.wear.compose.material3.samples.ScaffoldWithEdgeButtonSample
import androidx.wear.compose.material3.samples.SimpleSwipeToDismissBox
import androidx.wear.compose.material3.samples.StatefulSwipeToDismissBox
import androidx.wear.compose.material3.samples.SwipeToRevealNonAnchoredSample
@@ -74,7 +74,7 @@
Material3DemoCategory(
"Scaffold",
listOf(
- ComposableDemo("Screen Scaffold") { ScaffoldSample() },
+ ComposableDemo("Screen Scaffold") { ScaffoldWithEdgeButtonSample() },
ComposableDemo("Horizontal Pager Scaffold") {
HorizontalPagerScaffoldSample()
},
diff --git a/wear/compose/compose-material3/macrobenchmark-common/src/main/java/androidx/wear/compose/material3/macrobenchmark/common/TransformingLazyColumnBenchmark.kt b/wear/compose/compose-material3/macrobenchmark-common/src/main/java/androidx/wear/compose/material3/macrobenchmark/common/TransformingLazyColumnBenchmark.kt
index ccf678d..bc24b82 100644
--- a/wear/compose/compose-material3/macrobenchmark-common/src/main/java/androidx/wear/compose/material3/macrobenchmark/common/TransformingLazyColumnBenchmark.kt
+++ b/wear/compose/compose-material3/macrobenchmark-common/src/main/java/androidx/wear/compose/material3/macrobenchmark/common/TransformingLazyColumnBenchmark.kt
@@ -20,6 +20,7 @@
import androidx.benchmark.macro.MacrobenchmarkScope
import androidx.compose.foundation.background
import androidx.compose.foundation.layout.BoxScope
+import androidx.compose.foundation.layout.PaddingValues
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.padding
import androidx.compose.runtime.Composable
@@ -33,10 +34,8 @@
import androidx.wear.compose.foundation.lazy.rememberTransformingLazyColumnState
import androidx.wear.compose.material3.AppScaffold
import androidx.wear.compose.material3.EdgeButton
-import androidx.wear.compose.material3.EdgeButtonSize
import androidx.wear.compose.material3.MaterialTheme
import androidx.wear.compose.material3.ScreenScaffold
-import androidx.wear.compose.material3.ScreenScaffoldDefaults
import androidx.wear.compose.material3.Text
import androidx.wear.compose.material3.lazy.scrollTransform
import kotlinx.coroutines.launch
@@ -50,6 +49,7 @@
AppScaffold {
ScreenScaffold(
state,
+ contentPadding = PaddingValues(horizontal = 10.dp, vertical = 20.dp),
edgeButton = {
EdgeButton(
onClick = { coroutineScope.launch { state.scrollToItem(1) } }
@@ -57,17 +57,10 @@
Text("To top")
}
}
- ) {
+ ) { contentPadding ->
TransformingLazyColumn(
state = state,
- contentPadding =
- ScreenScaffoldDefaults.contentPaddingWithEdgeButton(
- EdgeButtonSize.Small,
- start = 10.dp,
- end = 10.dp,
- top = 20.dp,
- extraBottom = 20.dp
- ),
+ contentPadding = contentPadding,
modifier =
Modifier.background(MaterialTheme.colorScheme.background)
.semantics { contentDescription = CONTENT_DESCRIPTION }
diff --git a/wear/compose/compose-material3/macrobenchmark-common/src/main/java/androidx/wear/compose/material3/macrobenchmark/common/baselineprofile/ScaffoldScreen.kt b/wear/compose/compose-material3/macrobenchmark-common/src/main/java/androidx/wear/compose/material3/macrobenchmark/common/baselineprofile/ScaffoldScreen.kt
index 462a87f..4a2c779 100644
--- a/wear/compose/compose-material3/macrobenchmark-common/src/main/java/androidx/wear/compose/material3/macrobenchmark/common/baselineprofile/ScaffoldScreen.kt
+++ b/wear/compose/compose-material3/macrobenchmark-common/src/main/java/androidx/wear/compose/material3/macrobenchmark/common/baselineprofile/ScaffoldScreen.kt
@@ -19,11 +19,11 @@
import androidx.compose.foundation.layout.BoxScope
import androidx.compose.runtime.Composable
import androidx.wear.compose.material3.macrobenchmark.common.MacrobenchmarkScreen
-import androidx.wear.compose.material3.samples.ScaffoldSample
+import androidx.wear.compose.material3.samples.ScaffoldWithEdgeButtonSample
val ScaffoldScreen =
object : MacrobenchmarkScreen {
override val content: @Composable BoxScope.() -> Unit
- get() = { ScaffoldSample() }
+ get() = { ScaffoldWithEdgeButtonSample() }
}
diff --git a/wear/compose/compose-material3/samples/src/main/java/androidx/wear/compose/material3/samples/AlertDialogSample.kt b/wear/compose/compose-material3/samples/src/main/java/androidx/wear/compose/material3/samples/AlertDialogSample.kt
index 7d0accb..064fe5d 100644
--- a/wear/compose/compose-material3/samples/src/main/java/androidx/wear/compose/material3/samples/AlertDialogSample.kt
+++ b/wear/compose/compose-material3/samples/src/main/java/androidx/wear/compose/material3/samples/AlertDialogSample.kt
@@ -30,6 +30,7 @@
import androidx.compose.runtime.setValue
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
+import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.dp
import androidx.wear.compose.material3.AlertDialog
import androidx.wear.compose.material3.AlertDialogDefaults
@@ -39,6 +40,7 @@
import androidx.wear.compose.material3.SwitchButton
import androidx.wear.compose.material3.Text
+@Preview
@Sampled
@Composable
fun AlertDialogWithConfirmAndDismissSample() {
@@ -83,6 +85,7 @@
)
}
+@Preview
@Sampled
@Composable
fun AlertDialogWithEdgeButtonSample() {
@@ -119,6 +122,7 @@
)
}
+@Preview
@Sampled
@Composable
fun AlertDialogWithContentGroupsSample() {
diff --git a/wear/compose/compose-material3/samples/src/main/java/androidx/wear/compose/material3/samples/EdgeButtonSample.kt b/wear/compose/compose-material3/samples/src/main/java/androidx/wear/compose/material3/samples/EdgeButtonSample.kt
index da9e81b..fbf7a8d 100644
--- a/wear/compose/compose-material3/samples/src/main/java/androidx/wear/compose/material3/samples/EdgeButtonSample.kt
+++ b/wear/compose/compose-material3/samples/src/main/java/androidx/wear/compose/material3/samples/EdgeButtonSample.kt
@@ -20,6 +20,7 @@
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.Column
+import androidx.compose.foundation.layout.PaddingValues
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.fillMaxSize
@@ -39,6 +40,7 @@
import androidx.compose.ui.Modifier
import androidx.compose.ui.platform.LocalConfiguration
import androidx.compose.ui.text.style.TextAlign
+import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.dp
import androidx.wear.compose.foundation.lazy.ScalingLazyColumn
import androidx.wear.compose.foundation.lazy.rememberScalingLazyListState
@@ -48,7 +50,6 @@
import androidx.wear.compose.material3.Icon
import androidx.wear.compose.material3.RadioButton
import androidx.wear.compose.material3.ScreenScaffold
-import androidx.wear.compose.material3.ScreenScaffoldDefaults
import androidx.wear.compose.material3.Text
import androidx.wear.compose.material3.TextButton
import androidx.wear.compose.material3.TextButtonDefaults
@@ -106,6 +107,7 @@
}
}
+@Preview
@Sampled
@Composable
fun EdgeButtonListSample() {
@@ -126,6 +128,7 @@
ScreenScaffold(
scrollState = state,
+ contentPadding = PaddingValues(horizontal = horizontalPadding, vertical = verticalPadding),
edgeButton = {
EdgeButton(
onClick = {},
@@ -143,19 +146,13 @@
Text("Ok")
}
}
- }
- ) {
+ },
+ ) { contentPadding ->
ScalingLazyColumn(
state = state,
modifier = Modifier.fillMaxSize().selectableGroup(),
autoCentering = null,
- contentPadding =
- ScreenScaffoldDefaults.contentPaddingWithEdgeButton(
- edgeButtonSize = EdgeButtonSize.Medium,
- start = horizontalPadding,
- end = horizontalPadding,
- top = verticalPadding,
- ),
+ contentPadding = contentPadding,
horizontalAlignment = Alignment.CenterHorizontally
) {
item { Text("Color") }
diff --git a/wear/compose/compose-material3/samples/src/main/java/androidx/wear/compose/material3/samples/ScaffoldSample.kt b/wear/compose/compose-material3/samples/src/main/java/androidx/wear/compose/material3/samples/ScaffoldSample.kt
index 6db4fb0..49fa6e6 100644
--- a/wear/compose/compose-material3/samples/src/main/java/androidx/wear/compose/material3/samples/ScaffoldSample.kt
+++ b/wear/compose/compose-material3/samples/src/main/java/androidx/wear/compose/material3/samples/ScaffoldSample.kt
@@ -17,16 +17,21 @@
package androidx.wear.compose.material3.samples
import androidx.annotation.Sampled
+import androidx.compose.foundation.layout.PaddingValues
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
+import androidx.compose.ui.tooling.preview.Preview
+import androidx.compose.ui.unit.dp
import androidx.wear.compose.foundation.lazy.ScalingLazyColumn
import androidx.wear.compose.foundation.lazy.rememberScalingLazyListState
import androidx.wear.compose.material3.AppScaffold
import androidx.wear.compose.material3.Button
+import androidx.wear.compose.material3.EdgeButton
import androidx.wear.compose.material3.ScreenScaffold
import androidx.wear.compose.material3.Text
+@Preview
@Sampled
@Composable
fun ScaffoldSample() {
@@ -39,10 +44,54 @@
// For this sample, we will define a single screen inline.
val listState = rememberScalingLazyListState()
- // By default, ScreenScaffold will handle transitions showing/hiding ScrollIndicator
- // and showing/hiding/scrolling away TimeText.
- ScreenScaffold(scrollState = listState) {
- ScalingLazyColumn(state = listState, modifier = Modifier.fillMaxSize()) {
+ // By default, ScreenScaffold will handle transitions showing/hiding ScrollIndicator,
+ // showing/hiding/scrolling away TimeText and optionally hosting the EdgeButton.
+ ScreenScaffold(scrollState = listState, contentPadding = PaddingValues(10.dp)) {
+ contentPadding ->
+ ScalingLazyColumn(
+ state = listState,
+ contentPadding = contentPadding,
+ modifier = Modifier.fillMaxSize()
+ ) {
+ items(10) {
+ Button(
+ onClick = {},
+ label = { Text("Item ${it + 1}") },
+ )
+ }
+ }
+ }
+ }
+}
+
+@Preview
+@Sampled
+@Composable
+fun ScaffoldWithEdgeButtonSample() {
+ // Declare just one [AppScaffold] per app such as in the activity.
+ // [AppScaffold] allows static screen elements (i.e. [TimeText]) to remain visible
+ // during in-app transitions such as swipe-to-dismiss.
+ AppScaffold {
+ // Define the navigation hierarchy within the AppScaffold,
+ // such as using SwipeDismissableNavHost.
+ // For this sample, we will define a single screen inline.
+ val listState = rememberScalingLazyListState()
+
+ // By default, ScreenScaffold will handle transitions showing/hiding ScrollIndicator,
+ // showing/hiding/scrolling away TimeText and optionally hosting the EdgeButton.
+ ScreenScaffold(
+ scrollState = listState,
+ // Define custom spacing between [EdgeButton] and [ScalingLazyColumn].
+ edgeButtonSpacing = 15.dp,
+ edgeButton = { EdgeButton(onClick = {}) { Text("Clear All") } },
+ ) { contentPadding ->
+ ScalingLazyColumn(
+ state = listState,
+ modifier = Modifier.fillMaxSize(),
+ autoCentering = null,
+ // Bottom spacing is derived from [ScreenScaffold.edgeButtonSpacing].
+ contentPadding = contentPadding
+ ) {
items(10) {
Button(
onClick = {},
diff --git a/wear/compose/compose-material3/samples/src/main/java/androidx/wear/compose/material3/samples/TransformingLazyColumnSample.kt b/wear/compose/compose-material3/samples/src/main/java/androidx/wear/compose/material3/samples/TransformingLazyColumnSample.kt
index 0f7005f..20d4a21 100644
--- a/wear/compose/compose-material3/samples/src/main/java/androidx/wear/compose/material3/samples/TransformingLazyColumnSample.kt
+++ b/wear/compose/compose-material3/samples/src/main/java/androidx/wear/compose/material3/samples/TransformingLazyColumnSample.kt
@@ -23,6 +23,7 @@
import androidx.compose.foundation.layout.Arrangement.spacedBy
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.Column
+import androidx.compose.foundation.layout.PaddingValues
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.fillMaxHeight
import androidx.compose.foundation.layout.fillMaxWidth
@@ -49,11 +50,9 @@
import androidx.wear.compose.foundation.lazy.rememberTransformingLazyColumnState
import androidx.wear.compose.material3.AppScaffold
import androidx.wear.compose.material3.EdgeButton
-import androidx.wear.compose.material3.EdgeButtonSize
import androidx.wear.compose.material3.ListHeader
import androidx.wear.compose.material3.MaterialTheme
import androidx.wear.compose.material3.ScreenScaffold
-import androidx.wear.compose.material3.ScreenScaffoldDefaults
import androidx.wear.compose.material3.Text
import androidx.wear.compose.material3.lazy.scrollTransform
import androidx.wear.compose.material3.lazy.targetMorphingHeight
@@ -61,6 +60,7 @@
import kotlinx.coroutines.launch
@Preview
+@Sampled
@Composable
fun TransformingLazyColumnScrollingSample() {
val state = rememberTransformingLazyColumnState()
@@ -76,6 +76,14 @@
elements.subList(index, elements.count())
}
+ fun rainbowColor(progress: Float): Color {
+ val hue = progress * 360f
+ val saturation = 1f
+ val value = 1f
+
+ return Color(android.graphics.Color.HSVToColor(floatArrayOf(hue, saturation, value)))
+ }
+
AppScaffold {
ScreenScaffold(
state,
@@ -89,18 +97,11 @@
Text("Add item")
}
}
- ) {
+ ) { contentPadding ->
val random = remember { Random }
TransformingLazyColumn(
state = state,
- contentPadding =
- ScreenScaffoldDefaults.contentPaddingWithEdgeButton(
- EdgeButtonSize.Small,
- start = 10.dp,
- end = 10.dp,
- top = 20.dp,
- extraBottom = 20.dp
- ),
+ contentPadding = contentPadding,
modifier = Modifier.background(MaterialTheme.colorScheme.background)
) {
items(elements, key = { it }) {
@@ -185,22 +186,16 @@
AppScaffold {
ScreenScaffold(
state,
+ contentPadding = PaddingValues(horizontal = 10.dp, vertical = 20.dp),
edgeButton = {
EdgeButton(onClick = { coroutineScope.launch { state.scrollToItem(1) } }) {
Text("To top")
}
}
- ) {
+ ) { contentPadding ->
TransformingLazyColumn(
state = state,
- contentPadding =
- ScreenScaffoldDefaults.contentPaddingWithEdgeButton(
- EdgeButtonSize.Small,
- start = 10.dp,
- end = 10.dp,
- top = 20.dp,
- extraBottom = 20.dp
- ),
+ contentPadding = contentPadding,
modifier = Modifier.background(MaterialTheme.colorScheme.background)
) {
item(contentType = "header") {
@@ -249,6 +244,7 @@
AppScaffold {
ScreenScaffold(
state,
+ contentPadding = PaddingValues(horizontal = 10.dp),
edgeButton = {
EdgeButton(
onClick = {
@@ -261,15 +257,10 @@
Text("To top")
}
}
- ) {
+ ) { contentPadding ->
TransformingLazyColumn(
state = state,
- contentPadding =
- ScreenScaffoldDefaults.contentPaddingWithEdgeButton(
- EdgeButtonSize.Medium,
- start = 10.dp,
- end = 10.dp
- ),
+ contentPadding = contentPadding,
modifier = Modifier.background(MaterialTheme.colorScheme.background),
) {
item(contentType = "header") {
@@ -303,11 +294,3 @@
}
}
}
-
-private fun rainbowColor(progress: Float): Color {
- val hue = progress * 360f
- val saturation = 1f
- val value = 1f
-
- return Color(android.graphics.Color.HSVToColor(floatArrayOf(hue, saturation, value)))
-}
diff --git a/wear/compose/compose-material3/src/androidTest/kotlin/androidx/wear/compose/material3/ScaffoldTest.kt b/wear/compose/compose-material3/src/androidTest/kotlin/androidx/wear/compose/material3/ScaffoldTest.kt
index c8d82af..4dfb9d5 100644
--- a/wear/compose/compose-material3/src/androidTest/kotlin/androidx/wear/compose/material3/ScaffoldTest.kt
+++ b/wear/compose/compose-material3/src/androidTest/kotlin/androidx/wear/compose/material3/ScaffoldTest.kt
@@ -20,7 +20,6 @@
import androidx.compose.foundation.background
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.BoxScope
-import androidx.compose.foundation.layout.BoxWithConstraints
import androidx.compose.foundation.layout.PaddingValues
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.size
@@ -32,6 +31,7 @@
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
+import androidx.compose.ui.layout.layout
import androidx.compose.ui.platform.LocalDensity
import androidx.compose.ui.platform.testTag
import androidx.compose.ui.test.assertIsDisplayed
@@ -41,6 +41,7 @@
import androidx.compose.ui.test.onNodeWithText
import androidx.compose.ui.test.performTouchInput
import androidx.compose.ui.test.swipeUp
+import androidx.compose.ui.unit.Constraints
import androidx.compose.ui.unit.Dp
import androidx.compose.ui.unit.dp
import androidx.test.filters.SdkSuppress
@@ -129,7 +130,7 @@
val scrollIndicatorColor = Color.Red
rule.setContentWithTheme {
- TestScreenScaffoldWithLazyColumn(
+ TestScreenScaffoldWithTransformingLazyColumn(
scrollIndicatorColor = scrollIndicatorColor,
timeTextColor = Color.Blue
)
@@ -167,7 +168,7 @@
val scrollIndicatorColor = Color.Red
rule.setContentWithTheme {
- TestScreenScaffoldWithLazyColumn(
+ TestScreenScaffoldWithTransformingLazyColumn(
scrollIndicatorColor = scrollIndicatorColor,
timeTextColor = Color.Blue
)
@@ -209,7 +210,7 @@
val timeTextColor = Color.Red
rule.setContentWithTheme {
- TestScreenScaffoldWithLazyColumn(
+ TestScreenScaffoldWithTransformingLazyColumn(
scrollIndicatorColor = Color.Blue,
timeTextColor = timeTextColor
)
@@ -251,7 +252,7 @@
rule.setContentWithTheme {
// Ensure we use the same size no mater where this is run.
Box(Modifier.size(300.dp)) {
- TestScreenScaffoldWithLazyColumn(
+ TestScreenScaffoldWithTransformingLazyColumn(
scrollIndicatorColor = Color.Blue,
timeTextColor = Color.Red
) {
@@ -289,8 +290,9 @@
rule.onNodeWithTag(SCROLL_TAG).performTouchInput { repeat(5) { swipeUp() } }
rule.waitForIdle()
- // Use floats so we can specify a pixel of tolerance.
- assertThat(spaceAvailable.toFloat()).isWithin(1f).of(expectedSpace)
+ // Use floats so we can specify a pixel of tolerance. SLC is less precise with respect to
+ // contentPadding, hence the tolerance is higher.
+ assertThat(spaceAvailable.toFloat()).isWithin(1.5f).of(expectedSpace)
}
@Test
@@ -300,7 +302,7 @@
rule.setContentWithTheme {
// Ensure we use the same size no mater where this is run.
Box(Modifier.size(300.dp)) {
- TestBottomButtonLC {
+ TestBottomButtonLazyColumn {
BoxWithConstraints {
// Check how much space we have for the bottom button
spaceAvailable = constraints.maxHeight
@@ -322,10 +324,10 @@
val screenSize = 300.dp
rule.setContentWithTheme {
- expectedSpace = with(LocalDensity.current) { verticalPadding.toPx() }
+ expectedSpace = with(LocalDensity.current) { verticalPadding.toPx().coerceAtLeast(0f) }
Box(Modifier.size(screenSize)) {
- TestBottomButtonLC(verticalPadding) {
+ TestBottomButtonLazyColumn(verticalPadding) {
// Check how much space we have for the bottom button
BoxWithConstraints { spaceAvailable = constraints.maxHeight }
}
@@ -343,7 +345,7 @@
private fun TestScreenScaffold(
scrollIndicatorColor: Color,
timeTextColor: Color,
- bottomButton: @Composable BoxScope.() -> Unit = {}
+ bottomButton: @Composable BoxScope.() -> Unit
) {
AppScaffold {
val scrollState = rememberScalingLazyListState()
@@ -359,7 +361,44 @@
)
},
timeText = { Box(Modifier.size(20.dp).background(timeTextColor)) },
- edgeButton = bottomButton
+ edgeButton = bottomButton,
+ edgeButtonSpacing = ScreenScaffoldDefaults.EdgeButtonMinSpacing,
+ ) {
+ ScalingLazyColumn(
+ state = scrollState,
+ contentPadding = PaddingValues(horizontal = 0.dp),
+ modifier = Modifier.fillMaxSize().background(Color.Black).testTag(SCROLL_TAG)
+ ) {
+ items(10) {
+ Button(
+ onClick = {},
+ label = { Text("Item ${it + 1}") },
+ )
+ }
+ }
+ }
+ }
+ }
+
+ @Composable
+ private fun TestScreenScaffold(
+ scrollIndicatorColor: Color,
+ timeTextColor: Color,
+ ) {
+ AppScaffold {
+ val scrollState = rememberScalingLazyListState()
+ ScreenScaffold(
+ modifier = Modifier.testTag(TEST_TAG),
+ scrollState = scrollState,
+ scrollIndicator = {
+ Box(
+ modifier =
+ Modifier.size(20.dp)
+ .align(Alignment.CenterEnd)
+ .background(scrollIndicatorColor)
+ )
+ },
+ timeText = { Box(Modifier.size(20.dp).background(timeTextColor)) },
) {
ScalingLazyColumn(
state = scrollState,
@@ -377,10 +416,10 @@
}
@Composable
- private fun TestScreenScaffoldWithLazyColumn(
+ private fun TestScreenScaffoldWithTransformingLazyColumn(
scrollIndicatorColor: Color,
timeTextColor: Color,
- bottomButton: @Composable BoxScope.() -> Unit = {}
+ edgeButton: @Composable BoxScope.() -> Unit = {}
) {
AppScaffold {
val scrollState = rememberTransformingLazyColumnState()
@@ -396,10 +435,12 @@
)
},
timeText = { Box(Modifier.size(20.dp).background(timeTextColor)) },
- edgeButton = bottomButton
+ edgeButton = edgeButton,
+ edgeButtonSpacing = 0.dp,
) {
TransformingLazyColumn(
state = scrollState,
+ contentPadding = it,
modifier = Modifier.fillMaxSize().background(Color.Black).testTag(SCROLL_TAG)
) {
items(10) {
@@ -414,7 +455,7 @@
}
@Composable
- private fun TestBottomButtonLC(
+ private fun TestBottomButtonLazyColumn(
verticalPadding: Dp = 0.dp,
bottomButton: @Composable BoxScope.() -> Unit = {}
) {
@@ -423,7 +464,8 @@
ScreenScaffold(
modifier = Modifier.testTag(TEST_TAG),
scrollState = scrollState,
- edgeButton = bottomButton
+ edgeButton = bottomButton,
+ edgeButtonSpacing = 0.dp,
) {
LazyColumn(
state = scrollState,
@@ -440,6 +482,21 @@
}
}
}
+
+ data class TestConstraintsScope(val constraints: Constraints)
+
+ @Composable
+ fun BoxWithConstraints(onPlaced: TestConstraintsScope.() -> Unit) {
+
+ Box(
+ modifier =
+ Modifier.fillMaxSize().layout { measurable, constraints ->
+ val placeable = measurable.measure(constraints)
+ onPlaced(TestConstraintsScope(constraints))
+ layout(placeable.width, placeable.height) { placeable.place(0, 0) }
+ }
+ )
+ }
}
private const val CONTENT_MESSAGE = "The Content"
diff --git a/wear/compose/compose-material3/src/main/java/androidx/wear/compose/material3/AlertDialog.kt b/wear/compose/compose-material3/src/main/java/androidx/wear/compose/material3/AlertDialog.kt
index e6da9c8..426de7e 100644
--- a/wear/compose/compose-material3/src/main/java/androidx/wear/compose/material3/AlertDialog.kt
+++ b/wear/compose/compose-material3/src/main/java/androidx/wear/compose/material3/AlertDialog.kt
@@ -46,7 +46,6 @@
import androidx.wear.compose.foundation.lazy.ScalingLazyColumn
import androidx.wear.compose.foundation.lazy.ScalingLazyListScope
import androidx.wear.compose.foundation.lazy.rememberScalingLazyListState
-import androidx.wear.compose.material3.AlertDialogDefaults.edgeButtonExtraTopPadding
import androidx.wear.compose.material3.PaddingDefaults.horizontalContentPadding
import androidx.wear.compose.material3.PaddingDefaults.verticalContentPadding
import androidx.wear.compose.material3.internal.Strings
@@ -226,9 +225,8 @@
* @param verticalArrangement The vertical arrangement of the dialog's children. There is a default
* padding between icon, title, and text, which will be added to the spacing specified in this
* [verticalArrangement] parameter.
- * @param contentPadding The padding to apply around the entire dialog's contents. Ensure there is
- * enough space for the [EdgeButton], for example, using
- * [AlertDialogDefaults.contentPaddingWithEdgeButton]
+ * @param contentPadding The padding to apply around the entire dialog's contents. Bottom padding
+ * will be ignored and default spacing for the [EdgeButton] will be used.
* @param properties An optional [DialogProperties] object for configuring the dialog's behavior.
* @param content A slot for additional content, displayed within a scrollable [ScalingLazyColumn].
*/
@@ -242,7 +240,7 @@
icon: @Composable (() -> Unit)? = null,
text: @Composable (() -> Unit)? = null,
verticalArrangement: Arrangement.Vertical = AlertDialogDefaults.VerticalArrangement,
- contentPadding: PaddingValues = AlertDialogDefaults.contentPaddingWithEdgeButton(),
+ contentPadding: PaddingValues = AlertDialogDefaults.contentPadding(),
properties: DialogProperties = DialogProperties(),
content: (ScalingLazyListScope.() -> Unit)? = null
) {
@@ -302,16 +300,28 @@
contentPadding: PaddingValues = AlertDialogDefaults.confirmDismissContentPadding(),
content: (ScalingLazyListScope.() -> Unit)? = null
) {
- AlertDialogImpl(
+ val state = rememberScalingLazyListState(initialCenterItemIndex = 0)
+
+ ScreenScaffold(
+ scrollState = state,
modifier = modifier,
- verticalArrangement = verticalArrangement,
contentPadding = contentPadding,
- title = title,
- icon = icon,
- text = text,
- alertButtonsParams = AlertButtonsParams.ConfirmDismissButtons(confirmButton, dismissButton),
- content = content
- )
+ ) {
+ ScalingLazyColumn(
+ state = state,
+ contentPadding = it,
+ horizontalAlignment = Alignment.CenterHorizontally,
+ verticalArrangement = verticalArrangement,
+ autoCentering = null,
+ modifier = Modifier.fillMaxSize(),
+ ) {
+ alertDialogCommonContent(icon = icon, title = title, text = text, content = content)
+
+ item {
+ ConfirmDismissButtons(confirmButton = confirmButton, dismissButton = dismissButton)
+ }
+ }
+ }
}
/**
@@ -344,16 +354,24 @@
contentPadding: PaddingValues = AlertDialogDefaults.contentPadding(),
content: (ScalingLazyListScope.() -> Unit)? = null
) {
- AlertDialogImpl(
+ val state = rememberScalingLazyListState(initialCenterItemIndex = 0)
+
+ ScreenScaffold(
+ scrollState = state,
modifier = modifier,
- verticalArrangement = verticalArrangement,
contentPadding = contentPadding,
- title = title,
- icon = icon,
- text = text,
- alertButtonsParams = AlertButtonsParams.NoButtons,
- content = content
- )
+ ) {
+ ScalingLazyColumn(
+ state = state,
+ contentPadding = it,
+ horizontalAlignment = Alignment.CenterHorizontally,
+ verticalArrangement = verticalArrangement,
+ autoCentering = null,
+ modifier = Modifier.fillMaxSize(),
+ ) {
+ alertDialogCommonContent(icon, title, text, content)
+ }
+ }
}
/**
@@ -377,9 +395,8 @@
* @param verticalArrangement The vertical arrangement of the dialog's children. There is a default
* padding between icon, title, and text, which will be added to the spacing specified in this
* [verticalArrangement] parameter.
- * @param contentPadding The padding to apply around the entire dialog's contents. Ensure there is
- * enough space for the [EdgeButton], for example, using
- * [AlertDialogDefaults.contentPaddingWithEdgeButton]
+ * @param contentPadding The padding to apply around the entire dialog's contents. Bottom padding
+ * will be ignored and default spacing for the [EdgeButton] will be used.
* @param content A slot for additional content, displayed within a scrollable [ScalingLazyColumn].
*/
@Composable
@@ -390,19 +407,29 @@
icon: @Composable (() -> Unit)? = null,
text: @Composable (() -> Unit)? = null,
verticalArrangement: Arrangement.Vertical = AlertDialogDefaults.VerticalArrangement,
- contentPadding: PaddingValues = AlertDialogDefaults.contentPaddingWithEdgeButton(),
+ contentPadding: PaddingValues = AlertDialogDefaults.contentPadding(),
content: (ScalingLazyListScope.() -> Unit)? = null
) {
- AlertDialogImpl(
+ val state = rememberScalingLazyListState(initialCenterItemIndex = 0)
+
+ ScreenScaffold(
+ scrollState = state,
+ edgeButton = edgeButton,
modifier = modifier,
- verticalArrangement = verticalArrangement,
contentPadding = contentPadding,
- title = title,
- icon = icon,
- text = text,
- alertButtonsParams = AlertButtonsParams.EdgeButton(edgeButton),
- content = content
- )
+ edgeButtonSpacing = AlertEdgeButtonSpacing,
+ ) {
+ ScalingLazyColumn(
+ state = state,
+ contentPadding = it,
+ horizontalAlignment = Alignment.CenterHorizontally,
+ verticalArrangement = verticalArrangement,
+ autoCentering = null,
+ modifier = Modifier.fillMaxSize(),
+ ) {
+ alertDialogCommonContent(icon, title, text, content)
+ }
+ }
}
/** Contains the default values used by [AlertDialog] */
@@ -510,26 +537,6 @@
}
/**
- * The padding to apply around the content for the [AlertDialog] variation with a bottom button.
- * If you need to configure custom paddings, consider using
- * [ScreenScaffoldDefaults.contentPaddingWithEdgeButton]
- */
- @Composable
- public fun contentPaddingWithEdgeButton(
- edgeButtonSize: EdgeButtonSize = EdgeButtonSize.Medium
- ): PaddingValues {
- val topPadding = verticalContentPadding()
- val horizontalPadding = horizontalContentPadding()
- return ScreenScaffoldDefaults.contentPaddingWithEdgeButton(
- edgeButtonSize,
- top = topPadding,
- start = horizontalPadding,
- end = horizontalPadding,
- extraBottom = edgeButtonExtraTopPadding
- )
- }
-
- /**
* The padding to apply around the content for the [AlertDialog] variation with a stack of
* options and no buttons at the end.
*/
@@ -582,61 +589,22 @@
internal val cancelButtonPadding = 1.dp
}
-@Composable
-private fun AlertDialogImpl(
- modifier: Modifier = Modifier,
- verticalArrangement: Arrangement.Vertical,
- contentPadding: PaddingValues,
+private fun ScalingLazyListScope.alertDialogCommonContent(
+ icon: @Composable (() -> Unit)? = null,
title: @Composable () -> Unit,
- icon: @Composable (() -> Unit)?,
text: @Composable (() -> Unit)? = null,
- alertButtonsParams: AlertButtonsParams,
- content: (ScalingLazyListScope.() -> Unit)?
+ content: (ScalingLazyListScope.() -> Unit)? = null
) {
- val state = rememberScalingLazyListState(initialCenterItemIndex = 0)
- ScreenScaffold(
- scrollState = state,
- modifier = modifier,
- edgeButton =
- if (alertButtonsParams is AlertButtonsParams.EdgeButton) {
- {
- Box(
- Modifier.padding(top = edgeButtonExtraTopPadding),
- content = alertButtonsParams.edgeButton
- )
- }
- } else null
- ) {
- ScalingLazyColumn(
- state = state,
- contentPadding = contentPadding,
- horizontalAlignment = Alignment.CenterHorizontally,
- verticalArrangement = verticalArrangement,
- autoCentering = null,
- modifier = Modifier.fillMaxSize(),
- ) {
- if (icon != null) {
- item { IconAlert(icon) }
- }
- item { Title(title) }
- if (text != null) {
- item { TextMessage(text) }
- }
- if (content != null) {
- item { Spacer(Modifier.height(ContentTopSpacing)) }
- content()
- }
-
- when (alertButtonsParams) {
- is AlertButtonsParams.ConfirmDismissButtons ->
- item { ConfirmDismissButtons(alertButtonsParams) }
- is AlertButtonsParams.EdgeButton ->
- if (content == null) {
- item { Spacer(Modifier.height(BottomButtonSpacing)) }
- }
- is AlertButtonsParams.NoButtons -> Unit
- }
- }
+ if (icon != null) {
+ item { IconAlert(icon) }
+ }
+ item { Title(title) }
+ if (text != null) {
+ item { TextMessage(text) }
+ }
+ if (content != null) {
+ item { Spacer(Modifier.height(ContentTopSpacing)) }
+ content()
}
}
@@ -667,7 +635,10 @@
}
@Composable
-private fun ConfirmDismissButtons(alertButtonsParams: AlertButtonsParams.ConfirmDismissButtons) {
+private fun ConfirmDismissButtons(
+ confirmButton: @Composable RowScope.() -> Unit,
+ dismissButton: @Composable RowScope.() -> Unit
+) {
Column {
Spacer(modifier = Modifier.height(ConfirmDismissButtonsTopSpacing))
Row(
@@ -675,12 +646,12 @@
verticalAlignment = Alignment.CenterVertically
) {
Spacer(modifier = Modifier.width(6.dp))
- alertButtonsParams.dismissButton(this)
+ dismissButton(this)
Spacer(
modifier =
Modifier.width(screenWidthDp().dp * ConfirmDismissBetweenButtonsPaddingFraction)
)
- alertButtonsParams.confirmButton(this)
+ confirmButton(this)
Spacer(modifier = Modifier.width(2.dp))
}
Spacer(
@@ -709,20 +680,8 @@
}
}
-private sealed interface AlertButtonsParams {
- object NoButtons : AlertButtonsParams
-
- class EdgeButton(
- val edgeButton: @Composable BoxScope.() -> Unit,
- ) : AlertButtonsParams
-
- class ConfirmDismissButtons(
- val confirmButton: @Composable RowScope.() -> Unit,
- val dismissButton: @Composable RowScope.() -> Unit
- ) : AlertButtonsParams
-}
-
internal val AlertIconBottomSpacing = 4.dp
+internal val AlertEdgeButtonSpacing = 4.dp
internal val AlertTextMessageTopSpacing = 8.dp
internal val ConfirmDismissButtonsTopSpacing = 12.dp
internal const val ConfirmDismissButtonsBottomSpacingFraction = 0.045f
diff --git a/wear/compose/compose-material3/src/main/java/androidx/wear/compose/material3/Button.kt b/wear/compose/compose-material3/src/main/java/androidx/wear/compose/material3/Button.kt
index 7ef944f2..5a3f11e 100644
--- a/wear/compose/compose-material3/src/main/java/androidx/wear/compose/material3/Button.kt
+++ b/wear/compose/compose-material3/src/main/java/androidx/wear/compose/material3/Button.kt
@@ -1442,13 +1442,13 @@
bottom = ButtonVerticalPadding
)
- /** The size of the icon when used with text inside a "[CompactButton]. */
+ /** The recommended icon size when used in [CompactButton]s containing both icon and text. */
public val ExtraSmallIconSize: Dp = CompactButtonTokens.IconSize
- /** The icon size for use with a CompactButton that has icon-only content. */
+ /** The recommended icon size when used in [CompactButton]s containing icon-only content. */
public val SmallIconSize: Dp = CompactButtonTokens.IconOnlyIconSize
- /** The default size of the icon when used inside a [Button]. */
+ /** The recommended default size for icons when used inside a [Button]. */
public val IconSize: Dp = FilledButtonTokens.IconSize
/** The recommended icon size when used in [Button]s for icons such as an app icon */
@@ -1494,7 +1494,7 @@
/**
* The default size of the spacing between an icon and a text when they are used inside a
- * [Button].
+ * [Button] or [CompactButton].
*/
public val IconSpacing: Dp = 6.dp
diff --git a/wear/compose/compose-material3/src/main/java/androidx/wear/compose/material3/EdgeButton.kt b/wear/compose/compose-material3/src/main/java/androidx/wear/compose/material3/EdgeButton.kt
index 6a7f6d8..c24dbc95 100644
--- a/wear/compose/compose-material3/src/main/java/androidx/wear/compose/material3/EdgeButton.kt
+++ b/wear/compose/compose-material3/src/main/java/androidx/wear/compose/material3/EdgeButton.kt
@@ -49,6 +49,8 @@
import androidx.compose.ui.graphics.TransformOrigin
import androidx.compose.ui.graphics.graphicsLayer
import androidx.compose.ui.layout.ContentScale
+import androidx.compose.ui.layout.IntrinsicMeasurable
+import androidx.compose.ui.layout.IntrinsicMeasureScope
import androidx.compose.ui.layout.Measurable
import androidx.compose.ui.layout.MeasureResult
import androidx.compose.ui.layout.MeasureScope
@@ -165,7 +167,7 @@
horizontalArrangement = Arrangement.Center,
modifier =
modifier
- .padding(vertical = VERTICAL_PADDING)
+ .padding(vertical = EdgeButtonVerticalPadding)
.layout { measurable, constraints ->
// Compute the actual size of the button, and save it for later.
// We take the max width available, and the height is determined by the
@@ -280,9 +282,11 @@
*/
@JvmInline
public value class EdgeButtonSize internal constructor(internal val maximumHeight: Dp) {
+ /** Size of the Edge button surrounded by default paddings. */
internal fun maximumHeightPlusPadding() = maximumHeight + VERTICAL_PADDING * 2
- internal fun verticalPadding() =
+ /** Inner padding inside [EdgeButton]. */
+ internal fun verticalContentPadding() =
when (this) {
ExtraSmall -> Pair(10.dp, 12.dp)
Small -> Pair(8.dp, 12.dp)
@@ -361,7 +365,7 @@
internal class ShapeHelper(private val density: Density) {
private val extraSmallHeightPx =
with(density) { EdgeButtonSize.ExtraSmall.maximumHeight.toPx() }
- private val bottomPaddingPx = with(density) { VERTICAL_PADDING.toPx() }
+ private val bottomPaddingPx = with(density) { EdgeButtonVerticalPadding.toPx() }
private val extraSmallEllipsisHeightPx = with(density) { EXTRA_SMALL_ELLIPSIS_HEIGHT.toPx() }
private val targetSidePadding = with(density) { TARGET_SIDE_PADDING.toPx() }
@@ -504,7 +508,7 @@
val scale = (wrapperWidth.toFloat() / placeable.width.coerceAtLeast(1)).coerceAtMost(1f)
- val verticalPadding = buttonSize.verticalPadding()
+ val verticalPadding = buttonSize.verticalContentPadding()
val topPadding = verticalPadding.top().roundToPx()
val bottomPadding = verticalPadding.bottom().roundToPx()
@@ -528,8 +532,16 @@
}
}
}
+
+ override fun IntrinsicMeasureScope.maxIntrinsicHeight(
+ measurable: IntrinsicMeasurable,
+ width: Int
+ ): Int = buttonSize.maximumHeightPlusPadding().roundToPx()
}
+// Padding around the Edge Button on it's top and bottom.
+internal val EdgeButtonVerticalPadding = 3.dp
+
// Syntactic sugar for Pair<Dp, Dp> when used to extra values for top and bottom vertical padding.
private fun Pair<Dp, Dp>.top() = first
diff --git a/wear/compose/compose-material3/src/main/java/androidx/wear/compose/material3/ScreenScaffold.kt b/wear/compose/compose-material3/src/main/java/androidx/wear/compose/material3/ScreenScaffold.kt
index cceea5d..cc231dd 100644
--- a/wear/compose/compose-material3/src/main/java/androidx/wear/compose/material3/ScreenScaffold.kt
+++ b/wear/compose/compose-material3/src/main/java/androidx/wear/compose/material3/ScreenScaffold.kt
@@ -24,8 +24,11 @@
import androidx.compose.foundation.lazy.LazyListState
import androidx.compose.runtime.Composable
import androidx.compose.runtime.DisposableEffect
+import androidx.compose.runtime.getValue
import androidx.compose.runtime.key
+import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
+import androidx.compose.runtime.setValue
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.layout.Measurable
@@ -34,9 +37,11 @@
import androidx.compose.ui.node.LayoutModifierNode
import androidx.compose.ui.node.ModifierNodeElement
import androidx.compose.ui.platform.InspectorInfo
+import androidx.compose.ui.platform.LocalDensity
import androidx.compose.ui.unit.Constraints
import androidx.compose.ui.unit.Dp
import androidx.compose.ui.unit.IntOffset
+import androidx.compose.ui.unit.coerceAtLeast
import androidx.compose.ui.unit.dp
import androidx.wear.compose.foundation.ActiveFocusListener
import androidx.wear.compose.foundation.ScrollInfoProvider
@@ -64,50 +69,104 @@
*
* Example of using AppScaffold and ScreenScaffold:
*
- * @sample androidx.wear.compose.material3.samples.ScaffoldSample
+ * @sample androidx.wear.compose.material3.samples.ScaffoldWithEdgeButtonSample
* @param scrollState The scroll state for [ScalingLazyColumn], used to drive screen transitions
* such as [TimeText] scroll away and showing/hiding [ScrollIndicator].
+ * @param edgeButton Slot for an [EdgeButton] that takes the available space below a scrolling list.
+ * It will scale up and fade in when the user scrolls to the end of the list, and scale down and
+ * fade out as the user scrolls up.
* @param modifier The modifier for the screen scaffold.
+ * @param contentPadding The padding to apply around the entire content. This contentPadding is then
+ * received by the [content] and should be consumed by using [Modifier.padding] or contentPadding
+ * parameter of the lazy lists. The bottom padding value is always ignored because we instead use
+ * [edgeButtonSpacing] to specify the gap between edge button and content - and the [EdgeButton]
+ * hugs the bottom of the screen.
* @param timeText Time text (both time and potentially status message) for this screen, if
* different to the time text at the [AppScaffold] level. When null, the time text from the
* [AppScaffold] is displayed for this screen.
* @param scrollIndicator The [ScrollIndicator] to display on this screen, which is expected to be
* aligned to Center-End. It is recommended to use the Material3 [ScrollIndicator] which is
* provided by default. No scroll indicator is displayed if null is passed.
- * @param edgeButton Optional slot for a [EdgeButton] that takes the available space below a
- * scrolling list. It will scale up and fade in when the user scrolls to the end of the list, and
- * scale down and fade out as the user scrolls up.
- * @param content The body content for this screen.
+ * @param edgeButtonSpacing The space between [EdgeButton] and the list content.
+ * @param content The body content for this screen. The lambda receives a [PaddingValues] that
+ * should be applied to the content root via [Modifier.padding] or contentPadding parameter when
+ * used with lists to properly offset the [EdgeButton].
+ */
+@Composable
+public fun ScreenScaffold(
+ scrollState: ScalingLazyListState,
+ edgeButton: @Composable BoxScope.() -> Unit,
+ modifier: Modifier = Modifier,
+ contentPadding: PaddingValues = ScreenScaffoldDefaults.contentPadding,
+ timeText: (@Composable () -> Unit)? = null,
+ scrollIndicator: (@Composable BoxScope.() -> Unit)? = {
+ ScrollIndicator(scrollState, modifier = Modifier.align(Alignment.CenterEnd))
+ },
+ edgeButtonSpacing: Dp = ScreenScaffoldDefaults.EdgeButtonSpacing,
+ content: @Composable BoxScope.(PaddingValues) -> Unit,
+): Unit =
+ ScreenScaffold(
+ edgeButton = edgeButton,
+ scrollInfoProvider = ScrollInfoProvider(scrollState),
+ modifier = modifier,
+ contentPadding = contentPadding,
+ edgeButtonSpacing = edgeButtonSpacing,
+ timeText = timeText,
+ scrollIndicator = scrollIndicator,
+ content = content
+ )
+
+/**
+ * [ScreenScaffold] is one of the Wear Material3 scaffold components.
+ *
+ * The scaffold components [AppScaffold] and [ScreenScaffold] lay out the structure of a screen and
+ * coordinate transitions of the [ScrollIndicator] and [TimeText] components. [AppScaffold] should
+ * be at the top of the composition (because it provides [ScaffoldState] and layers [TimeText] on
+ * top of all other content) and [ScreenScaffold] should be part of [AppScaffold]'s content. When
+ * used in conjunction with SwipeDismissableNavHost, [AppScaffold] remains at the top of the
+ * composition, whilst [ScreenScaffold] will be placed for each individual composable route.
+ *
+ * [ScreenScaffold] displays the [ScrollIndicator] at the center-end of the screen by default and
+ * coordinates showing/hiding [TimeText] and [ScrollIndicator] according to [scrollState].
+ *
+ * Example of using AppScaffold and ScreenScaffold:
+ *
+ * @sample androidx.wear.compose.material3.samples.ScaffoldSample
+ * @param scrollState The scroll state for [ScalingLazyColumn], used to drive screen transitions
+ * such as [TimeText] scroll away and showing/hiding [ScrollIndicator].
+ * @param modifier The modifier for the screen scaffold.
+ * @param contentPadding The padding to apply around the entire content. This contentPadding is then
+ * received by the [content] and should be consumed by using [Modifier.padding] or contentPadding
+ * parameter of the lazy lists.
+ * @param timeText Time text (both time and potentially status message) for this screen, if
+ * different to the time text at the [AppScaffold] level. When null, the time text from the
+ * [AppScaffold] is displayed for this screen.
+ * @param scrollIndicator The [ScrollIndicator] to display on this screen, which is expected to be
+ * aligned to Center-End. It is recommended to use the Material3 [ScrollIndicator] which is
+ * provided by default. No scroll indicator is displayed if null is passed.
+ * @param content The body content for this screen. The lambda receives a [PaddingValues] that
+ * should be applied to the content root via [Modifier.padding] or contentPadding parameter when
+ * used with lists to properly offset the [EdgeButton].
*/
@Composable
public fun ScreenScaffold(
scrollState: ScalingLazyListState,
modifier: Modifier = Modifier,
+ contentPadding: PaddingValues = ScreenScaffoldDefaults.contentPadding,
timeText: (@Composable () -> Unit)? = null,
scrollIndicator: (@Composable BoxScope.() -> Unit)? = {
ScrollIndicator(scrollState, modifier = Modifier.align(Alignment.CenterEnd))
},
- edgeButton: (@Composable BoxScope.() -> Unit)? = null,
- content: @Composable BoxScope.() -> Unit,
+ content: @Composable BoxScope.(PaddingValues) -> Unit,
): Unit =
- if (edgeButton != null) {
- ScreenScaffold(
- edgeButton,
- ScrollInfoProvider(scrollState),
- modifier,
- timeText,
- scrollIndicator,
- content
- )
- } else {
- ScreenScaffold(
- modifier,
- timeText,
- ScrollInfoProvider(scrollState),
- scrollIndicator,
- content
- )
- }
+ ScreenScaffold(
+ modifier = modifier,
+ contentPadding = contentPadding,
+ timeText = timeText,
+ scrollInfoProvider = ScrollInfoProvider(scrollState),
+ scrollIndicator = scrollIndicator,
+ content = content
+ )
/**
* [ScreenScaffold] is one of the Wear Material3 scaffold components.
@@ -127,6 +186,72 @@
*
* Example of using AppScaffold and ScreenScaffold:
*
+ * @sample androidx.wear.compose.material3.samples.ScaffoldWithEdgeButtonSample
+ *
+ * Example of using ScreenScaffold with a [EdgeButton]:
+ *
+ * @sample androidx.wear.compose.material3.samples.EdgeButtonListSample
+ * @param scrollState The scroll state for [TransformingLazyColumn], used to drive screen
+ * transitions such as [TimeText] scroll away and showing/hiding [ScrollIndicator].
+ * @param edgeButton Slot for an [EdgeButton] that takes the available space below a scrolling list.
+ * It will scale up and fade in when the user scrolls to the end of the list, and scale down and
+ * fade out as the user scrolls up.
+ * @param modifier The modifier for the screen scaffold.
+ * @param contentPadding The padding to apply around the entire content. This contentPadding is then
+ * received by the [content] and should be consumed by using [Modifier.padding] or contentPadding
+ * parameter of the lazy lists. The bottom padding value is always ignored because we instead use
+ * [edgeButtonSpacing] to specify the gap between edge button and content - and the [EdgeButton]
+ * hugs the bottom of the screen.
+ * @param timeText Time text (both time and potentially status message) for this screen, if
+ * different to the time text at the [AppScaffold] level. When null, the time text from the
+ * [AppScaffold] is displayed for this screen.
+ * @param scrollIndicator The [ScrollIndicator] to display on this screen, which is expected to be
+ * aligned to Center-End. It is recommended to use the Material3 [ScrollIndicator] which is
+ * provided by default. No scroll indicator is displayed if null is passed.
+ * @param edgeButtonSpacing The space between [EdgeButton] and the list content.
+ * @param content The body content for this screen. The lambda receives a [PaddingValues] that
+ * should be applied to the content root via [Modifier.padding] or contentPadding parameter when
+ * used with lists to properly offset the [EdgeButton].
+ */
+@Composable
+public fun ScreenScaffold(
+ scrollState: TransformingLazyColumnState,
+ edgeButton: @Composable BoxScope.() -> Unit,
+ modifier: Modifier = Modifier,
+ contentPadding: PaddingValues = ScreenScaffoldDefaults.contentPadding,
+ timeText: (@Composable () -> Unit)? = null,
+ scrollIndicator: (@Composable BoxScope.() -> Unit)? = {
+ ScrollIndicator(scrollState, modifier = Modifier.align(Alignment.CenterEnd))
+ },
+ edgeButtonSpacing: Dp = ScreenScaffoldDefaults.EdgeButtonSpacing,
+ content: @Composable BoxScope.(PaddingValues) -> Unit,
+): Unit =
+ ScreenScaffold(
+ scrollInfoProvider = ScrollInfoProvider(scrollState),
+ edgeButton = edgeButton,
+ modifier = modifier,
+ contentPadding = contentPadding,
+ timeText = timeText,
+ scrollIndicator = scrollIndicator,
+ edgeButtonSpacing = edgeButtonSpacing,
+ content = content
+ )
+
+/**
+ * [ScreenScaffold] is one of the Wear Material3 scaffold components.
+ *
+ * The scaffold components [AppScaffold] and [ScreenScaffold] lay out the structure of a screen and
+ * coordinate transitions of the [ScrollIndicator] and [TimeText] components. [AppScaffold] should
+ * be at the top of the composition (because it provides [ScaffoldState] and layers [TimeText] on
+ * top of all other content) and [ScreenScaffold] should be part of [AppScaffold]'s content. When
+ * used in conjunction with SwipeDismissableNavHost, [AppScaffold] remains at the top of the
+ * composition, whilst [ScreenScaffold] will be placed for each individual composable route.
+ *
+ * [ScreenScaffold] displays the [ScrollIndicator] at the center-end of the screen by default and
+ * coordinates showing/hiding [TimeText] and [ScrollIndicator] according to [scrollState].
+ *
+ * Example of using AppScaffold and ScreenScaffold:
+ *
* @sample androidx.wear.compose.material3.samples.ScaffoldSample
*
* Example of using ScreenScaffold with a [EdgeButton]:
@@ -135,46 +260,38 @@
* @param scrollState The scroll state for [TransformingLazyColumn], used to drive screen
* transitions such as [TimeText] scroll away and showing/hiding [ScrollIndicator].
* @param modifier The modifier for the screen scaffold.
+ * @param contentPadding The padding to apply around the entire content. This contentPadding is then
+ * received by the [content] and should be consumed by using [Modifier.padding] or contentPadding
+ * parameter of the lazy lists.
* @param timeText Time text (both time and potentially status message) for this screen, if
* different to the time text at the [AppScaffold] level. When null, the time text from the
* [AppScaffold] is displayed for this screen.
* @param scrollIndicator The [ScrollIndicator] to display on this screen, which is expected to be
* aligned to Center-End. It is recommended to use the Material3 [ScrollIndicator] which is
* provided by default. No scroll indicator is displayed if null is passed.
- * @param edgeButton Optional slot for a [EdgeButton] that takes the available space below a
- * scrolling list. It will scale up and fade in when the user scrolls to the end of the list, and
- * scale down and fade out as the user scrolls up.
- * @param content The body content for this screen.
+ * @param content The body content for this screen. The lambda receives a [PaddingValues] that
+ * should be applied to the content root via [Modifier.padding] or contentPadding parameter when
+ * used with lists.
*/
@Composable
public fun ScreenScaffold(
scrollState: TransformingLazyColumnState,
modifier: Modifier = Modifier,
+ contentPadding: PaddingValues = ScreenScaffoldDefaults.contentPadding,
timeText: (@Composable () -> Unit)? = null,
scrollIndicator: (@Composable BoxScope.() -> Unit)? = {
ScrollIndicator(scrollState, modifier = Modifier.align(Alignment.CenterEnd))
},
- edgeButton: (@Composable BoxScope.() -> Unit)? = null,
- content: @Composable BoxScope.() -> Unit,
+ content: @Composable BoxScope.(PaddingValues) -> Unit,
): Unit =
- if (edgeButton != null) {
- ScreenScaffold(
- edgeButton,
- ScrollInfoProvider(scrollState),
- modifier,
- timeText,
- scrollIndicator,
- content
- )
- } else {
- ScreenScaffold(
- modifier,
- timeText,
- ScrollInfoProvider(scrollState),
- scrollIndicator,
- content
- )
- }
+ ScreenScaffold(
+ scrollInfoProvider = ScrollInfoProvider(scrollState),
+ modifier = modifier,
+ contentPadding = contentPadding,
+ timeText = timeText,
+ scrollIndicator = scrollIndicator,
+ content = content
+ )
/**
* [ScreenScaffold] is one of the Wear Material3 scaffold components.
@@ -194,50 +311,104 @@
*
* Example of using AppScaffold and ScreenScaffold:
*
- * @sample androidx.wear.compose.material3.samples.ScaffoldSample
+ * @sample androidx.wear.compose.material3.samples.ScaffoldWithEdgeButtonSample
* @param scrollState The scroll state for [androidx.compose.foundation.lazy.LazyColumn], used to
* drive screen transitions such as [TimeText] scroll away and showing/hiding [ScrollIndicator].
+ * @param edgeButton Slot for an [EdgeButton] that takes the available space below a scrolling list.
+ * It will scale up and fade in when the user scrolls to the end of the list, and scale down and
+ * fade out as the user scrolls up.
* @param modifier The modifier for the screen scaffold.
+ * @param contentPadding The padding to apply around the entire content. This contentPadding is then
+ * received by the [content] and should be consumed by using [Modifier.padding] or contentPadding
+ * parameter of the lazy lists. The bottom padding value is always ignored because we instead use
+ * [edgeButtonSpacing] to specify the gap between edge button and content - and the [EdgeButton]
+ * hugs the bottom of the screen.
* @param timeText Time text (both time and potentially status message) for this screen, if
* different to the time text at the [AppScaffold] level. When null, the time text from the
* [AppScaffold] is displayed for this screen.
* @param scrollIndicator The [ScrollIndicator] to display on this screen, which is expected to be
* aligned to Center-End. It is recommended to use the Material3 [ScrollIndicator] which is
* provided by default. No scroll indicator is displayed if null is passed.
- * @param edgeButton Optional slot for a [EdgeButton] that takes the available space below a
- * scrolling list. It will scale up and fade in when the user scrolls to the end of the list, and
- * scale down and fade out as the user scrolls up.
- * @param content The body content for this screen.
+ * @param edgeButtonSpacing The space between [EdgeButton] and the list content.
+ * @param content The body content for this screen. The lambda receives a [PaddingValues] that
+ * should be applied to the content root via [Modifier.padding] or contentPadding parameter when
+ * used with lists to properly offset the [EdgeButton].
+ */
+@Composable
+public fun ScreenScaffold(
+ scrollState: LazyListState,
+ edgeButton: @Composable BoxScope.() -> Unit,
+ modifier: Modifier = Modifier,
+ contentPadding: PaddingValues = ScreenScaffoldDefaults.contentPadding,
+ timeText: (@Composable () -> Unit)? = null,
+ scrollIndicator: (@Composable BoxScope.() -> Unit)? = {
+ ScrollIndicator(scrollState, modifier = Modifier.align(Alignment.CenterEnd))
+ },
+ edgeButtonSpacing: Dp = ScreenScaffoldDefaults.EdgeButtonSpacing,
+ content: @Composable BoxScope.(PaddingValues) -> Unit,
+): Unit =
+ ScreenScaffold(
+ scrollInfoProvider = ScrollInfoProvider(scrollState),
+ edgeButton = edgeButton,
+ modifier = modifier,
+ contentPadding = contentPadding,
+ timeText = timeText,
+ scrollIndicator = scrollIndicator,
+ edgeButtonSpacing = edgeButtonSpacing,
+ content = content
+ )
+
+/**
+ * [ScreenScaffold] is one of the Wear Material3 scaffold components.
+ *
+ * The scaffold components [AppScaffold] and [ScreenScaffold] lay out the structure of a screen and
+ * coordinate transitions of the [ScrollIndicator] and [TimeText] components. [AppScaffold] should
+ * be at the top of the composition (because it provides [ScaffoldState] and layers [TimeText] on
+ * top of all other content) and [ScreenScaffold] should be part of [AppScaffold]'s content. When
+ * used in conjunction with SwipeDismissableNavHost, [AppScaffold] remains at the top of the
+ * composition, whilst [ScreenScaffold] will be placed for each individual composable route.
+ *
+ * [ScreenScaffold] displays the [ScrollIndicator] at the center-end of the screen by default and
+ * coordinates showing/hiding [TimeText] and [ScrollIndicator] according to [scrollState].
+ *
+ * Example of using AppScaffold and ScreenScaffold:
+ *
+ * @sample androidx.wear.compose.material3.samples.ScaffoldSample
+ * @param scrollState The scroll state for [androidx.compose.foundation.lazy.LazyColumn], used to
+ * drive screen transitions such as [TimeText] scroll away and showing/hiding [ScrollIndicator].
+ * @param modifier The modifier for the screen scaffold.
+ * @param contentPadding The padding to apply around the entire content. This contentPadding is then
+ * received by the [content] and should be consumed by using [Modifier.padding] or contentPadding
+ * parameter of the lazy lists.
+ * @param timeText Time text (both time and potentially status message) for this screen, if
+ * different to the time text at the [AppScaffold] level. When null, the time text from the
+ * [AppScaffold] is displayed for this screen.
+ * @param scrollIndicator The [ScrollIndicator] to display on this screen, which is expected to be
+ * aligned to Center-End. It is recommended to use the Material3 [ScrollIndicator] which is
+ * provided by default. No scroll indicator is displayed if null is passed.
+ * @param content The body content for this screen. The lambda receives a [PaddingValues] that
+ * should be applied to the content root via [Modifier.padding] or contentPadding parameter when
+ * used with lists.
*/
@Composable
public fun ScreenScaffold(
scrollState: LazyListState,
modifier: Modifier = Modifier,
+ contentPadding: PaddingValues = ScreenScaffoldDefaults.contentPadding,
timeText: (@Composable () -> Unit)? = null,
scrollIndicator: (@Composable BoxScope.() -> Unit)? = {
ScrollIndicator(scrollState, modifier = Modifier.align(Alignment.CenterEnd))
},
- edgeButton: (@Composable BoxScope.() -> Unit)? = null,
- content: @Composable BoxScope.() -> Unit,
+ content: @Composable BoxScope.(PaddingValues) -> Unit,
): Unit =
- if (edgeButton != null) {
- ScreenScaffold(
- edgeButton,
- ScrollInfoProvider(scrollState),
- modifier,
- timeText,
- scrollIndicator,
- content
- )
- } else {
- ScreenScaffold(
- modifier,
- timeText,
- ScrollInfoProvider(scrollState),
- scrollIndicator,
- content
- )
- }
+ ScreenScaffold(
+ scrollInfoProvider = ScrollInfoProvider(scrollState),
+ modifier = modifier,
+ contentPadding = contentPadding,
+ timeText = timeText,
+ scrollIndicator = scrollIndicator,
+ content = content
+ )
/**
* [ScreenScaffold] is one of the Wear Material3 scaffold components.
@@ -260,25 +431,38 @@
* @param scrollState The scroll state for a Column, used to drive screen transitions such as
* [TimeText] scroll away and showing/hiding [ScrollIndicator].
* @param modifier The modifier for the screen scaffold.
+ * @param contentPadding The padding to apply around the entire content. This contentPadding is then
+ * received by the [content] and should be consumed by using [Modifier.padding] or contentPadding
+ * parameter of the lazy lists.
* @param timeText Time text (both time and potentially status message) for this screen, if
* different to the time text at the [AppScaffold] level. When null, the time text from the
* [AppScaffold] is displayed for this screen.
* @param scrollIndicator The [ScrollIndicator] to display on this screen, which is expected to be
* aligned to Center-End. It is recommended to use the Material3 [ScrollIndicator] which is
* provided by default. No scroll indicator is displayed if null is passed.
- * @param content The body content for this screen.
+ * @param content The body content for this screen. The lambda receives a [PaddingValues] that
+ * should be applied to the content root via [Modifier.padding] or contentPadding parameter when
+ * used with lists.
*/
@Composable
public fun ScreenScaffold(
scrollState: ScrollState,
modifier: Modifier = Modifier,
+ contentPadding: PaddingValues = ScreenScaffoldDefaults.contentPadding,
timeText: (@Composable () -> Unit)? = null,
scrollIndicator: (@Composable BoxScope.() -> Unit)? = {
ScrollIndicator(scrollState, modifier = Modifier.align(Alignment.CenterEnd))
},
- content: @Composable BoxScope.() -> Unit,
+ content: @Composable BoxScope.(PaddingValues) -> Unit,
): Unit =
- ScreenScaffold(modifier, timeText, ScrollInfoProvider(scrollState), scrollIndicator, content)
+ ScreenScaffold(
+ scrollInfoProvider = ScrollInfoProvider(scrollState),
+ modifier = modifier,
+ contentPadding = contentPadding,
+ timeText = timeText,
+ scrollIndicator = scrollIndicator,
+ content = content
+ )
/**
* [ScreenScaffold] is one of the Wear Material3 scaffold components.
@@ -300,47 +484,84 @@
*
* Example of using AppScaffold and ScreenScaffold:
*
- * @sample androidx.wear.compose.material3.samples.ScaffoldSample
- * @param edgeButton slot for a [EdgeButton] that takes the available space below a scrolling list.
- * It will scale up and fade in when the user scrolls to the end of the list, and scale down and
- * fade out as the user scrolls up.
+ * @sample androidx.wear.compose.material3.samples.ScaffoldWithEdgeButtonSample
* @param scrollInfoProvider Provider for scroll information used to scroll away screen elements
* such as [TimeText] and coordinate showing/hiding the [ScrollIndicator], this needs to be a
* [ScrollInfoProvider].
+ * @param edgeButton slot for a [EdgeButton] that takes the available space below a scrolling list.
+ * It will scale up and fade in when the user scrolls to the end of the list, and scale down and
+ * fade out as the user scrolls up.
* @param modifier The modifier for the screen scaffold.
+ * @param contentPadding The padding to apply around the entire content. This contentPadding is then
+ * received by the [content] and should be consumed by using [Modifier.padding] or contentPadding
+ * parameter of the lazy lists. The bottom padding value is always ignored because we instead use
+ * [edgeButtonSpacing] to specify the gap between edge button and content - and the [EdgeButton]
+ * hugs the bottom of the screen.
* @param timeText Time text (both time and potentially status message) for this screen, if
* different to the time text at the [AppScaffold] level. When null, the time text from the
* [AppScaffold] is displayed for this screen.
* @param scrollIndicator The [ScrollIndicator] to display on this screen, which is expected to be
* aligned to Center-End. It is recommended to use the Material3 [ScrollIndicator] which is
* provided by default. No scroll indicator is displayed if null is passed.
- * @param content The body content for this screen.
+ * @param edgeButtonSpacing The space between [EdgeButton] and the list content. This gap size could
+ * not be smaller then [ScreenScaffoldDefaults.EdgeButtonMinSpacing].
+ * @param content The body content for this screen. The lambda receives a [PaddingValues] that
+ * should be applied to the content root via [Modifier.padding] or contentPadding parameter when
+ * used with lists to properly offset the [EdgeButton].
*/
@Composable
public fun ScreenScaffold(
- edgeButton: @Composable BoxScope.() -> Unit,
scrollInfoProvider: ScrollInfoProvider,
+ edgeButton: @Composable BoxScope.() -> Unit,
modifier: Modifier = Modifier,
+ contentPadding: PaddingValues = ScreenScaffoldDefaults.contentPadding,
timeText: (@Composable () -> Unit)? = null,
scrollIndicator: (@Composable BoxScope.() -> Unit)? = null,
- content: @Composable BoxScope.() -> Unit,
-): Unit =
+ edgeButtonSpacing: Dp = ScreenScaffoldDefaults.EdgeButtonSpacing,
+ content: @Composable BoxScope.(PaddingValues) -> Unit,
+): Unit {
+ val effectiveEdgeButtonSpacing =
+ (edgeButtonSpacing - ScreenScaffoldDefaults.EdgeButtonMinSpacing).coerceAtLeast(0.dp)
+ // Adds the gap between content and edge button.
+ val lastItemOffsetCorrection = with(LocalDensity.current) { effectiveEdgeButtonSpacing.toPx() }
+ val localDensity = LocalDensity.current
+
ScreenScaffold(
- modifier,
- timeText,
- scrollInfoProvider,
- scrollIndicator,
+ modifier = modifier,
+ contentPadding = contentPadding,
+ timeText = timeText,
+ scrollInfoProvider = scrollInfoProvider,
+ scrollIndicator = scrollIndicator,
content = {
- content()
+ var intrinsicButtonHeight by remember(edgeButton) { mutableStateOf<Float?>(null) }
+
+ content(
+ // Replace bottom content padding adjusted for the edge button.
+ ReplacePaddingValues(
+ contentPadding,
+ with(localDensity) {
+ (intrinsicButtonHeight?.toDp() ?: 0.dp) + effectiveEdgeButtonSpacing
+ }
+ )
+ )
Box(
- Modifier.align(Alignment.BottomCenter).dynamicHeight {
- scrollInfoProvider.lastItemOffset.coerceAtLeast(0f)
- },
contentAlignment = Alignment.BottomCenter,
- content = edgeButton
+ content = edgeButton,
+ modifier =
+ Modifier.align(Alignment.BottomCenter).dynamicHeight(
+ onIntrinsicHeightMeasured = {
+ if (intrinsicButtonHeight != it) {
+ intrinsicButtonHeight = it
+ }
+ }
+ ) {
+ (scrollInfoProvider.lastItemOffset - lastItemOffsetCorrection)
+ .coerceAtLeast(0f)
+ },
)
}
)
+}
/**
* [ScreenScaffold] is one of the Wear Material3 scaffold components.
@@ -359,24 +580,30 @@
*
* @sample androidx.wear.compose.material3.samples.ScaffoldSample
* @param modifier The modifier for the screen scaffold.
+ * @param scrollInfoProvider Provider for scroll information used to scroll away screen elements
+ * such as [TimeText] and coordinate showing/hiding the [ScrollIndicator].
+ * @param contentPadding The padding to apply around the entire content. This contentPadding is then
+ * received by the [content] and should be consumed by using [Modifier.padding] or contentPadding
+ * parameter of the lazy lists.
* @param timeText Time text (both time and potentially status message) for this screen, if
* different to the time text at the [AppScaffold] level. When null, the time text from the
* [AppScaffold] is displayed for this screen.
- * @param scrollInfoProvider Provider for scroll information used to scroll away screen elements
- * such as [TimeText] and coordinate showing/hiding the [ScrollIndicator].
* @param scrollIndicator The [ScrollIndicator] to display on this screen, which is expected to be
* aligned to Center-End. It is recommended to use the Material3 [ScrollIndicator] which is
* provided by default. No scroll indicator is displayed if null is passed.
- * @param content The body content for this screen.
+ * @param content The body content for this screen. The lambda receives a [PaddingValues] that
+ * should be applied to the content root via [Modifier.padding] or contentPadding parameter when
+ * used with lists.
*/
@Composable
public fun ScreenScaffold(
modifier: Modifier = Modifier,
- timeText: (@Composable () -> Unit)? = null,
scrollInfoProvider: ScrollInfoProvider? = null,
+ contentPadding: PaddingValues = ScreenScaffoldDefaults.contentPadding,
+ timeText: (@Composable () -> Unit)? = null,
scrollIndicator: (@Composable BoxScope.() -> Unit)? = null,
- content: @Composable BoxScope.() -> Unit,
-) {
+ content: @Composable BoxScope.(PaddingValues) -> Unit,
+): Unit {
val scaffoldState = LocalScaffoldState.current
val key = remember { Any() }
@@ -395,7 +622,7 @@
scaffoldState.UpdateIdlingDetectorIfNeeded()
Box(modifier = modifier.fillMaxSize()) {
- content()
+ content(contentPadding)
scrollInfoProvider?.let {
AnimatedIndicator(
isVisible = {
@@ -421,6 +648,10 @@
* edge button size.
* @return A [PaddingValues] object with the calculated padding.
*/
+ @Deprecated(
+ "Use the combination of a new contentPadding parameter on the ScreenScaffold to " +
+ "get back the padding values inside of the content lambda."
+ )
public fun contentPaddingWithEdgeButton(
edgeButtonSize: EdgeButtonSize,
start: Dp = 0.dp,
@@ -429,34 +660,62 @@
extraBottom: Dp = 0.dp,
): PaddingValues =
PaddingValues(start, top, end, extraBottom + edgeButtonSize.maximumHeightPlusPadding())
+
+ /** The default space between [EdgeButton] and list content in [ScreenScaffold]. */
+ public val EdgeButtonSpacing: Dp = 16.dp
+
+ /** The minimum space between [EdgeButton] and list content in [ScreenScaffold]. */
+ public val EdgeButtonMinSpacing: Dp = EdgeButtonVerticalPadding
+
+ /** Default contentPadding added to the [ScreenScaffold]. */
+ public val contentPadding: PaddingValues
+ @Composable
+ get() =
+ PaddingValues(
+ horizontal = PaddingDefaults.horizontalContentPadding(),
+ vertical = PaddingDefaults.verticalContentPadding()
+ )
}
// Sets the height that will be used down the line, using a state as parameter, to avoid
// recompositions when the height changes.
-internal fun Modifier.dynamicHeight(heightState: () -> Float) =
- this.then(DynamicHeightElement(heightState))
+internal fun Modifier.dynamicHeight(
+ onIntrinsicHeightMeasured: (Float) -> Unit,
+ heightState: () -> Float
+) = this.then(DynamicHeightElement(onIntrinsicHeightMeasured, heightState))
// Following classes 'inspired' by 'WrapContentElement' / 'WrapContentNode'
-private class DynamicHeightElement(val heightState: () -> Float) :
- ModifierNodeElement<DynamicHeightNode>() {
- override fun create(): DynamicHeightNode = DynamicHeightNode(heightState)
+private class DynamicHeightElement(
+ val onIntrinsicHeightMeasured: (Float) -> Unit,
+ val heightState: () -> Float
+) : ModifierNodeElement<DynamicHeightNode>() {
+ override fun create(): DynamicHeightNode =
+ DynamicHeightNode(onIntrinsicHeightMeasured, heightState)
override fun update(node: DynamicHeightNode) {
node.heightState = heightState
+ node.onIntrinsicHeightMeasured = onIntrinsicHeightMeasured
}
override fun InspectorInfo.inspectableProperties() {
- name = "MyHeightElement"
+ name = "DynamicHeightElement"
}
override fun equals(other: Any?) =
- other is DynamicHeightElement && heightState === other.heightState
+ other is DynamicHeightElement &&
+ heightState === other.heightState &&
+ onIntrinsicHeightMeasured === other.onIntrinsicHeightMeasured
- override fun hashCode() = heightState.hashCode()
+ override fun hashCode() = 31 * heightState.hashCode() + onIntrinsicHeightMeasured.hashCode()
}
-private class DynamicHeightNode(var heightState: () -> Float) :
- LayoutModifierNode, Modifier.Node() {
+private class DynamicHeightNode(
+ var onIntrinsicHeightMeasured: (Float) -> Unit,
+ var heightState: () -> Float
+) : LayoutModifierNode, Modifier.Node() {
+
+ var lastMeasureHeight: Int? = null
+
override fun MeasureScope.measure(
measurable: Measurable,
constraints: Constraints
@@ -464,7 +723,10 @@
// Similar to .fillMaxWidth().height(heightState.value) but we observe the state in the
// measurement pass, not on Composition.
val height = heightState().roundToInt()
-
+ if (lastMeasureHeight == null || height > 0 && lastMeasureHeight != height) {
+ onIntrinsicHeightMeasured(measurable.maxIntrinsicHeight(constraints.maxWidth).toFloat())
+ lastMeasureHeight = height
+ }
val wrappedConstraints =
Constraints(constraints.maxWidth, constraints.maxWidth, height, height)
val placeable = measurable.measure(wrappedConstraints)
@@ -481,3 +743,8 @@
}
}
}
+
+private class ReplacePaddingValues(paddingValues: PaddingValues, val bottomPadding: Dp) :
+ PaddingValues by paddingValues {
+ override fun calculateBottomPadding(): Dp = bottomPadding
+}
diff --git a/wear/compose/compose-material3/src/main/java/androidx/wear/compose/material3/lazy/ScrollTransform.kt b/wear/compose/compose-material3/src/main/java/androidx/wear/compose/material3/lazy/ScrollTransform.kt
index f2bcb1a..61ecf39 100644
--- a/wear/compose/compose-material3/src/main/java/androidx/wear/compose/material3/lazy/ScrollTransform.kt
+++ b/wear/compose/compose-material3/src/main/java/androidx/wear/compose/material3/lazy/ScrollTransform.kt
@@ -93,7 +93,7 @@
* [TransformingLazyColumnItemScope]. It adjusts the height, position, applies scaling and morphing
* effects as the item scrolls.
*
- * @sample androidx.wear.compose.material3.samples.TransformingLazyColumnScalingMorphingEffectSample
+ * @sample androidx.wear.compose.material3.samples.TransformingLazyColumnScrollingSample
* @param scope The [TransformingLazyColumnItemScope] provides access to the item's index and key.
* @param shape [Shape] of the background.
* @param painter [Painter] to use for the background.
@@ -137,7 +137,7 @@
* [Shape] and background [Color] (or [Painter]) so the modifier can do the background drawing and
* apply specific effects to background and content, as in the Material spec.
*
- * @sample androidx.wear.compose.material3.samples.TransformingLazyColumnScalingMorphingEffectSample
+ * @sample androidx.wear.compose.material3.samples.TransformingLazyColumnScrollingSample
* @param scope The [TransformingLazyColumnItemScope] provides access to the item's index and key.
*/
@Composable
diff --git a/wear/compose/integration-tests/demos/src/main/java/androidx/wear/compose/integration/demos/ScalingLazyColumnDemo.kt b/wear/compose/integration-tests/demos/src/main/java/androidx/wear/compose/integration/demos/ScalingLazyColumnDemo.kt
index 16c8bdc..6d20742 100644
--- a/wear/compose/integration-tests/demos/src/main/java/androidx/wear/compose/integration/demos/ScalingLazyColumnDemo.kt
+++ b/wear/compose/integration-tests/demos/src/main/java/androidx/wear/compose/integration/demos/ScalingLazyColumnDemo.kt
@@ -24,10 +24,10 @@
import androidx.compose.ui.Modifier
import androidx.compose.ui.geometry.Offset
import androidx.compose.ui.graphics.Color
-import androidx.compose.ui.platform.LocalContext
+import androidx.compose.ui.platform.LocalConfiguration
import androidx.compose.ui.platform.LocalDensity
import androidx.compose.ui.text.style.TextAlign
-import androidx.compose.ui.unit.Dp
+import androidx.compose.ui.unit.dp
import androidx.wear.compose.foundation.lazy.ScalingLazyColumn
import androidx.wear.compose.foundation.lazy.rememberScalingLazyListState
import androidx.wear.compose.material.AppCard
@@ -58,11 +58,8 @@
@Composable
fun ScalingLazyColumnDetail() {
val state = rememberScalingLazyListState()
- val applicationContext = LocalContext.current
val screenHeightPx =
- with(LocalDensity.current) {
- Dp(applicationContext.resources.configuration.screenHeightDp.toFloat()).roundToPx()
- }
+ with(LocalDensity.current) { LocalConfiguration.current.screenHeightDp.dp.roundToPx() }
val halfScreenHeightPx = screenHeightPx / 2f
ScalingLazyColumn(modifier = Modifier.fillMaxWidth(), state = state) {
item {
diff --git a/wear/protolayout/protolayout-proto/src/main/proto/color.proto b/wear/protolayout/protolayout-proto/src/main/proto/color.proto
index f743302..d5efd4c 100644
--- a/wear/protolayout/protolayout-proto/src/main/proto/color.proto
+++ b/wear/protolayout/protolayout-proto/src/main/proto/color.proto
@@ -80,10 +80,46 @@
DegreesProp end_angle = 3;
}
+// A linear gradient with the provided colors based on defined start and end
+// coordinates.
+//
+// The colors are dispersed at the offsets defined in each color stop.
+message LinearGradient {
+ // The color stops defining how the colors are distributed from the start to
+ // the end coordinates.
+ //
+ // A color stop is a pair of a color and its offset in the gradient.
+ // The offset is the relative position of the color, beginning with 0 at the
+ // start coordinate and ending with 1.0 at the end coordinate.
+ //
+ // There must be at least 2 colors and at most 10 colors.
+ //
+ // If offset values are not set, the colors are evenly distributed in the
+ // gradient.
+ repeated ColorStop color_stops = 1;
+
+ // The starting x position of the linear gradient. Defaults to the left side
+ // of the element.
+ OffsetDimension start_x = 2;
+
+ // The starting y position of the linear gradient. Defaults to the top side of
+ // the element.
+ OffsetDimension start_y = 3;
+
+ // The ending y position of the linear gradient. Defaults to the right side of
+ // the element.
+ OffsetDimension end_x = 4;
+
+ // The ending y position of the linear gradient. Defaults to the top side of
+ // the element.
+ OffsetDimension end_y = 5;
+}
+
// A Brush describes how something is drawn on screen.
// It determines the color(s) that are drawn in the drawing area.
message Brush {
oneof inner {
SweepGradient sweep_gradient = 1;
+ LinearGradient linear_gradient = 2;
}
}
diff --git a/wear/protolayout/protolayout-proto/src/main/proto/dimension.proto b/wear/protolayout/protolayout-proto/src/main/proto/dimension.proto
index 312d58c..43dc615 100644
--- a/wear/protolayout/protolayout-proto/src/main/proto/dimension.proto
+++ b/wear/protolayout/protolayout-proto/src/main/proto/dimension.proto
@@ -207,3 +207,15 @@
BoundingBoxRatio location_ratio = 2;
}
}
+
+// A dimension that represents an offset relative to an elements position.
+message OffsetDimension {
+ oneof inner {
+ // Location in dp, with the default being the point at the top left of the
+ // element.
+ DpProp offset_dp = 1;
+ // Location proportional to the bounding box, with the bounding box's
+ // top/left as 0 and bottom/right as 1.
+ BoundingBoxRatio location_ratio = 2;
+ }
+}
diff --git a/wear/protolayout/protolayout-proto/src/main/proto/layout.proto b/wear/protolayout/protolayout-proto/src/main/proto/layout.proto
index a81a412..1affc10 100644
--- a/wear/protolayout/protolayout-proto/src/main/proto/layout.proto
+++ b/wear/protolayout/protolayout-proto/src/main/proto/layout.proto
@@ -689,6 +689,8 @@
// A brush used to draw this line. If set, the brush will be used instead of
// the color provided in {@code setColor()}.
+ //
+ // Only SweepGradient is supported.
Brush brush = 7;
// Modifiers for this element.
diff --git a/wear/protolayout/protolayout-proto/src/main/proto/modifiers.proto b/wear/protolayout/protolayout-proto/src/main/proto/modifiers.proto
index e3c53e9..c991e82 100644
--- a/wear/protolayout/protolayout-proto/src/main/proto/modifiers.proto
+++ b/wear/protolayout/protolayout-proto/src/main/proto/modifiers.proto
@@ -179,12 +179,21 @@
// While this field is statically accessible from 1.0, it's only bindable
// since version 1.2 and renderers supporting version 1.2 will use the dynamic
// value (if set).
+ //
+ // If a brush is set, this color will only be used if brush is not supported
+ // by the renderer (versions below 1.5).
ColorProp color = 1;
// The corner properties of this element. This only affects the drawing of
// this element if it has a background color or border. If not defined,
// defaults to having a square corner.
Corner corner = 2;
+
+ // A brush used to draw the background. If set and supported, the brush will be
+ // used instead of the color provided in {@code setColor()}.
+ //
+ // Only LinearGradient is supported.
+ Brush brush = 3;
}
// Metadata about an element. For use by libraries building higher-level
diff --git a/wear/protolayout/protolayout/api/current.txt b/wear/protolayout/protolayout/api/current.txt
index b58a040..c8453dc 100644
--- a/wear/protolayout/protolayout/api/current.txt
+++ b/wear/protolayout/protolayout/api/current.txt
@@ -131,6 +131,24 @@
method public androidx.wear.protolayout.ColorBuilders.ColorStop build();
}
+ @androidx.wear.protolayout.expression.RequiresSchemaVersion(major=1, minor=500) public static final class ColorBuilders.LinearGradient implements androidx.wear.protolayout.ColorBuilders.Brush {
+ method public java.util.List<androidx.wear.protolayout.ColorBuilders.ColorStop!> getColorStops();
+ method public androidx.wear.protolayout.DimensionBuilders.OffsetDimension? getEndX();
+ method public androidx.wear.protolayout.DimensionBuilders.OffsetDimension? getEndY();
+ method public androidx.wear.protolayout.DimensionBuilders.OffsetDimension? getStartX();
+ method public androidx.wear.protolayout.DimensionBuilders.OffsetDimension? getStartY();
+ }
+
+ public static final class ColorBuilders.LinearGradient.Builder {
+ ctor @androidx.wear.protolayout.expression.RequiresSchemaVersion(major=1, minor=500) @java.lang.SafeVarargs public ColorBuilders.LinearGradient.Builder(androidx.wear.protolayout.ColorBuilders.ColorProp!...);
+ ctor @androidx.wear.protolayout.expression.RequiresSchemaVersion(major=1, minor=500) @java.lang.SafeVarargs public ColorBuilders.LinearGradient.Builder(androidx.wear.protolayout.ColorBuilders.ColorStop!...);
+ method public androidx.wear.protolayout.ColorBuilders.LinearGradient build();
+ method @androidx.wear.protolayout.expression.RequiresSchemaVersion(major=1, minor=500) public androidx.wear.protolayout.ColorBuilders.LinearGradient.Builder setEndX(androidx.wear.protolayout.DimensionBuilders.OffsetDimension);
+ method @androidx.wear.protolayout.expression.RequiresSchemaVersion(major=1, minor=500) public androidx.wear.protolayout.ColorBuilders.LinearGradient.Builder setEndY(androidx.wear.protolayout.DimensionBuilders.OffsetDimension);
+ method @androidx.wear.protolayout.expression.RequiresSchemaVersion(major=1, minor=500) public androidx.wear.protolayout.ColorBuilders.LinearGradient.Builder setStartX(androidx.wear.protolayout.DimensionBuilders.OffsetDimension);
+ method @androidx.wear.protolayout.expression.RequiresSchemaVersion(major=1, minor=500) public androidx.wear.protolayout.ColorBuilders.LinearGradient.Builder setStartY(androidx.wear.protolayout.DimensionBuilders.OffsetDimension);
+ }
+
@androidx.wear.protolayout.expression.RequiresSchemaVersion(major=1, minor=300) public static final class ColorBuilders.SweepGradient implements androidx.wear.protolayout.ColorBuilders.Brush {
method public java.util.List<androidx.wear.protolayout.ColorBuilders.ColorStop!> getColorStops();
method public androidx.wear.protolayout.DimensionBuilders.DegreesProp getEndAngle();
@@ -212,7 +230,7 @@
method @androidx.wear.protolayout.expression.RequiresSchemaVersion(major=1, minor=200) public androidx.wear.protolayout.DimensionBuilders.AngularLayoutConstraint.Builder setAngularAlignment(int);
}
- @androidx.wear.protolayout.expression.RequiresSchemaVersion(major=1, minor=400) public static final class DimensionBuilders.BoundingBoxRatio implements androidx.wear.protolayout.DimensionBuilders.PivotDimension {
+ @androidx.wear.protolayout.expression.RequiresSchemaVersion(major=1, minor=400) public static final class DimensionBuilders.BoundingBoxRatio implements androidx.wear.protolayout.DimensionBuilders.OffsetDimension androidx.wear.protolayout.DimensionBuilders.PivotDimension {
method public androidx.wear.protolayout.TypeBuilders.FloatProp getRatio();
}
@@ -237,7 +255,7 @@
method @androidx.wear.protolayout.expression.RequiresSchemaVersion(major=1, minor=0) public androidx.wear.protolayout.DimensionBuilders.DegreesProp.Builder setValue(float);
}
- @androidx.wear.protolayout.expression.RequiresSchemaVersion(major=1, minor=0) public static final class DimensionBuilders.DpProp implements androidx.wear.protolayout.DimensionBuilders.AngularDimension androidx.wear.protolayout.DimensionBuilders.ContainerDimension androidx.wear.protolayout.DimensionBuilders.ExtensionDimension androidx.wear.protolayout.DimensionBuilders.ImageDimension androidx.wear.protolayout.DimensionBuilders.PivotDimension androidx.wear.protolayout.DimensionBuilders.SpacerDimension {
+ @androidx.wear.protolayout.expression.RequiresSchemaVersion(major=1, minor=0) public static final class DimensionBuilders.DpProp implements androidx.wear.protolayout.DimensionBuilders.AngularDimension androidx.wear.protolayout.DimensionBuilders.ContainerDimension androidx.wear.protolayout.DimensionBuilders.ExtensionDimension androidx.wear.protolayout.DimensionBuilders.ImageDimension androidx.wear.protolayout.DimensionBuilders.OffsetDimension androidx.wear.protolayout.DimensionBuilders.PivotDimension androidx.wear.protolayout.DimensionBuilders.SpacerDimension {
method public androidx.wear.protolayout.expression.DynamicBuilders.DynamicFloat? getDynamicValue();
method @Dimension(unit=androidx.annotation.Dimension.DP) public float getValue();
}
@@ -287,6 +305,9 @@
@androidx.wear.protolayout.expression.RequiresSchemaVersion(major=1, minor=0) public static interface DimensionBuilders.ImageDimension {
}
+ @androidx.wear.protolayout.expression.RequiresSchemaVersion(major=1, minor=500) public static interface DimensionBuilders.OffsetDimension {
+ }
+
@androidx.wear.protolayout.expression.RequiresSchemaVersion(major=1, minor=400) public static interface DimensionBuilders.PivotDimension {
}
@@ -963,6 +984,7 @@
}
@androidx.wear.protolayout.expression.RequiresSchemaVersion(major=1, minor=0) public static final class ModifiersBuilders.Background {
+ method public androidx.wear.protolayout.ColorBuilders.Brush? getBrush();
method public androidx.wear.protolayout.ColorBuilders.ColorProp? getColor();
method public androidx.wear.protolayout.ModifiersBuilders.Corner? getCorner();
}
@@ -970,6 +992,7 @@
public static final class ModifiersBuilders.Background.Builder {
ctor public ModifiersBuilders.Background.Builder();
method public androidx.wear.protolayout.ModifiersBuilders.Background build();
+ method @androidx.wear.protolayout.expression.RequiresSchemaVersion(major=1, minor=500) public androidx.wear.protolayout.ModifiersBuilders.Background.Builder setBrush(androidx.wear.protolayout.ColorBuilders.Brush);
method @androidx.wear.protolayout.expression.RequiresSchemaVersion(major=1, minor=0) public androidx.wear.protolayout.ModifiersBuilders.Background.Builder setColor(androidx.wear.protolayout.ColorBuilders.ColorProp);
method @androidx.wear.protolayout.expression.RequiresSchemaVersion(major=1, minor=0) public androidx.wear.protolayout.ModifiersBuilders.Background.Builder setCorner(androidx.wear.protolayout.ModifiersBuilders.Corner);
}
diff --git a/wear/protolayout/protolayout/api/restricted_current.txt b/wear/protolayout/protolayout/api/restricted_current.txt
index b58a040..c8453dc 100644
--- a/wear/protolayout/protolayout/api/restricted_current.txt
+++ b/wear/protolayout/protolayout/api/restricted_current.txt
@@ -131,6 +131,24 @@
method public androidx.wear.protolayout.ColorBuilders.ColorStop build();
}
+ @androidx.wear.protolayout.expression.RequiresSchemaVersion(major=1, minor=500) public static final class ColorBuilders.LinearGradient implements androidx.wear.protolayout.ColorBuilders.Brush {
+ method public java.util.List<androidx.wear.protolayout.ColorBuilders.ColorStop!> getColorStops();
+ method public androidx.wear.protolayout.DimensionBuilders.OffsetDimension? getEndX();
+ method public androidx.wear.protolayout.DimensionBuilders.OffsetDimension? getEndY();
+ method public androidx.wear.protolayout.DimensionBuilders.OffsetDimension? getStartX();
+ method public androidx.wear.protolayout.DimensionBuilders.OffsetDimension? getStartY();
+ }
+
+ public static final class ColorBuilders.LinearGradient.Builder {
+ ctor @androidx.wear.protolayout.expression.RequiresSchemaVersion(major=1, minor=500) @java.lang.SafeVarargs public ColorBuilders.LinearGradient.Builder(androidx.wear.protolayout.ColorBuilders.ColorProp!...);
+ ctor @androidx.wear.protolayout.expression.RequiresSchemaVersion(major=1, minor=500) @java.lang.SafeVarargs public ColorBuilders.LinearGradient.Builder(androidx.wear.protolayout.ColorBuilders.ColorStop!...);
+ method public androidx.wear.protolayout.ColorBuilders.LinearGradient build();
+ method @androidx.wear.protolayout.expression.RequiresSchemaVersion(major=1, minor=500) public androidx.wear.protolayout.ColorBuilders.LinearGradient.Builder setEndX(androidx.wear.protolayout.DimensionBuilders.OffsetDimension);
+ method @androidx.wear.protolayout.expression.RequiresSchemaVersion(major=1, minor=500) public androidx.wear.protolayout.ColorBuilders.LinearGradient.Builder setEndY(androidx.wear.protolayout.DimensionBuilders.OffsetDimension);
+ method @androidx.wear.protolayout.expression.RequiresSchemaVersion(major=1, minor=500) public androidx.wear.protolayout.ColorBuilders.LinearGradient.Builder setStartX(androidx.wear.protolayout.DimensionBuilders.OffsetDimension);
+ method @androidx.wear.protolayout.expression.RequiresSchemaVersion(major=1, minor=500) public androidx.wear.protolayout.ColorBuilders.LinearGradient.Builder setStartY(androidx.wear.protolayout.DimensionBuilders.OffsetDimension);
+ }
+
@androidx.wear.protolayout.expression.RequiresSchemaVersion(major=1, minor=300) public static final class ColorBuilders.SweepGradient implements androidx.wear.protolayout.ColorBuilders.Brush {
method public java.util.List<androidx.wear.protolayout.ColorBuilders.ColorStop!> getColorStops();
method public androidx.wear.protolayout.DimensionBuilders.DegreesProp getEndAngle();
@@ -212,7 +230,7 @@
method @androidx.wear.protolayout.expression.RequiresSchemaVersion(major=1, minor=200) public androidx.wear.protolayout.DimensionBuilders.AngularLayoutConstraint.Builder setAngularAlignment(int);
}
- @androidx.wear.protolayout.expression.RequiresSchemaVersion(major=1, minor=400) public static final class DimensionBuilders.BoundingBoxRatio implements androidx.wear.protolayout.DimensionBuilders.PivotDimension {
+ @androidx.wear.protolayout.expression.RequiresSchemaVersion(major=1, minor=400) public static final class DimensionBuilders.BoundingBoxRatio implements androidx.wear.protolayout.DimensionBuilders.OffsetDimension androidx.wear.protolayout.DimensionBuilders.PivotDimension {
method public androidx.wear.protolayout.TypeBuilders.FloatProp getRatio();
}
@@ -237,7 +255,7 @@
method @androidx.wear.protolayout.expression.RequiresSchemaVersion(major=1, minor=0) public androidx.wear.protolayout.DimensionBuilders.DegreesProp.Builder setValue(float);
}
- @androidx.wear.protolayout.expression.RequiresSchemaVersion(major=1, minor=0) public static final class DimensionBuilders.DpProp implements androidx.wear.protolayout.DimensionBuilders.AngularDimension androidx.wear.protolayout.DimensionBuilders.ContainerDimension androidx.wear.protolayout.DimensionBuilders.ExtensionDimension androidx.wear.protolayout.DimensionBuilders.ImageDimension androidx.wear.protolayout.DimensionBuilders.PivotDimension androidx.wear.protolayout.DimensionBuilders.SpacerDimension {
+ @androidx.wear.protolayout.expression.RequiresSchemaVersion(major=1, minor=0) public static final class DimensionBuilders.DpProp implements androidx.wear.protolayout.DimensionBuilders.AngularDimension androidx.wear.protolayout.DimensionBuilders.ContainerDimension androidx.wear.protolayout.DimensionBuilders.ExtensionDimension androidx.wear.protolayout.DimensionBuilders.ImageDimension androidx.wear.protolayout.DimensionBuilders.OffsetDimension androidx.wear.protolayout.DimensionBuilders.PivotDimension androidx.wear.protolayout.DimensionBuilders.SpacerDimension {
method public androidx.wear.protolayout.expression.DynamicBuilders.DynamicFloat? getDynamicValue();
method @Dimension(unit=androidx.annotation.Dimension.DP) public float getValue();
}
@@ -287,6 +305,9 @@
@androidx.wear.protolayout.expression.RequiresSchemaVersion(major=1, minor=0) public static interface DimensionBuilders.ImageDimension {
}
+ @androidx.wear.protolayout.expression.RequiresSchemaVersion(major=1, minor=500) public static interface DimensionBuilders.OffsetDimension {
+ }
+
@androidx.wear.protolayout.expression.RequiresSchemaVersion(major=1, minor=400) public static interface DimensionBuilders.PivotDimension {
}
@@ -963,6 +984,7 @@
}
@androidx.wear.protolayout.expression.RequiresSchemaVersion(major=1, minor=0) public static final class ModifiersBuilders.Background {
+ method public androidx.wear.protolayout.ColorBuilders.Brush? getBrush();
method public androidx.wear.protolayout.ColorBuilders.ColorProp? getColor();
method public androidx.wear.protolayout.ModifiersBuilders.Corner? getCorner();
}
@@ -970,6 +992,7 @@
public static final class ModifiersBuilders.Background.Builder {
ctor public ModifiersBuilders.Background.Builder();
method public androidx.wear.protolayout.ModifiersBuilders.Background build();
+ method @androidx.wear.protolayout.expression.RequiresSchemaVersion(major=1, minor=500) public androidx.wear.protolayout.ModifiersBuilders.Background.Builder setBrush(androidx.wear.protolayout.ColorBuilders.Brush);
method @androidx.wear.protolayout.expression.RequiresSchemaVersion(major=1, minor=0) public androidx.wear.protolayout.ModifiersBuilders.Background.Builder setColor(androidx.wear.protolayout.ColorBuilders.ColorProp);
method @androidx.wear.protolayout.expression.RequiresSchemaVersion(major=1, minor=0) public androidx.wear.protolayout.ModifiersBuilders.Background.Builder setCorner(androidx.wear.protolayout.ModifiersBuilders.Corner);
}
diff --git a/wear/protolayout/protolayout/src/main/java/androidx/wear/protolayout/ColorBuilders.java b/wear/protolayout/protolayout/src/main/java/androidx/wear/protolayout/ColorBuilders.java
index 077c910..09f44ab 100644
--- a/wear/protolayout/protolayout/src/main/java/androidx/wear/protolayout/ColorBuilders.java
+++ b/wear/protolayout/protolayout/src/main/java/androidx/wear/protolayout/ColorBuilders.java
@@ -24,6 +24,7 @@
import androidx.annotation.RestrictTo;
import androidx.annotation.RestrictTo.Scope;
import androidx.wear.protolayout.DimensionBuilders.DegreesProp;
+import androidx.wear.protolayout.DimensionBuilders.OffsetDimension;
import androidx.wear.protolayout.TypeBuilders.FloatProp;
import androidx.wear.protolayout.expression.DynamicBuilders;
import androidx.wear.protolayout.expression.DynamicBuilders.DynamicColor;
@@ -525,7 +526,6 @@
*
* @param colors The color sequence to be distributed around the gradient center. The
* color sequence is distributed between the gradient's start and end angles.
- *
* @throws IllegalArgumentException if the number of colors is less than 2 or larger
* than 10.
*/
@@ -562,6 +562,275 @@
}
/**
+ * A linear gradient with the provided colors based on defined start and end coordinates.
+ *
+ * <p>The colors are dispersed at the offsets defined in each color stop.
+ */
+ @RequiresSchemaVersion(major = 1, minor = 500)
+ public static final class LinearGradient implements Brush {
+ private final ColorProto.LinearGradient mImpl;
+ private final @Nullable Fingerprint mFingerprint;
+
+ LinearGradient(ColorProto.LinearGradient impl, @Nullable Fingerprint fingerprint) {
+ this.mImpl = impl;
+ this.mFingerprint = fingerprint;
+ }
+
+ /**
+ * Gets the color stops defining how the colors are distributed from the start to the end
+ * coordinates.
+ *
+ * <p>A color stop is a pair of a color and its offset in the gradient. The offset is the
+ * relative position of the color, beginning with 0 at the start coordinate and ending with
+ * 1.0 at the end coordinate.
+ *
+ * <p>There must be at least 2 colors and at most 10 colors.
+ *
+ * <p>If offset values are not set, the colors are evenly distributed in the gradient.
+ */
+ public @NonNull List<ColorStop> getColorStops() {
+ List<ColorStop> list = new ArrayList<>();
+ for (ColorProto.ColorStop item : mImpl.getColorStopsList()) {
+ list.add(ColorStop.fromProto(item));
+ }
+ return Collections.unmodifiableList(list);
+ }
+
+ /**
+ * Gets the starting x position of the linear gradient. Defaults to the left side of the
+ * element.
+ */
+ @Nullable
+ public OffsetDimension getStartX() {
+ if (mImpl.hasStartX()) {
+ return DimensionBuilders.offsetDimensionFromProto(mImpl.getStartX());
+ } else {
+ return null;
+ }
+ }
+
+ /**
+ * Gets the starting y position of the linear gradient. Defaults to the top side of the
+ * element.
+ */
+ public @Nullable OffsetDimension getStartY() {
+ if (mImpl.hasStartY()) {
+ return DimensionBuilders.offsetDimensionFromProto(mImpl.getStartY());
+ } else {
+ return null;
+ }
+ }
+
+ /**
+ * Gets the ending y position of the linear gradient. Defaults to the right side of the
+ * element.
+ */
+ public @Nullable OffsetDimension getEndX() {
+ if (mImpl.hasEndX()) {
+ return DimensionBuilders.offsetDimensionFromProto(mImpl.getEndX());
+ } else {
+ return null;
+ }
+ }
+
+ /**
+ * Gets the ending y position of the linear gradient. Defaults to the top side of the
+ * element.
+ */
+ public @Nullable OffsetDimension getEndY() {
+ if (mImpl.hasEndY()) {
+ return DimensionBuilders.offsetDimensionFromProto(mImpl.getEndY());
+ } else {
+ return null;
+ }
+ }
+
+ @Override
+ @RestrictTo(Scope.LIBRARY_GROUP)
+ public @Nullable Fingerprint getFingerprint() {
+ return mFingerprint;
+ }
+
+ /** Creates a new wrapper instance from the proto. */
+ @RestrictTo(Scope.LIBRARY_GROUP)
+ public static @NonNull LinearGradient fromProto(
+ ColorProto.@NonNull LinearGradient proto, @Nullable Fingerprint fingerprint) {
+ return new LinearGradient(proto, fingerprint);
+ }
+
+ static @NonNull LinearGradient fromProto(ColorProto.@NonNull LinearGradient proto) {
+ return fromProto(proto, null);
+ }
+
+ /** Returns the internal proto instance. */
+ ColorProto.@NonNull LinearGradient toProto() {
+ return mImpl;
+ }
+
+ @Override
+ @RestrictTo(Scope.LIBRARY_GROUP)
+ public ColorProto.@NonNull Brush toBrushProto() {
+ return ColorProto.Brush.newBuilder().setLinearGradient(mImpl).build();
+ }
+
+ @Override
+ public @NonNull String toString() {
+ return "LinearGradient{"
+ + "colorStops="
+ + getColorStops()
+ + ", startX="
+ + getStartX()
+ + ", startY="
+ + getStartY()
+ + ", endX="
+ + getEndX()
+ + ", endY="
+ + getEndY()
+ + "}";
+ }
+
+ /** Builder for {@link LinearGradient}. */
+ @SuppressWarnings("HiddenSuperclass")
+ public static final class Builder implements Brush.Builder {
+ private final ColorProto.LinearGradient.Builder mImpl =
+ ColorProto.LinearGradient.newBuilder();
+ private final Fingerprint mFingerprint = new Fingerprint(-1075994710);
+
+ /**
+ * Adds one item to the color stops defining how the colors are distributed from the
+ * start to the end coordinates.
+ *
+ * <p>A color stop is a pair of a color and its offset in the gradient. The offset is
+ * the relative position of the color, beginning with 0 at the start coordinate and
+ * ending with 1.0 at the end coordinate.
+ *
+ * <p>There must be at least 2 colors and at most 10 colors.
+ *
+ * <p>If offset values are not set, the colors are evenly distributed in the gradient.
+ */
+ @RequiresSchemaVersion(major = 1, minor = 500)
+ private @NonNull Builder addColorStop(@NonNull ColorStop colorStop) {
+ mImpl.addColorStops(colorStop.toProto());
+ mFingerprint.recordPropertyUpdate(
+ 1, checkNotNull(colorStop.getFingerprint()).aggregateValueAsInt());
+ return this;
+ }
+
+ /**
+ * Sets the starting x position of the linear gradient. Defaults to the left side of the
+ * element.
+ */
+ @RequiresSchemaVersion(major = 1, minor = 500)
+ public @NonNull Builder setStartX(@NonNull OffsetDimension startX) {
+ mImpl.setStartX(startX.toOffsetDimensionProto());
+ mFingerprint.recordPropertyUpdate(
+ 2, checkNotNull(startX.getFingerprint()).aggregateValueAsInt());
+ return this;
+ }
+
+ /**
+ * Sets the starting y position of the linear gradient. Defaults to the top side of the
+ * element.
+ */
+ @RequiresSchemaVersion(major = 1, minor = 500)
+ public @NonNull Builder setStartY(@NonNull OffsetDimension startY) {
+ mImpl.setStartY(startY.toOffsetDimensionProto());
+ mFingerprint.recordPropertyUpdate(
+ 3, checkNotNull(startY.getFingerprint()).aggregateValueAsInt());
+ return this;
+ }
+
+ /**
+ * Sets the ending y position of the linear gradient. Defaults to the right side of the
+ * element.
+ */
+ @RequiresSchemaVersion(major = 1, minor = 500)
+ public @NonNull Builder setEndX(@NonNull OffsetDimension endX) {
+ mImpl.setEndX(endX.toOffsetDimensionProto());
+ mFingerprint.recordPropertyUpdate(
+ 4, checkNotNull(endX.getFingerprint()).aggregateValueAsInt());
+ return this;
+ }
+
+ /**
+ * Sets the ending y position of the linear gradient. Defaults to the top side of the
+ * element.
+ */
+ @RequiresSchemaVersion(major = 1, minor = 500)
+ public @NonNull Builder setEndY(@NonNull OffsetDimension endY) {
+ mImpl.setEndY(endY.toOffsetDimensionProto());
+ mFingerprint.recordPropertyUpdate(
+ 5, checkNotNull(endY.getFingerprint()).aggregateValueAsInt());
+ return this;
+ }
+
+ /**
+ * Creates an instance of {@link Builder}.
+ *
+ * @param colorStops The color stops defining how the colors are distributed from the
+ * start to the end coordinates.
+ * <p>A color stop is a pair of a color and its offset in the gradient. The offset
+ * is the relative position of the color, beginning with 0 from the start coordinate
+ * and ending with 1.0 at the end coordinate.
+ * @throws IllegalArgumentException if the number of colors is less than 2 or larger
+ * than 10.
+ */
+ @RequiresSchemaVersion(major = 1, minor = 500)
+ @SafeVarargs
+ public Builder(ColorStop @NonNull ... colorStops) {
+ if (colorStops.length < 2 || colorStops.length > 10) {
+ throw new IllegalArgumentException(
+ "Size of colorStops must not be less than 2 or greater than 10. Got "
+ + colorStops.length);
+ }
+ for (ColorStop colorStop : colorStops) {
+ addColorStop(colorStop);
+ }
+ }
+
+ /**
+ * Creates an instance of {@link Builder}.
+ *
+ * <p>The colors are evenly distributed in the gradient.
+ *
+ * @param colors The color sequence to be distributed between the gradient's start and
+ * end coordinates.
+ * @throws IllegalArgumentException if the number of colors is less than 2 or larger
+ * than 10.
+ */
+ @RequiresSchemaVersion(major = 1, minor = 500)
+ @SafeVarargs
+ public Builder(ColorProp @NonNull ... colors) {
+ if (colors.length < 2 || colors.length > 10) {
+ throw new IllegalArgumentException(
+ "Size of colors must not be less than 2 or greater than 10. Got "
+ + colors.length);
+ }
+ for (ColorProp colorProp : colors) {
+ ColorStop stop = new ColorStop.Builder().setColor(colorProp).build();
+ addColorStop(stop);
+ }
+ }
+
+ /**
+ * Builds an instance from accumulated values.
+ *
+ * @throws IllegalStateException if size of colorStops is less than 2 or greater than
+ * 10.
+ */
+ @Override
+ public @NonNull LinearGradient build() {
+ int colorStopsCount = mImpl.getColorStopsCount();
+ if (colorStopsCount < 2 || colorStopsCount > 10) {
+ throw new IllegalStateException(
+ "Size of colorStops must not be less than 2 or greater than 10");
+ }
+ return new LinearGradient(mImpl.build(), mFingerprint);
+ }
+ }
+ }
+
+ /**
* Interface defining a {@link Brush} describes how something is drawn on screen. It determines
* the color(s) that are drawn in the drawing area.
*/
@@ -591,6 +860,9 @@
if (proto.hasSweepGradient()) {
return SweepGradient.fromProto(proto.getSweepGradient(), fingerprint);
}
+ if (proto.hasLinearGradient()) {
+ return LinearGradient.fromProto(proto.getLinearGradient(), fingerprint);
+ }
throw new IllegalStateException("Proto was not a recognised instance of Brush");
}
diff --git a/wear/protolayout/protolayout/src/main/java/androidx/wear/protolayout/DimensionBuilders.java b/wear/protolayout/protolayout/src/main/java/androidx/wear/protolayout/DimensionBuilders.java
index 597e950..5f5a2d6 100644
--- a/wear/protolayout/protolayout/src/main/java/androidx/wear/protolayout/DimensionBuilders.java
+++ b/wear/protolayout/protolayout/src/main/java/androidx/wear/protolayout/DimensionBuilders.java
@@ -117,11 +117,12 @@
@OptIn(markerClass = ExperimentalProtoLayoutExtensionApi.class)
public static final class DpProp
implements AngularDimension,
- ContainerDimension,
- ImageDimension,
- SpacerDimension,
- ExtensionDimension,
- PivotDimension {
+ ContainerDimension,
+ ImageDimension,
+ SpacerDimension,
+ ExtensionDimension,
+ PivotDimension,
+ OffsetDimension {
private final DimensionProto.DpProp mImpl;
private final @Nullable Fingerprint mFingerprint;
@@ -215,6 +216,12 @@
}
@Override
+ @RestrictTo(Scope.LIBRARY_GROUP)
+ public DimensionProto.@NonNull OffsetDimension toOffsetDimensionProto() {
+ return DimensionProto.OffsetDimension.newBuilder().setOffsetDp(mImpl).build();
+ }
+
+ @Override
public @NonNull String toString() {
return "DpProp{" + "value=" + getValue() + ", dynamicValue=" + getDynamicValue() + "}";
}
@@ -227,7 +234,8 @@
ImageDimension.Builder,
SpacerDimension.Builder,
ExtensionDimension.Builder,
- PivotDimension.Builder {
+ PivotDimension.Builder,
+ OffsetDimension.Builder {
private final DimensionProto.DpProp.Builder mImpl = DimensionProto.DpProp.newBuilder();
private final Fingerprint mFingerprint = new Fingerprint(756413087);
@@ -600,9 +608,7 @@
}
}
- /**
- * Interface defining the length of an arc element.
- */
+ /** Interface defining the length of an arc element. */
@RequiresSchemaVersion(major = 1, minor = 500)
public interface AngularDimension {
/** Get the protocol buffer representation of this object. */
@@ -642,7 +648,7 @@
/** A type for angular dimensions, measured in degrees. */
@RequiresSchemaVersion(major = 1, minor = 0)
- public static final class DegreesProp implements AngularDimension{
+ public static final class DegreesProp implements AngularDimension {
private final DimensionProto.DegreesProp mImpl;
private final @Nullable Fingerprint mFingerprint;
@@ -715,7 +721,7 @@
/** Builder for {@link DegreesProp} */
@SuppressWarnings("HiddenSuperclass")
- public static final class Builder implements AngularDimension.Builder{
+ public static final class Builder implements AngularDimension.Builder {
private final DimensionProto.DegreesProp.Builder mImpl =
DimensionProto.DegreesProp.newBuilder();
private final Fingerprint mFingerprint = new Fingerprint(-1927567665);
@@ -1373,7 +1379,7 @@
/** Provide a position representation proportional to the bounding box width/height. */
@RequiresSchemaVersion(major = 1, minor = 400)
- public static final class BoundingBoxRatio implements PivotDimension {
+ public static final class BoundingBoxRatio implements PivotDimension, OffsetDimension {
private final DimensionProto.BoundingBoxRatio mImpl;
private final @Nullable Fingerprint mFingerprint;
@@ -1425,38 +1431,46 @@
}
@Override
+ @RestrictTo(Scope.LIBRARY_GROUP)
+ public DimensionProto.@NonNull OffsetDimension toOffsetDimensionProto() {
+ return DimensionProto.OffsetDimension.newBuilder().setLocationRatio(mImpl).build();
+ }
+
+ @Override
public @NonNull String toString() {
return "BoundingBoxRatio{" + "ratio=" + getRatio() + "}";
}
/** Builder for {@link BoundingBoxRatio}. */
@SuppressWarnings("HiddenSuperclass")
- public static final class Builder implements PivotDimension.Builder {
+ public static final class Builder
+ implements PivotDimension.Builder, OffsetDimension.Builder {
private final DimensionProto.BoundingBoxRatio.Builder mImpl =
DimensionProto.BoundingBoxRatio.newBuilder();
private final Fingerprint mFingerprint = new Fingerprint(-1387873430);
/**
* Creates an instance of {@link Builder}.
- * @param ratio the ratio proportional to the bounding box width/height. value 0
- * represents the location at the top / left of the bounding box and value 1
- * represents the location at the bottom / end of the bounding box. Its default
- * value 0.5 represents the middle of the bounding box. Values outside [0, 1]
- * are also valid. Dynamic value is supported.
+ *
+ * @param ratio the ratio relative to the bounding box width / height, with the bounding
+ * box top / left as 0 and bottom / right as 1. Values outside [0, 1] are also
+ * valid. Dynamic value is supported.
*/
@RequiresSchemaVersion(major = 1, minor = 400)
public Builder(@NonNull FloatProp ratio) {
- setRatio(ratio);
+ setRatio(ratio);
}
+ @RequiresSchemaVersion(major = 1, minor = 400)
+ Builder() {}
+
/**
- * Gets the ratio proportional to the bounding box width/height. value 0 represents the
- * location at the top / left of the bounding box and value 1 represents the location at
- * the bottom / end of the bounding box. Its default value 0.5 represents the middle
- * of the bounding box. Values outside [0, 1] are also valid. Dynamic value is
- * supported.
+ * Sets the ratio relative to the bounding box width / height, with the bounding box top
+ * / left as 0 and bottom / right as 1. Values outside [0, 1] are also valid. Dynamic
+ * value is supported.
*/
- private @NonNull Builder setRatio(@NonNull FloatProp ratio) {
+ @RequiresSchemaVersion(major = 1, minor = 400)
+ @NonNull Builder setRatio(@NonNull FloatProp ratio) {
mImpl.setRatio(ratio.toProto());
mFingerprint.recordPropertyUpdate(
1, checkNotNull(ratio.getFingerprint()).aggregateValueAsInt());
@@ -1511,4 +1525,44 @@
DimensionProto.@NonNull PivotDimension proto) {
return pivotDimensionFromProto(proto, null);
}
+
+ /**
+ * Interface defining a dimension that represents an offset relative to the element's position.
+ */
+ @RequiresSchemaVersion(major = 1, minor = 500)
+ public interface OffsetDimension {
+ /** Get the protocol buffer representation of this object. */
+ @RestrictTo(Scope.LIBRARY_GROUP)
+ DimensionProto.@NonNull OffsetDimension toOffsetDimensionProto();
+
+ /** Get the fingerprint for this object or null if unknown. */
+ @RestrictTo(Scope.LIBRARY_GROUP)
+ @Nullable Fingerprint getFingerprint();
+
+ /** Builder to create {@link OffsetDimension} objects. */
+ @RestrictTo(Scope.LIBRARY_GROUP)
+ interface Builder {
+
+ /** Builds an instance with values accumulated in this Builder. */
+ @NonNull OffsetDimension build();
+ }
+ }
+
+ /** Creates a new wrapper instance from the proto. */
+ @RestrictTo(Scope.LIBRARY_GROUP)
+ public static @NonNull OffsetDimension offsetDimensionFromProto(
+ DimensionProto.@NonNull OffsetDimension proto, @Nullable Fingerprint fingerprint) {
+ if (proto.hasOffsetDp()) {
+ return DpProp.fromProto(proto.getOffsetDp(), fingerprint);
+ }
+ if (proto.hasLocationRatio()) {
+ return BoundingBoxRatio.fromProto(proto.getLocationRatio(), fingerprint);
+ }
+ throw new IllegalStateException("Proto was not a recognised instance of OffsetDimension");
+ }
+
+ static @NonNull OffsetDimension offsetDimensionFromProto(
+ DimensionProto.@NonNull OffsetDimension proto) {
+ return offsetDimensionFromProto(proto, null);
+ }
}
diff --git a/wear/protolayout/protolayout/src/main/java/androidx/wear/protolayout/LayoutElementBuilders.java b/wear/protolayout/protolayout/src/main/java/androidx/wear/protolayout/LayoutElementBuilders.java
index afd1fc7..548240c 100644
--- a/wear/protolayout/protolayout/src/main/java/androidx/wear/protolayout/LayoutElementBuilders.java
+++ b/wear/protolayout/protolayout/src/main/java/androidx/wear/protolayout/LayoutElementBuilders.java
@@ -39,6 +39,7 @@
import androidx.annotation.VisibleForTesting;
import androidx.wear.protolayout.ColorBuilders.Brush;
import androidx.wear.protolayout.ColorBuilders.ColorProp;
+import androidx.wear.protolayout.ColorBuilders.SweepGradient;
import androidx.wear.protolayout.DeviceParametersBuilders.DeviceParameters;
import androidx.wear.protolayout.DimensionBuilders.AngularDimension;
import androidx.wear.protolayout.DimensionBuilders.AngularLayoutConstraint;
@@ -690,10 +691,9 @@
return Collections.unmodifiableList(list);
}
-
/**
- * Gets whether the text should be rendered in a italic typeface. If not specified, defaults to
- * "false".
+ * Gets whether the text should be rendered in a italic typeface. If not specified, defaults
+ * to "false".
*/
public @Nullable BoolProp getItalic() {
return isItalic();
@@ -999,8 +999,7 @@
SpProp spPropSize = sp(size);
mImpl.addSize(spPropSize.toProto());
mFingerprint.recordPropertyUpdate(
- 1,
- checkNotNull(spPropSize.getFingerprint()).aggregateValueAsInt());
+ 1, checkNotNull(spPropSize.getFingerprint()).aggregateValueAsInt());
}
return this;
}
@@ -1036,7 +1035,7 @@
*
* @param fontFamily preferred font family name to be used if available
* @param fallbacks the ordered list of fallback font family to attempt to use if the
- * preferred font family is not available.
+ * preferred font family is not available.
*/
@RequiresSchemaVersion(major = 1, minor = 400)
public @NonNull Builder setPreferredFontFamilies(
@@ -1061,13 +1060,14 @@
* {@link FontSetting#width} setting will always be available.
*
* @throws IllegalArgumentException if the number of the given Setting is larger than
- * 10.
+ * 10.
*/
@RequiresSchemaVersion(major = 1, minor = 400)
public @NonNull Builder setSettings(FontSetting @NonNull ... settings) {
if (settings.length > SETTINGS_LIMIT) {
throw new IllegalArgumentException(
- "Number of given FontSetting can't be larger than " + SETTINGS_LIMIT
+ "Number of given FontSetting can't be larger than "
+ + SETTINGS_LIMIT
+ ".");
}
@@ -1126,7 +1126,7 @@
* FontStyle.Builder#setWeight}.
*
* @param value weight, usually in 1..1000, but actual range can be smaller, depending on
- * the font used
+ * the font used
*/
@RequiresSchemaVersion(major = 1, minor = 400)
static @NonNull FontSetting weight(@IntRange(from = 1, to = 1000) int value) {
@@ -1593,9 +1593,9 @@
* 1.2 and renderers supporting version 1.2 will use the dynamic value (if set).
*
* <p>When using a dynamic value, make sure to specify the bounding constraints for the
- * affected layout element through
- * {@code setLayoutConstraintsForDynamicText(StringLayoutConstraint)} otherwise
- * {@code build()} fails.
+ * affected layout element through {@code
+ * setLayoutConstraintsForDynamicText(StringLayoutConstraint)} otherwise {@code build()}
+ * fails.
*/
public @Nullable StringProp getText() {
if (mImpl.hasText()) {
@@ -2940,7 +2940,8 @@
@RequiresSchemaVersion(major = 1, minor = 0)
public @NonNull Builder setText(@NonNull StringProp text) {
if (text.getDynamicValue() != null) {
- throw new IllegalArgumentException("SpanText.Builder.setText doesn't support dynamic values.");
+ throw new IllegalArgumentException(
+ "SpanText.Builder.setText doesn't support dynamic values.");
}
mImpl.setText(text.toProto());
mFingerprint.recordPropertyUpdate(
@@ -4260,7 +4261,7 @@
}
}
- /** Gets defines the direction in which text is drawn.*/
+ /** Gets defines the direction in which text is drawn. */
public @Nullable ArcDirectionProp getArcDirection() {
if (mImpl.hasArcDirection()) {
return ArcDirectionProp.fromProto(mImpl.getArcDirection());
@@ -4415,9 +4416,9 @@
* 1.2 and renderers supporting version 1.2 will use the dynamic value (if set).
*
* <p>When using a dynamic value, make sure to specify the bounding constraints for the
- * affected layout element through
- * {@code setLayoutConstraintsForDynamicLength(AngularLayoutConstraint)} otherwise {@code
- * build()} fails.
+ * affected layout element through {@code
+ * setLayoutConstraintsForDynamicLength(AngularLayoutConstraint)} otherwise {@code build()}
+ * fails.
*/
public @Nullable DegreesProp getLength() {
if (mImpl.hasLength()) {
@@ -4632,9 +4633,15 @@
/**
* Sets a brush used to draw this line. If set, the brush will be used instead of the
* color provided in {@code setColor()}.
+ *
+ * @throws IllegalArgumentException if the brush is not a {@link SweepGradient}.
*/
@RequiresSchemaVersion(major = 1, minor = 300)
public @NonNull Builder setBrush(@NonNull Brush brush) {
+ if (!(brush instanceof SweepGradient)) {
+ throw new IllegalArgumentException(
+ "Only SweepGradient is supported for ArcLine.");
+ }
mImpl.setBrush(brush.toBrushProto());
mFingerprint.recordPropertyUpdate(
7, checkNotNull(brush.getFingerprint()).aggregateValueAsInt());
@@ -4701,7 +4708,7 @@
String onlyOpaqueMsg = "Only opaque colors are supported";
String alphaChangeMsg =
"Any transparent colors will have their alpha component set to 0xFF"
- + " (opaque).";
+ + " (opaque).";
for (ColorProto.ColorStop colorStop :
mImpl.getBrush().getSweepGradient().getColorStopsList()) {
if (Color.alpha(colorStop.getColor().getArgb()) < 0xFF) {
@@ -4835,9 +4842,7 @@
this.mFingerprint = fingerprint;
}
- /**
- * Gets the length of this line in degrees, including gaps.
- */
+ /** Gets the length of this line in degrees, including gaps. */
public @Nullable DegreesProp getLength() {
if (mImpl.hasLength()) {
return DegreesProp.fromProto(mImpl.getLength());
@@ -4978,9 +4983,7 @@
return this;
}
- /**
- * Sets the thickness of this line. If not defined, defaults to 0.
- */
+ /** Sets the thickness of this line. If not defined, defaults to 0. */
@RequiresSchemaVersion(major = 1, minor = 500)
public @NonNull Builder setThickness(@Dimension(unit = DP) float thickness) {
DpProp thicknessProp = dp(thickness);
@@ -4990,9 +4993,7 @@
return this;
}
- /**
- * Sets the color of this line.
- */
+ /** Sets the color of this line. */
@RequiresSchemaVersion(major = 1, minor = 500)
public @NonNull Builder setColor(@NonNull ColorProp color) {
mImpl.setColor(color.toProto());
@@ -5044,6 +5045,7 @@
6, checkNotNull(linePattern.getFingerprint()).aggregateValueAsInt());
return this;
}
+
/**
* Sets the bounding constraints for the layout affected by the dynamic value from
* {@link #setLength(DegreesProp)}.
@@ -5187,7 +5189,7 @@
* Sets the list of each gap's center location in degrees.
*
* <p>The interval between any two locations must not be shorter than thickness plus gap
- * size, otherwise the gap is ignored.
+ * size, otherwise the gap is ignored.
*
* <p>Note that calling this method will invalidate the previous call of {@link
* #setGapInterval}
@@ -5196,7 +5198,7 @@
public @NonNull Builder setGapLocations(float @NonNull ... gapLocationsInDegrees) {
mImpl.clearGapLocations();
- for (float gapLocation: gapLocationsInDegrees) {
+ for (float gapLocation : gapLocationsInDegrees) {
addGapLocation(degrees(gapLocation));
}
@@ -5240,7 +5242,6 @@
}
}
-
/** A simple spacer used to provide padding between adjacent elements in an {@link Arc}. */
@RequiresSchemaVersion(major = 1, minor = 0)
public static final class ArcSpacer implements ArcLayoutElement {
@@ -5279,7 +5280,7 @@
}
}
- /** Gets the length of this spacer.*/
+ /** Gets the length of this spacer. */
public @Nullable AngularDimension getAngularLength() {
if (mImpl.hasAngularLength()) {
return DimensionBuilders.angularDimensionFromProto(mImpl.getAngularLength());
@@ -5393,16 +5394,16 @@
* Sets the length of this spacer. If not defined, defaults to 0 degrees. If set, this
* angular length will be used instead of the value provided in {@code setLength()}.
*
- * <p>Note that this field only supports static values.
+ * <p>Note that this field only supports static values.
*/
@RequiresSchemaVersion(major = 1, minor = 500)
public @NonNull Builder setAngularLength(@NonNull AngularDimension angularLength) {
- DimensionProto. AngularDimension angularDimensionProto =
+ DimensionProto.AngularDimension angularDimensionProto =
angularLength.toAngularDimensionProto();
if ((angularDimensionProto.hasDegrees()
- && angularDimensionProto.getDegrees().getDynamicValue() != null)
+ && angularDimensionProto.getDegrees().getDynamicValue() != null)
|| (angularDimensionProto.hasDp()
- && angularDimensionProto.getDp().getDynamicValue() != null)) {
+ && angularDimensionProto.getDp().getDynamicValue() != null)) {
throw new IllegalArgumentException(
"ArcSpacer.Builder.setAngularLength doesn't support dynamic values.");
}
@@ -5457,14 +5458,13 @@
}
}
-
/**
- * Gets whether this adapter's contents should be rotated, according to its position in the arc
- * or not. As an example, assume that an {@link Image} has been added to the arc, and ends up at
- * the 3 o clock position. If rotate_contents = true, the image will be placed at the 3 o clock
- * position, and will be rotated clockwise through 90 degrees. If rotate_contents = false, the
- * image will be placed at the 3 o clock position, but itself will not be rotated. If not
- * defined, defaults to false.
+ * Gets whether this adapter's contents should be rotated, according to its position in the
+ * arc or not. As an example, assume that an {@link Image} has been added to the arc, and
+ * ends up at the 3 o clock position. If rotate_contents = true, the image will be placed at
+ * the 3 o clock position, and will be rotated clockwise through 90 degrees. If
+ * rotate_contents = false, the image will be placed at the 3 o clock position, but itself
+ * will not be rotated. If not defined, defaults to false.
*/
public @Nullable BoolProp getRotateContents() {
return isRotateContents();
@@ -5582,8 +5582,8 @@
}
/**
- * An extensible {@code ArcDirection} property that can be set to any curved element to
- * control the drawing direction.
+ * An extensible {@code ArcDirection} property that can be set to any curved element to control
+ * the drawing direction.
*/
@RequiresSchemaVersion(major = 1, minor = 300)
public static final class ArcDirectionProp {
@@ -5591,8 +5591,7 @@
private final @Nullable Fingerprint mFingerprint;
ArcDirectionProp(
- LayoutElementProto.ArcDirectionProp impl,
- @Nullable Fingerprint fingerprint) {
+ LayoutElementProto.ArcDirectionProp impl, @Nullable Fingerprint fingerprint) {
this.mImpl = impl;
this.mFingerprint = fingerprint;
}
@@ -6633,8 +6632,7 @@
*/
@Deprecated
public static FontStyle.@NonNull Builder body1(@NonNull DeviceParameters deviceParameters) {
- return new FontStyle.Builder()
- .setSize(sp(isLargeScreen(deviceParameters) ? 18 : 16));
+ return new FontStyle.Builder().setSize(sp(isLargeScreen(deviceParameters) ? 18 : 16));
}
/**
@@ -6645,8 +6643,7 @@
*/
@Deprecated
public static FontStyle.@NonNull Builder body2(@NonNull DeviceParameters deviceParameters) {
- return new FontStyle.Builder()
- .setSize(sp(isLargeScreen(deviceParameters) ? 16 : 14));
+ return new FontStyle.Builder().setSize(sp(isLargeScreen(deviceParameters) ? 16 : 14));
}
/**
@@ -6672,8 +6669,7 @@
@Deprecated
public static FontStyle.@NonNull Builder caption1(
@NonNull DeviceParameters deviceParameters) {
- return new FontStyle.Builder()
- .setSize(sp(isLargeScreen(deviceParameters) ? 16 : 14));
+ return new FontStyle.Builder().setSize(sp(isLargeScreen(deviceParameters) ? 16 : 14));
}
/**
@@ -6685,45 +6681,44 @@
@Deprecated
public static FontStyle.@NonNull Builder caption2(
@NonNull DeviceParameters deviceParameters) {
- return new FontStyle.Builder()
- .setSize(sp(isLargeScreen(deviceParameters) ? 14 : 12));
+ return new FontStyle.Builder().setSize(sp(isLargeScreen(deviceParameters) ? 14 : 12));
}
private FontStyles() {}
}
- /** Checks whether a layout element has a transformation modifier. */
- private static boolean hasTransformation(LayoutElementProto.@NonNull LayoutElement content) {
- switch (content.getInnerCase()) {
- case IMAGE:
- return content.getImage().hasModifiers()
- && content.getImage().getModifiers().hasTransformation();
- case TEXT:
- return content.getText().hasModifiers()
- && content.getText().getModifiers().hasTransformation();
- case SPACER:
- return content.getSpacer().hasModifiers()
- && content.getSpacer().getModifiers().hasTransformation();
- case BOX:
- return content.getBox().hasModifiers()
- && content.getBox().getModifiers().hasTransformation();
- case ROW:
- return content.getRow().hasModifiers()
- && content.getRow().getModifiers().hasTransformation();
- case COLUMN:
- return content.getColumn().hasModifiers()
- && content.getColumn().getModifiers().hasTransformation();
- case SPANNABLE:
- return content.getSpannable().hasModifiers()
- && content.getSpannable().getModifiers().hasTransformation();
- case ARC:
- return content.getArc().hasModifiers()
- && content.getArc().getModifiers().hasTransformation();
- case EXTENSION:
- // fall through
- case INNER_NOT_SET:
+ /** Checks whether a layout element has a transformation modifier. */
+ private static boolean hasTransformation(LayoutElementProto.@NonNull LayoutElement content) {
+ switch (content.getInnerCase()) {
+ case IMAGE:
+ return content.getImage().hasModifiers()
+ && content.getImage().getModifiers().hasTransformation();
+ case TEXT:
+ return content.getText().hasModifiers()
+ && content.getText().getModifiers().hasTransformation();
+ case SPACER:
+ return content.getSpacer().hasModifiers()
+ && content.getSpacer().getModifiers().hasTransformation();
+ case BOX:
+ return content.getBox().hasModifiers()
+ && content.getBox().getModifiers().hasTransformation();
+ case ROW:
+ return content.getRow().hasModifiers()
+ && content.getRow().getModifiers().hasTransformation();
+ case COLUMN:
+ return content.getColumn().hasModifiers()
+ && content.getColumn().getModifiers().hasTransformation();
+ case SPANNABLE:
+ return content.getSpannable().hasModifiers()
+ && content.getSpannable().getModifiers().hasTransformation();
+ case ARC:
+ return content.getArc().hasModifiers()
+ && content.getArc().getModifiers().hasTransformation();
+ case EXTENSION:
+ // fall through
+ case INNER_NOT_SET:
+ return false;
+ }
return false;
}
- return false;
- }
}
diff --git a/wear/protolayout/protolayout/src/main/java/androidx/wear/protolayout/ModifiersBuilders.java b/wear/protolayout/protolayout/src/main/java/androidx/wear/protolayout/ModifiersBuilders.java
index 9496a5c..d193cb2 100644
--- a/wear/protolayout/protolayout/src/main/java/androidx/wear/protolayout/ModifiersBuilders.java
+++ b/wear/protolayout/protolayout/src/main/java/androidx/wear/protolayout/ModifiersBuilders.java
@@ -27,7 +27,9 @@
import androidx.annotation.RestrictTo;
import androidx.annotation.RestrictTo.Scope;
import androidx.wear.protolayout.ActionBuilders.Action;
+import androidx.wear.protolayout.ColorBuilders.Brush;
import androidx.wear.protolayout.ColorBuilders.ColorProp;
+import androidx.wear.protolayout.ColorBuilders.LinearGradient;
import androidx.wear.protolayout.DimensionBuilders.DegreesProp;
import androidx.wear.protolayout.DimensionBuilders.DpProp;
import androidx.wear.protolayout.DimensionBuilders.PivotDimension;
@@ -1034,13 +1036,13 @@
}
/**
- * A radius with values on both horizontal and vertical axes set to zero. It can be used
- * to have right-angle corners.
+ * A radius with values on both horizontal and vertical axes set to zero. It can be used to
+ * have right-angle corners.
*/
@RequiresSchemaVersion(major = 1, minor = 400)
private static final CornerRadius ZERO =
- new CornerRadius.Builder(new DpProp.Builder(0f).build(),
- new DpProp.Builder(0f).build())
+ new CornerRadius.Builder(
+ new DpProp.Builder(0f).build(), new DpProp.Builder(0f).build())
.build();
/** Get the fingerprint for this object, or null if unknown. */
@@ -1091,8 +1093,7 @@
}
@RequiresSchemaVersion(major = 1, minor = 400)
- Builder() {
- }
+ Builder() {}
/**
* Sets the radius value in dp on the horizontal axis.
@@ -1195,10 +1196,8 @@
private @NonNull CornerRadius toCornerRadius(@Nullable DpProp radius) {
return radius == null
? CornerRadius.ZERO
- : new CornerRadius.Builder(
- dp(radius.getValue()),
- dp(radius.getValue())
- ).build();
+ : new CornerRadius.Builder(dp(radius.getValue()), dp(radius.getValue()))
+ .build();
}
/** Get the fingerprint for this object, or null if unknown. */
@@ -1326,8 +1325,8 @@
* or defaults to zeros when radius is also not set.
*/
@RequiresSchemaVersion(major = 1, minor = 400)
- public @NonNull Builder setTopLeftRadius(@NonNull DpProp xRadius,
- @NonNull DpProp yRadius) {
+ public @NonNull Builder setTopLeftRadius(
+ @NonNull DpProp xRadius, @NonNull DpProp yRadius) {
return setTopLeftRadius(new CornerRadius.Builder(xRadius, yRadius).build());
}
@@ -1337,8 +1336,8 @@
* or defaults to zeros when radius is also not set.
*/
@RequiresSchemaVersion(major = 1, minor = 400)
- public @NonNull Builder setTopRightRadius(@NonNull DpProp xRadius,
- @NonNull DpProp yRadius) {
+ public @NonNull Builder setTopRightRadius(
+ @NonNull DpProp xRadius, @NonNull DpProp yRadius) {
return setTopRightRadius(new CornerRadius.Builder(xRadius, yRadius).build());
}
@@ -1348,8 +1347,8 @@
* set; or defaults to zeros when radius is also not set.
*/
@RequiresSchemaVersion(major = 1, minor = 400)
- public @NonNull Builder setBottomRightRadius(@NonNull DpProp xRadius,
- @NonNull DpProp yRadius) {
+ public @NonNull Builder setBottomRightRadius(
+ @NonNull DpProp xRadius, @NonNull DpProp yRadius) {
return setBottomRightRadius(new CornerRadius.Builder(xRadius, yRadius).build());
}
@@ -1359,8 +1358,8 @@
* set; or defaults to zeros when radius is also not set.
*/
@RequiresSchemaVersion(major = 1, minor = 400)
- public @NonNull Builder setBottomLeftRadius(@NonNull DpProp xRadius,
- @NonNull DpProp yRadius) {
+ public @NonNull Builder setBottomLeftRadius(
+ @NonNull DpProp xRadius, @NonNull DpProp yRadius) {
return setBottomLeftRadius(new CornerRadius.Builder(xRadius, yRadius).build());
}
@@ -1388,6 +1387,9 @@
*
* <p>While this field is statically accessible from 1.0, it's only bindable since version
* 1.2 and renderers supporting version 1.2 will use the dynamic value (if set).
+ *
+ * <p>If a brush is set, this color will only be used if brush is not supported by the
+ * renderer (versions below 1.5).
*/
public @Nullable ColorProp getColor() {
if (mImpl.hasColor()) {
@@ -1410,6 +1412,18 @@
}
}
+ /**
+ * Gets a brush used to draw the background. If set, the brush will be used instead of the
+ * color provided in {@code setColor()}.
+ */
+ public @Nullable Brush getBrush() {
+ if (mImpl.hasBrush()) {
+ return ColorBuilders.brushFromProto(mImpl.getBrush());
+ } else {
+ return null;
+ }
+ }
+
/** Get the fingerprint for this object, or null if unknown. */
@RestrictTo(Scope.LIBRARY_GROUP)
public @Nullable Fingerprint getFingerprint() {
@@ -1435,7 +1449,14 @@
@Override
public @NonNull String toString() {
- return "Background{" + "color=" + getColor() + ", corner=" + getCorner() + "}";
+ return "Background{"
+ + "color="
+ + getColor()
+ + ", corner="
+ + getCorner()
+ + ", brush="
+ + getBrush()
+ + "}";
}
/** Builder for {@link Background} */
@@ -1453,6 +1474,9 @@
*
* <p>While this field is statically accessible from 1.0, it's only bindable since
* version 1.2 and renderers supporting version 1.2 will use the dynamic value (if set).
+ *
+ * <p>If a brush is set, this color will only be used if brush is not supported by the
+ * renderer (versions below 1.5).
*/
@RequiresSchemaVersion(major = 1, minor = 0)
public @NonNull Builder setColor(@NonNull ColorProp color) {
@@ -1475,6 +1499,24 @@
return this;
}
+ /**
+ * Sets a brush used to draw the background. If set and supported, the brush will be
+ * used instead of the color provided in {@code setColor()}.
+ *
+ * @throws IllegalArgumentException if the brush is not a {@link LinearGradient}.
+ */
+ @RequiresSchemaVersion(major = 1, minor = 500)
+ public @NonNull Builder setBrush(@NonNull Brush brush) {
+ if (!(brush instanceof LinearGradient)) {
+ throw new IllegalArgumentException(
+ "Only LinearGradient is supported for Background.");
+ }
+ mImpl.setBrush(brush.toBrushProto());
+ mFingerprint.recordPropertyUpdate(
+ 3, checkNotNull(brush.getFingerprint()).aggregateValueAsInt());
+ return this;
+ }
+
/** Builds an instance from accumulated values. */
public @NonNull Background build() {
return new Background(mImpl.build(), mFingerprint);
diff --git a/wear/protolayout/protolayout/src/test/java/androidx/wear/protolayout/ColorBuildersTest.java b/wear/protolayout/protolayout/src/test/java/androidx/wear/protolayout/ColorBuildersTest.java
index 7910b4e..9c67535 100644
--- a/wear/protolayout/protolayout/src/test/java/androidx/wear/protolayout/ColorBuildersTest.java
+++ b/wear/protolayout/protolayout/src/test/java/androidx/wear/protolayout/ColorBuildersTest.java
@@ -16,6 +16,9 @@
package androidx.wear.protolayout;
+import static androidx.wear.protolayout.ColorBuilders.argb;
+import static androidx.wear.protolayout.DimensionBuilders.dp;
+
import static com.google.common.truth.Truth.assertThat;
import static org.junit.Assert.assertThrows;
@@ -23,8 +26,13 @@
import android.graphics.Color;
import androidx.test.ext.junit.runners.AndroidJUnit4;
+import androidx.wear.protolayout.ColorBuilders.LinearGradient;
+import androidx.wear.protolayout.DimensionBuilders.BoundingBoxRatio;
+import androidx.wear.protolayout.DimensionBuilders.DpProp;
+import androidx.wear.protolayout.TypeBuilders.FloatProp;
import androidx.wear.protolayout.expression.AppDataKey;
import androidx.wear.protolayout.expression.DynamicBuilders;
+import androidx.wear.protolayout.expression.DynamicBuilders.DynamicFloat;
import androidx.wear.protolayout.proto.ColorProto;
import org.junit.Test;
@@ -50,8 +58,40 @@
@SuppressWarnings("deprecation") // Intentionally no static value.
@Test
public void colorProp_withoutStaticValue_throws() {
- assertThrows(IllegalStateException.class, new ColorBuilders.ColorProp.Builder()
- .setDynamicValue(
- DynamicBuilders.DynamicColor.from(new AppDataKey<>(STATE_KEY)))::build);
+ assertThrows(
+ IllegalStateException.class,
+ new ColorBuilders.ColorProp.Builder()
+ .setDynamicValue(
+ DynamicBuilders.DynamicColor.from(
+ new AppDataKey<>(STATE_KEY)))
+ ::build);
+ }
+
+ @Test
+ public void linearGradient_supportsDynamicOffsets() {
+ DynamicFloat dynamicFloat = DynamicFloat.constant(1.0f);
+ DpProp startX = dp(0f);
+ DpProp startY = new DpProp.Builder(0f).setDynamicValue(dynamicFloat).build();
+ BoundingBoxRatio endX =
+ new BoundingBoxRatio.Builder()
+ .setRatio(new FloatProp.Builder(1.0f).build())
+ .build();
+ BoundingBoxRatio endY =
+ new BoundingBoxRatio.Builder()
+ .setRatio(new FloatProp.Builder(1.0f).setDynamicValue(dynamicFloat).build())
+ .build();
+ LinearGradient linearGrad =
+ new LinearGradient.Builder(argb(Color.BLUE), argb(Color.RED))
+ .setStartX(startX)
+ .setStartY(startY)
+ .setEndX(endX)
+ .setEndY(endY)
+ .build();
+
+ assertThat(((DpProp) linearGrad.getStartX()).getValue()).isEqualTo(startX.getValue());
+ assertThat(((DpProp) linearGrad.getStartY()).getDynamicValue()).isNotNull();
+ assertThat(((BoundingBoxRatio) linearGrad.getEndX()).getRatio().getValue()).isEqualTo(1.0f);
+ assertThat(((BoundingBoxRatio) linearGrad.getEndY()).getRatio().getDynamicValue())
+ .isNotNull();
}
}
diff --git a/wear/protolayout/protolayout/src/test/java/androidx/wear/protolayout/ModifiersBuildersTest.java b/wear/protolayout/protolayout/src/test/java/androidx/wear/protolayout/ModifiersBuildersTest.java
index 4aa3c19..8bafddd 100644
--- a/wear/protolayout/protolayout/src/test/java/androidx/wear/protolayout/ModifiersBuildersTest.java
+++ b/wear/protolayout/protolayout/src/test/java/androidx/wear/protolayout/ModifiersBuildersTest.java
@@ -26,8 +26,13 @@
import android.graphics.Color;
import androidx.test.ext.junit.runners.AndroidJUnit4;
+import androidx.wear.protolayout.ColorBuilders.ColorProp;
+import androidx.wear.protolayout.ColorBuilders.LinearGradient;
+import androidx.wear.protolayout.ColorBuilders.SweepGradient;
+import androidx.wear.protolayout.ModifiersBuilders.Background;
import androidx.wear.protolayout.expression.AppDataKey;
import androidx.wear.protolayout.expression.DynamicBuilders;
+import androidx.wear.protolayout.proto.ColorProto;
import androidx.wear.protolayout.proto.ModifiersProto;
import org.junit.Test;
@@ -36,8 +41,8 @@
@RunWith(AndroidJUnit4.class)
public class ModifiersBuildersTest {
private static final String STATE_KEY = "state-key";
- private static final ColorBuilders.ColorProp COLOR =
- new ColorBuilders.ColorProp.Builder(Color.RED)
+ private static final ColorProp COLOR =
+ new ColorProp.Builder(Color.RED)
.setDynamicValue(DynamicBuilders.DynamicColor.from(new AppDataKey<>(STATE_KEY)))
.build();
@@ -54,8 +59,7 @@
@Test
public void backgroundSupportsDynamicColor() {
- ModifiersBuilders.Background background1 =
- new ModifiersBuilders.Background.Builder().setColor(COLOR).build();
+ Background background1 = new Background.Builder().setColor(COLOR).build();
ModifiersProto.Background background1Proto = background1.toProto();
assertThat(background1Proto.getColor().getArgb()).isEqualTo(COLOR.getArgb());
@@ -95,7 +99,7 @@
() ->
new ModifiersBuilders.Shadow.Builder()
.setColor(
- new ColorBuilders.ColorProp.Builder(Color.BLACK)
+ new ColorProp.Builder(Color.BLACK)
.setDynamicValue(
DynamicBuilders.DynamicColor.constant(
Color.GRAY))
@@ -169,7 +173,7 @@
@Test
public void buildAsymmetricalCornerModifier() {
- float [] values = new float[]{1f, 2f, 3f, 4f, 5f, 6f, 7f, 8f};
+ float[] values = new float[] {1f, 2f, 3f, 4f, 5f, 6f, 7f, 8f};
ModifiersBuilders.Corner cornerModifier =
new ModifiersBuilders.Corner.Builder()
.setTopLeftRadius(dp(values[0]), dp(values[1]))
@@ -203,11 +207,9 @@
new DimensionBuilders.DpProp.Builder(2.f)
.setDynamicValue(
DynamicBuilders.DynamicFloat.animate(
- 2.f,
- 5.f))
+ 2.f, 5.f))
.build(),
- dp(1f))
- );
+ dp(1f)));
}
@Test
@@ -221,8 +223,7 @@
new DimensionBuilders.DpProp.Builder(2.f)
.setDynamicValue(
DynamicBuilders.DynamicFloat.animate(
- 2.f,
- 5.f))
+ 2.f, 5.f))
.build()));
}
@@ -247,4 +248,25 @@
assertThat(cornerRadius.getX().getValue()).isEqualTo(5f);
assertThat(cornerRadius.getY().getValue()).isEqualTo(5f);
}
+
+ @Test
+ public void backgroundSupportsLinearGradient() {
+ Background backgroundLinear =
+ new Background.Builder()
+ .setBrush(
+ new LinearGradient.Builder(argb(Color.BLUE), argb(Color.RED))
+ .build())
+ .build();
+ ModifiersProto.Background backgroundLinearProto = backgroundLinear.toProto();
+ assertThat(backgroundLinearProto.getBrush().getInnerCase())
+ .isEqualTo(ColorProto.Brush.InnerCase.LINEAR_GRADIENT);
+ }
+
+ @Test
+ public void background_withSweepGradient_throws() {
+ SweepGradient sweep = new SweepGradient.Builder(argb(Color.BLUE), argb(Color.RED)).build();
+ assertThrows(
+ IllegalArgumentException.class,
+ () -> new Background.Builder().setBrush(sweep).build());
+ }
}
diff --git a/window/window-demos/demo/lint-baseline.xml b/window/window-demos/demo/lint-baseline.xml
index 57a5f51..d4d73fc 100644
--- a/window/window-demos/demo/lint-baseline.xml
+++ b/window/window-demos/demo/lint-baseline.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
-<issues format="6" by="lint 8.8.0-alpha08" type="baseline" client="gradle" dependencies="false" name="AGP (8.8.0-alpha08)" variant="all" version="8.8.0-alpha08">
+<issues format="6" by="lint 8.9.0-alpha06" type="baseline" client="gradle" dependencies="false" name="AGP (8.9.0-alpha06)" variant="all" version="8.9.0-alpha06">
<issue
id="NewApi"
@@ -29,19 +29,19 @@
</issue>
<issue
- id="WrongConstant"
- message="Must be one or more of: LayoutParams.FLAG_ALLOW_LOCK_WHILE_SCREEN_ON, LayoutParams.FLAG_DIM_BEHIND, LayoutParams.FLAG_BLUR_BEHIND, LayoutParams.FLAG_NOT_FOCUSABLE, LayoutParams.FLAG_NOT_TOUCHABLE, LayoutParams.FLAG_NOT_TOUCH_MODAL, LayoutParams.FLAG_TOUCHABLE_WHEN_WAKING, LayoutParams.FLAG_KEEP_SCREEN_ON, LayoutParams.FLAG_LAYOUT_IN_SCREEN, LayoutParams.FLAG_LAYOUT_NO_LIMITS, LayoutParams.FLAG_FULLSCREEN, LayoutParams.FLAG_FORCE_NOT_FULLSCREEN, LayoutParams.FLAG_DITHER, LayoutParams.FLAG_SECURE, LayoutParams.FLAG_SCALED, LayoutParams.FLAG_IGNORE_CHEEK_PRESSES, LayoutParams.FLAG_LAYOUT_INSET_DECOR, LayoutParams.FLAG_ALT_FOCUSABLE_IM, LayoutParams.FLAG_WATCH_OUTSIDE_TOUCH, LayoutParams.FLAG_SHOW_WHEN_LOCKED, LayoutParams.FLAG_SHOW_WALLPAPER, LayoutParams.FLAG_TURN_SCREEN_ON, LayoutParams.FLAG_DISMISS_KEYGUARD, LayoutParams.FLAG_SPLIT_TOUCH, LayoutParams.FLAG_HARDWARE_ACCELERATED, LayoutParams.FLAG_LAYOUT_IN_OVERSCAN, LayoutParams.FLAG_TRANSLUCENT_STATUS, LayoutParams.FLAG_TRANSLUCENT_NAVIGATION, LayoutParams.FLAG_LOCAL_FOCUS_MODE, LayoutParams.FLAG_LAYOUT_ATTACHED_IN_DECOR, LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS"
- errorLine1=" ?.or(android.R.attr.showWhenLocked or android.R.attr.turnScreenOn)"
- errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
+ id="NewApi"
+ message="Call requires API level 30 (current min is 23): `android.view.WindowManager.LayoutParams#setFitInsetsTypes`"
+ errorLine1=" attrs.fitInsetsTypes = WindowInsets.Type.statusBars()"
+ errorLine2=" ~">
<location
- file="src/main/java/androidx/window/demo/PresentationActivity.kt"/>
+ file="src/main/java/androidx/window/demo/embedding/SplitImeActivityPlaceholder.kt"/>
</issue>
<issue
id="WrongConstant"
message="Must be one or more of: LayoutParams.FLAG_ALLOW_LOCK_WHILE_SCREEN_ON, LayoutParams.FLAG_DIM_BEHIND, LayoutParams.FLAG_BLUR_BEHIND, LayoutParams.FLAG_NOT_FOCUSABLE, LayoutParams.FLAG_NOT_TOUCHABLE, LayoutParams.FLAG_NOT_TOUCH_MODAL, LayoutParams.FLAG_TOUCHABLE_WHEN_WAKING, LayoutParams.FLAG_KEEP_SCREEN_ON, LayoutParams.FLAG_LAYOUT_IN_SCREEN, LayoutParams.FLAG_LAYOUT_NO_LIMITS, LayoutParams.FLAG_FULLSCREEN, LayoutParams.FLAG_FORCE_NOT_FULLSCREEN, LayoutParams.FLAG_DITHER, LayoutParams.FLAG_SECURE, LayoutParams.FLAG_SCALED, LayoutParams.FLAG_IGNORE_CHEEK_PRESSES, LayoutParams.FLAG_LAYOUT_INSET_DECOR, LayoutParams.FLAG_ALT_FOCUSABLE_IM, LayoutParams.FLAG_WATCH_OUTSIDE_TOUCH, LayoutParams.FLAG_SHOW_WHEN_LOCKED, LayoutParams.FLAG_SHOW_WALLPAPER, LayoutParams.FLAG_TURN_SCREEN_ON, LayoutParams.FLAG_DISMISS_KEYGUARD, LayoutParams.FLAG_SPLIT_TOUCH, LayoutParams.FLAG_HARDWARE_ACCELERATED, LayoutParams.FLAG_LAYOUT_IN_OVERSCAN, LayoutParams.FLAG_TRANSLUCENT_STATUS, LayoutParams.FLAG_TRANSLUCENT_NAVIGATION, LayoutParams.FLAG_LOCAL_FOCUS_MODE, LayoutParams.FLAG_LAYOUT_ATTACHED_IN_DECOR, LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS"
errorLine1=" ?.or(android.R.attr.showWhenLocked or android.R.attr.turnScreenOn)"
- errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~">
+ errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
<location
file="src/main/java/androidx/window/demo/PresentationActivity.kt"/>
</issue>
diff --git a/work/work-runtime/src/androidTest/java/androidx/work/impl/WorkerWrapperTest.java b/work/work-runtime/src/androidTest/java/androidx/work/impl/WorkerWrapperTest.java
index 286067b..d73cfec 100644
--- a/work/work-runtime/src/androidTest/java/androidx/work/impl/WorkerWrapperTest.java
+++ b/work/work-runtime/src/androidTest/java/androidx/work/impl/WorkerWrapperTest.java
@@ -1385,6 +1385,18 @@
assertThat(mWorkSpecDao.getState(work.getStringId()), is(FAILED));
}
+ @Test
+ @SmallTest
+ public void testWorkRequest_truncatedTraceTag() {
+ char[] aLongTag = new char[256];
+ Arrays.fill(aLongTag, 'W');
+ OneTimeWorkRequest work =
+ new OneTimeWorkRequest.Builder(TestWorker.class)
+ .setTraceTag(new String(aLongTag))
+ .build();
+ assertThat(work.getWorkSpec().getTraceTag().length(), is(127));
+ }
+
private WorkerWrapper.Builder createBuilder(String workSpecId) {
return new WorkerWrapper.Builder(
mContext,
diff --git a/work/work-runtime/src/main/java/androidx/work/WorkRequest.kt b/work/work-runtime/src/main/java/androidx/work/WorkRequest.kt
index 1b85c92..42b33741 100644
--- a/work/work-runtime/src/main/java/androidx/work/WorkRequest.kt
+++ b/work/work-runtime/src/main/java/androidx/work/WorkRequest.kt
@@ -162,13 +162,13 @@
* You should override the [traceTag], when you are using [ListenableWorker] delegation via
* a [WorkerFactory].
*
- * @param traceTag The name of the trace tag
+ * @param traceTag The name of the trace tag, truncate to a `127` character string if
+ * necessary.
* @return The current [Builder]
*/
@Suppress("MissingGetterMatchingBuilder")
@SuppressWarnings("SetterReturnsThis")
fun setTraceTag(traceTag: String): B {
- // No need to truncate the name here, given its handled by androidx.tracing.Trace
workSpec.traceTag = traceTag
return thisObject
}
@@ -280,10 +280,16 @@
}
require(workSpec.initialDelay <= 0) { "Expedited jobs cannot be delayed" }
}
- if (workSpec.traceTag == null) {
+ val traceTag = workSpec.traceTag
+ if (traceTag == null) {
// Derive a trace tag based on the fully qualified class name if
// one has not already been defined.
workSpec.traceTag = deriveTraceTagFromClassName(workSpec.workerClassName)
+ } else if (traceTag.length > MAX_TRACE_SPAN_LENGTH) {
+ // If there is a trace tag but it exceeds the limit, then truncate it.
+ // Since we also pipe this tag to JobInfo we need to not exceed the limit even
+ // though androidx.tracing.Trace already truncate tags.
+ workSpec.traceTag = traceTag.take(MAX_TRACE_SPAN_LENGTH)
}
// Create a new id and WorkSpec so this WorkRequest.Builder can be used multiple times.
setId(UUID.randomUUID())
diff --git a/xr/arcore/arcore/src/test/kotlin/androidx/xr/arcore/AnchorTest.kt b/xr/arcore/arcore/src/test/kotlin/androidx/xr/arcore/AnchorTest.kt
index ab6b085..49453a2 100644
--- a/xr/arcore/arcore/src/test/kotlin/androidx/xr/arcore/AnchorTest.kt
+++ b/xr/arcore/arcore/src/test/kotlin/androidx/xr/arcore/AnchorTest.kt
@@ -121,6 +121,7 @@
.isEqualTo(RuntimeAnchor.PersistenceState.Persisted)
}
+ @Ignore("Flaky test, see b/379198572")
@Test
fun getPersistedAnchorUuids_previouslyPersistedAnchor_returnsPersistedAnchorUuid() = runTest {
val session = createTestSession()
@@ -159,6 +160,7 @@
assertThat(Anchor.load(session, uuid!!)).isInstanceOf(AnchorCreateSuccess::class.java)
}
+ @Ignore("Flaky test, see b/384999184")
@Test
fun loadFromNativePointer_returnsAnchorCreateSuccess() = runTest {
val session = createTestSession()